diff options
author | Sven Gothel <[email protected]> | 2014-02-21 08:37:26 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-02-21 08:37:26 +0100 |
commit | d4f04ddd3ef3b65b7c31d3504cf55489153c60c1 (patch) | |
tree | e72294205d659cb1484c72a612f72f043634a648 /src/com/jogamp | |
parent | 84e5e16a4aaa206c39b04b980d8d63ffacb97dbb (diff) |
Bug 979: Add 'CL_DEVICE_MEM_BASE_ADDR_ALIGN' to CLDevice and overal maximum to CLContext - Split CLBufferTest and use alignment.
See Bug 979 for remaining issues and discussion.
Diffstat (limited to 'src/com/jogamp')
-rw-r--r-- | src/com/jogamp/opencl/CLContext.java | 11 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLDevice.java | 13 | ||||
-rw-r--r-- | src/com/jogamp/opencl/impl/CLTLInfoAccessor.java | 10 | ||||
-rw-r--r-- | src/com/jogamp/opencl/spi/CLInfoAccessor.java | 8 |
4 files changed, 38 insertions, 4 deletions
diff --git a/src/com/jogamp/opencl/CLContext.java b/src/com/jogamp/opencl/CLContext.java index 163375eb..378f42f9 100644 --- a/src/com/jogamp/opencl/CLContext.java +++ b/src/com/jogamp/opencl/CLContext.java @@ -628,6 +628,17 @@ public class CLContext extends CLObjectResource { } /** + * Returns the maximum {@link CLDevice#getMemBaseAddrAlign()} of all devices. + */ + public long getMaxMemBaseAddrAlign() { + long maxAlignment = 0; + for (CLDevice device : getDevices()) { + maxAlignment = Math.max(maxAlignment, device.getMemBaseAddrAlign()); + } + return maxAlignment; + } + + /** * Returns all devices associated with this CLContext. */ public CLDevice[] getDevices() { diff --git a/src/com/jogamp/opencl/CLDevice.java b/src/com/jogamp/opencl/CLDevice.java index 25fb009f..860fa1a0 100644 --- a/src/com/jogamp/opencl/CLDevice.java +++ b/src/com/jogamp/opencl/CLDevice.java @@ -48,7 +48,7 @@ import static com.jogamp.opencl.llb.CL.*; * @see CLPlatform#getMaxFlopsDevice(com.jogamp.opencl.CLDevice.Type...) * @see CLContext#getDevices() * @see CLContext#getMaxFlopsDevice(com.jogamp.opencl.CLDevice.Type) - * @author Michael Bien + * @author Michael Bien, et al. */ public class CLDevice extends CLObject { @@ -356,7 +356,16 @@ public class CLDevice extends CLObject { */ @CLProperty("CL_DEVICE_MAX_MEM_ALLOC_SIZE") public long getMaxMemAllocSize() { - return deviceInfo.getLong(CL_DEVICE_MAX_MEM_ALLOC_SIZE); + return deviceInfo.getLong(CL.CL_DEVICE_MAX_MEM_ALLOC_SIZE); + } + + /** + * Returns the <code>uint32_t</code> memory base address alignment + * value reinterpreted as a <code>long</code> value. + */ + @CLProperty("CL_DEVICE_MEM_BASE_ADDR_ALIGN") + public long getMemBaseAddrAlign() { + return deviceInfo.getUInt32Long(CL.CL_DEVICE_MEM_BASE_ADDR_ALIGN); } /** diff --git a/src/com/jogamp/opencl/impl/CLTLInfoAccessor.java b/src/com/jogamp/opencl/impl/CLTLInfoAccessor.java index c31b22a6..28115305 100644 --- a/src/com/jogamp/opencl/impl/CLTLInfoAccessor.java +++ b/src/com/jogamp/opencl/impl/CLTLInfoAccessor.java @@ -41,7 +41,7 @@ import static com.jogamp.opencl.CLException.*; /** * Internal utility for common OpenCL clGetFooInfo calls. * Threadsafe, threadlocal implementation. - * @author Michael Bien + * @author Michael Bien, et al. */ public abstract class CLTLInfoAccessor implements CLInfoAccessor { @@ -65,6 +65,14 @@ public abstract class CLTLInfoAccessor implements CLInfoAccessor { }; @Override + public final long getUInt32Long(int key) { + final ByteBuffer buffer = getBB(4).putInt(0, 0); + final int ret = getInfo(key, 4, buffer, null); + CLException.checkForError(ret, "error while asking for info value"); + return Bitstream.toUInt32Long(buffer.getInt(0)); + } + + @Override public final long getLong(int key) { ByteBuffer buffer = getBB(8).putLong(0, 0); diff --git a/src/com/jogamp/opencl/spi/CLInfoAccessor.java b/src/com/jogamp/opencl/spi/CLInfoAccessor.java index 0ff0aeac..a02a38e8 100644 --- a/src/com/jogamp/opencl/spi/CLInfoAccessor.java +++ b/src/com/jogamp/opencl/spi/CLInfoAccessor.java @@ -6,13 +6,19 @@ package com.jogamp.opencl.spi; /** * Internal utility for common OpenCL clGetFooInfo calls. * Provides common accessors to CL objects. - * @author Michael Bien + * @author Michael Bien, et al. */ public interface CLInfoAccessor { int[] getInts(int key, int n); /** + * Returns the <code>uint32_t</code> value for the given key, + * reinterpreted as a <code>long</code> value. + */ + long getUInt32Long(int key); + + /** * Returns the long value for the given key. */ long getLong(int key); |