[feat] Added two cl_mem objects, one for private memory and the other for constant memory. Both buffers are added in allocated regions to be released in the final cleanup
@@ -46,6 +46,8 @@ public class OCLMemoryManager extends TornadoLogger implements TornadoMemoryProv
private long deviceBufferAddress;
private final OCLDeviceContext deviceContext;
private long deviceHeapPointer;
+ private long constantPointer;
+ private long privatePointer;
private long heapLimit;
private long heapPosition;
private boolean initialised;
@@ -155,6 +157,8 @@ public class OCLMemoryManager extends TornadoLogger implements TornadoMemoryProv
public void allocateRegion(long numBytes) {
this.heapLimit = numBytes;
this.deviceHeapPointer = deviceContext.getPlatformContext().createBuffer(OCLMemFlags.CL_MEM_READ_WRITE | OCLMemFlags.CL_MEM_ALLOC_HOST_PTR, numBytes);
+ this.constantPointer = deviceContext.getPlatformContext().createBuffer(OCLMemFlags.CL_MEM_READ_WRITE | OCLMemFlags.CL_MEM_ALLOC_HOST_PTR, 4);
+ this.privatePointer = deviceContext.getPlatformContext().createBuffer(OCLMemFlags.CL_MEM_READ_WRITE | OCLMemFlags.CL_MEM_ALLOC_HOST_PTR, 4);
}
public void init(OCLBackend backend, long address) {
@@ -181,6 +185,14 @@ public class OCLMemoryManager extends TornadoLogger implements TornadoMemoryProv
return deviceHeapPointer;
}
+ public long toConstantAddress() {
+ return constantPointer;
+ }
+
+ public long toPrivateAddress() {
+ return privatePointer;
+ }
+
public long toRelativeAddress() {
return 0;
}
