改critical零拷贝,性能+5%
This commit is contained in:
+18
@@ -3,3 +3,21 @@
|
|||||||
/input3/
|
/input3/
|
||||||
/PngSuite-2017jul19.zip
|
/PngSuite-2017jul19.zip
|
||||||
/input/
|
/input/
|
||||||
|
/hs_err_pid22004.log
|
||||||
|
/hs_err_pid22004.mdmp
|
||||||
|
/hs_err_pid24748.log
|
||||||
|
/hs_err_pid24748.mdmp
|
||||||
|
/hs_err_pid31056.log
|
||||||
|
/hs_err_pid31056.mdmp
|
||||||
|
/hs_err_pid31060.log
|
||||||
|
/hs_err_pid31060.mdmp
|
||||||
|
/hs_err_pid33172.log
|
||||||
|
/hs_err_pid33172.mdmp
|
||||||
|
/hs_err_pid33180.log
|
||||||
|
/hs_err_pid33180.mdmp
|
||||||
|
/hs_err_pid33300.log
|
||||||
|
/hs_err_pid33300.mdmp
|
||||||
|
/hs_err_pid33776.log
|
||||||
|
/hs_err_pid33776.mdmp
|
||||||
|
/hs_err_pid5920.log
|
||||||
|
/hs_err_pid5920.mdmp
|
||||||
|
|||||||
Binary file not shown.
@@ -66,7 +66,7 @@ public class KIFCodec {
|
|||||||
CompletableFuture<KIFCompressedImageBlock>f2=f1.thenApplyAsync((pipeline)->{
|
CompletableFuture<KIFCompressedImageBlock>f2=f1.thenApplyAsync((pipeline)->{
|
||||||
return pipeline.encodeStage2();
|
return pipeline.encodeStage2();
|
||||||
},cpupool);*/
|
},cpupool);*/
|
||||||
return getBestPool().submit(()->{
|
return gpupool.submit(()->{
|
||||||
KIFEncodePipeline kip=new KIFEncodePipeline(input.get(), mode);
|
KIFEncodePipeline kip=new KIFEncodePipeline(input.get(), mode);
|
||||||
kip.encodeStage1();
|
kip.encodeStage1();
|
||||||
return kip.encodeStage2();
|
return kip.encodeStage2();
|
||||||
@@ -122,7 +122,7 @@ public class KIFCodec {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
},gpupool);*/
|
},gpupool);*/
|
||||||
return getBestPool().submit(()->{
|
return gpupool.submit(()->{
|
||||||
KIFDecodePipeline kip=new KIFDecodePipeline(input.get());
|
KIFDecodePipeline kip=new KIFDecodePipeline(input.get());
|
||||||
try {
|
try {
|
||||||
kip.decodeStage1();
|
kip.decodeStage1();
|
||||||
|
|||||||
@@ -53,9 +53,6 @@ public class KIFDecodePipeline {
|
|||||||
return decodeStage2CPU();
|
return decodeStage2CPU();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static ThreadLocal<MemorySegment>m1=ThreadLocal.withInitial(()->{
|
|
||||||
return ((ArenaImpl)Arena.ofAuto()).allocateNoInit(1024*1024*4,4);
|
|
||||||
});
|
|
||||||
|
|
||||||
private static ThreadLocalOpenCLMemory tlm0=new ThreadLocalOpenCLMemory(1024*1024*4);
|
private static ThreadLocalOpenCLMemory tlm0=new ThreadLocalOpenCLMemory(1024*1024*4);
|
||||||
private static ThreadLocalOpenCLMemory tlm1=new ThreadLocalOpenCLMemory(1024*1024*4);
|
private static ThreadLocalOpenCLMemory tlm1=new ThreadLocalOpenCLMemory(1024*1024*4);
|
||||||
@@ -69,13 +66,10 @@ public class KIFDecodePipeline {
|
|||||||
OpenCLMemory ocm2 = null;
|
OpenCLMemory ocm2 = null;
|
||||||
OpenCLMemory ocm3 = null;
|
OpenCLMemory ocm3 = null;
|
||||||
int[]des;
|
int[]des;
|
||||||
MemorySegment dataserpseg= m1.get();
|
|
||||||
tdb.mark("堆外内存分配");
|
ocm1=tlm0.get(oct.getOpenCLContext());
|
||||||
dataserpseg.asByteBuffer().put(dataserp).flip();
|
tdb.mark("分配显存");
|
||||||
tdb.mark("堆内存->堆外内存");
|
oct.getOpenCLCommandQueue().executeWriteBuffer(ocm1, MemorySegment.ofArray(dataserp), true,0,0,dataserp.length);
|
||||||
ocm1=tlm0.get(oct.getOpenCLContext());
|
|
||||||
tdb.mark("分配显存");
|
|
||||||
oct.getOpenCLCommandQueue().executeWriteBuffer(ocm1, dataserpseg, false,0,0,dataserp.length);
|
|
||||||
tdb.mark("内存->显存");
|
tdb.mark("内存->显存");
|
||||||
|
|
||||||
OpenCLMemory dataser;
|
OpenCLMemory dataser;
|
||||||
|
|||||||
@@ -80,10 +80,6 @@ public class KIFEncodePipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static ThreadLocal<MemorySegment>m1=ThreadLocal.withInitial(()->{
|
|
||||||
return ((ArenaImpl)Arena.ofAuto()).allocateNoInit(1024*1024*4,4);
|
|
||||||
});
|
|
||||||
|
|
||||||
private static ThreadLocalOpenCLMemory tlm0=new ThreadLocalOpenCLMemory(1024*1024*4);
|
private static ThreadLocalOpenCLMemory tlm0=new ThreadLocalOpenCLMemory(1024*1024*4);
|
||||||
private static ThreadLocalOpenCLMemory tlmpred1=new ThreadLocalOpenCLMemory(1024*1024*4);
|
private static ThreadLocalOpenCLMemory tlmpred1=new ThreadLocalOpenCLMemory(1024*1024*4);
|
||||||
private static ThreadLocalOpenCLMemory tlmpred2=new ThreadLocalOpenCLMemory(1024*1024*4);
|
private static ThreadLocalOpenCLMemory tlmpred2=new ThreadLocalOpenCLMemory(1024*1024*4);
|
||||||
@@ -96,7 +92,6 @@ public class KIFEncodePipeline {
|
|||||||
OpenCLMemory ocm1 = null;
|
OpenCLMemory ocm1 = null;
|
||||||
OpenCLMemory ocm2 = null;
|
OpenCLMemory ocm2 = null;
|
||||||
OpenCLMemory ocm3 = null;
|
OpenCLMemory ocm3 = null;
|
||||||
MemorySegment dataserpseg= m1.get();
|
|
||||||
tdb.mark("堆外内存分配");
|
tdb.mark("堆外内存分配");
|
||||||
//MemorySegment.copy(pixels,0,dataserpseg,0, pixels.byteSize());
|
//MemorySegment.copy(pixels,0,dataserpseg,0, pixels.byteSize());
|
||||||
tdb.mark("堆内存->堆外内存");
|
tdb.mark("堆内存->堆外内存");
|
||||||
@@ -170,10 +165,8 @@ public class KIFEncodePipeline {
|
|||||||
serialData2=MembandBoost.allocateUninitializedByteArray(width*height*4);
|
serialData2=MembandBoost.allocateUninitializedByteArray(width*height*4);
|
||||||
tdb.mark("分配堆内存");
|
tdb.mark("分配堆内存");
|
||||||
|
|
||||||
oct.getOpenCLCommandQueue().executeReadBuffer(dataser, dataserpseg, true,0,0,width*height*4);
|
oct.getOpenCLCommandQueue().executeReadBuffer(dataser, MemorySegment.ofArray(serialData2), true,0,0,width*height*4);
|
||||||
tdb.mark("显存->内存");
|
tdb.mark("显存->内存");
|
||||||
MemorySegment.copy(dataserpseg, ValueLayout.JAVA_BYTE, 0, serialData2, 0,width*height*4);
|
|
||||||
tdb.mark("堆外内存->堆内存");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public KIFCompressedImageBlock encodeStage2() {
|
public KIFCompressedImageBlock encodeStage2() {
|
||||||
|
|||||||
Reference in New Issue
Block a user