diff options
author | Michael Bien <[email protected]> | 2010-07-04 00:16:33 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-07-04 00:16:33 +0200 |
commit | b9c7501cc93743b168f8bc938adadf0be7d4ff80 (patch) | |
tree | 6121d3c1ce0b5130155971d776c65e0e2857db99 | |
parent | b90d32cba56e54e73fd93aed59b7a4edf70831d7 (diff) |
misc OpenCL 1.1 HLB updates. ImageFormats, getters, javadoc.
-rw-r--r-- | src/com/jogamp/opencl/CLDevice.java | 87 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLImageFormat.java | 15 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLMemory.java | 12 | ||||
-rw-r--r-- | src/com/jogamp/opencl/util/CLUtil.java | 5 | ||||
-rw-r--r-- | test/com/jogamp/opencl/HighLevelBindingTest.java | 1 |
5 files changed, 110 insertions, 10 deletions
diff --git a/src/com/jogamp/opencl/CLDevice.java b/src/com/jogamp/opencl/CLDevice.java index 22fc7fcf..88b4a67f 100644 --- a/src/com/jogamp/opencl/CLDevice.java +++ b/src/com/jogamp/opencl/CLDevice.java @@ -98,12 +98,17 @@ public final class CLDevice extends CLObject { } /** - * Returns OpenCL version string. Returns the OpenCL version supported by the device. - * This version string has the following format:<br> - * OpenCL[space][major_version.minor_version][space][vendor-specific information] + * Returns the OpenCL version supported by the device. */ - public String getVersion() { - return deviceInfo.getString(CL_DEVICE_VERSION); + public CLVersion getVersion() { + return new CLVersion(deviceInfo.getString(CL_DEVICE_VERSION)); + } + + /** + * Returns the OpenCL-C version supported by the device. + */ + public CLVersion getCVersion() { + return new CLVersion(deviceInfo.getString(CL_DEVICE_OPENCL_C_VERSION)); } /** @@ -177,6 +182,62 @@ public final class CLDevice extends CLObject { } /** + * Native vector width size for built-in char vectors. + * The vector width is defined as the number of scalar elements that can be stored in the vector. + */ + public int getNativeCharVectorWidth() { + return (int)deviceInfo.getLong(CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR); + } + + /** + * Native vector width size for built-in short vectors. + * The vector width is defined as the number of scalar elements that can be stored in the vector. + */ + public int getNativeShortVectorWidth() { + return (int)deviceInfo.getLong(CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT); + } + + /** + * Native vector width size for built-in int vectors. + * The vector width is defined as the number of scalar elements that can be stored in the vector. + */ + public int getNativeIntVectorWidth() { + return (int)deviceInfo.getLong(CL_DEVICE_NATIVE_VECTOR_WIDTH_INT); + } + + /** + * Native vector width size for built-in long vectors. + * The vector width is defined as the number of scalar elements that can be stored in the vector. + */ + public int getNativeLongVectorWidth() { + return (int)deviceInfo.getLong(CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG); + } + + /** + * Native vector width size for built-in half vectors. + * The vector width is defined as the number of scalar elements that can be stored in the vector. + */ + public int getNativeHalfVectorWidth() { + return (int)deviceInfo.getLong(CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF); + } + + /** + * Native vector width size for built-in float vectors. + * The vector width is defined as the number of scalar elements that can be stored in the vector. + */ + public int getNativeFloatVectorWidth() { + return (int)deviceInfo.getLong(CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT); + } + + /** + * Native vector width size for built-in double vectors. + * The vector width is defined as the number of scalar elements that can be stored in the vector. + */ + public int getNativeDoubleVectorWidth() { + return (int)deviceInfo.getLong(CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE); + } + + /** * Returns the number of parallel compute cores on the OpenCL device. * The minimum value is 1. */ @@ -220,8 +281,9 @@ public final class CLDevice extends CLObject { } /** - * Returns the max size in bytes of the arguments that can be passed to a kernel. - * The minimum value is 256. + * Returns the max size in bytes of the arguments that can be passed to a kernel.<br/> + * The minimum OpenCL 1.0 value is 256.<br/> + * The minimum OpenCL 1.1 value is 1024.<br/> */ public long getMaxParameterSize() { return deviceInfo.getLong(CL_DEVICE_MAX_PARAMETER_SIZE); @@ -242,13 +304,22 @@ public final class CLDevice extends CLObject { } /** - * Returns the local memory size in bytes. + * Returns the local memory size in bytes.<br/> + * The minimum OpenCL 1.0 value is 16 KB.<br/> + * The minimum OpenCL 1.1 value is 32 KB.<br/> */ public long getLocalMemSize() { return deviceInfo.getLong(CL_DEVICE_LOCAL_MEM_SIZE); } /** + * Returns true if the device and the host have a unified memory subsystem. + */ + public boolean isMemoryUnified() { + return deviceInfo.getLong(CL_DEVICE_HOST_UNIFIED_MEMORY) == CL_TRUE; + } + + /** * Returns the max size in bytes of a constant buffer allocation. * The minimum value is 64 KB. */ diff --git a/src/com/jogamp/opencl/CLImageFormat.java b/src/com/jogamp/opencl/CLImageFormat.java index 17b7bb6c..99b50cdc 100644 --- a/src/com/jogamp/opencl/CLImageFormat.java +++ b/src/com/jogamp/opencl/CLImageFormat.java @@ -98,6 +98,11 @@ public final class CLImageFormat { /** * */ + Rx(CL_Rx), + + /** + * + */ A(CL_A), /** @@ -108,6 +113,11 @@ public final class CLImageFormat { /** * */ + RGx(CL_RGx), + + /** + * + */ RA(CL_RA), /** @@ -120,6 +130,11 @@ public final class CLImageFormat { /** * */ + RGBx(CL_RGBx), + + /** + * + */ RGBA(CL_RGBA), /** diff --git a/src/com/jogamp/opencl/CLMemory.java b/src/com/jogamp/opencl/CLMemory.java index e973fbab..6ab5cd02 100644 --- a/src/com/jogamp/opencl/CLMemory.java +++ b/src/com/jogamp/opencl/CLMemory.java @@ -124,6 +124,17 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL } /** + * Returns the number of buffer mappings. The map count returned should be considered immediately stale. + * It is unsuitable for general use in applications. This feature is provided for debugging. + */ + public int getMapCount() { + IntBuffer value = Buffers.newDirectIntBuffer(1); + int ret = cl.clGetMemObjectInfo(ID, CL_MEM_MAP_COUNT, 4, value, null); + checkForError(ret, "can not obtain buffer map count."); + return value.get(); + } + + /** * Returns true if this memory object was created with the {@link Mem#READ_ONLY} flag. */ public boolean isReadOnly() { @@ -167,6 +178,7 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL /** * Returns the OpenGL object id of this shared buffer. */ + @Deprecated /*public*/ final int _getGLObjectID() { int[] array = new int[1]; int ret = ((CLGLI)cl).clGetGLObjectInfo(ID, null, 0, array, 0); diff --git a/src/com/jogamp/opencl/util/CLUtil.java b/src/com/jogamp/opencl/util/CLUtil.java index 973c0dc9..015f6639 100644 --- a/src/com/jogamp/opencl/util/CLUtil.java +++ b/src/com/jogamp/opencl/util/CLUtil.java @@ -63,7 +63,7 @@ public class CLUtil { map.put("CL_DEVICE_PROFILE", dev.getProfile()); map.put("CL_DEVICE_VENDOR", dev.getVendor()); map.put("CL_DEVICE_VENDOR_ID", dev.getVendorID()+""); - map.put("CL_DEVICE_VERSION", dev.getVersion()); + map.put("CL_DEVICE_VERSION", dev.getVersion().toString()); map.put("CL_DRIVER_VERSION", dev.getDriverVersion()); map.put("CL_DEVICE_TYPE", dev.getType().toString()); @@ -74,10 +74,11 @@ public class CLUtil { map.put("CL_DEVICE_LOCAL_MEM_TYPE", dev.getLocalMemType()+""); map.put("CL_DEVICE_GLOBAL_MEM_CACHE_SIZE", dev.getGlobalMemCacheSize()+""); map.put("CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE", dev.getGlobalMemCachelineSize()+""); - map.put("CL_DEVICE_GLOBAL_MEM_CACHE_TYPE", dev.getGlobalMemCacheType()+""); + map.put("CL_DEVICE_GLOBAL_MEM_CACHE_TYPE", dev.getGlobalMemCacheType()+""); map.put("CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE", dev.getMaxConstantBufferSize()+""); map.put("CL_DEVICE_MAX_CONSTANT_ARGS", dev.getMaxConstantArgs()+""); map.put("CL_DEVICE_ERROR_CORRECTION_SUPPORT", dev.isErrorCorrectionSupported()+""); + map.put("CL_DEVICE_HOST_UNIFIED_MEMORY", dev.isMemoryUnified()+""); map.put("CL_DEVICE_MAX_CLOCK_FREQUENCY", dev.getMaxClockFrequency()+" MHz"); map.put("CL_DEVICE_PROFILING_TIMER_RESOLUTION", dev.getProfilingTimerResolution()+" ns"); diff --git a/test/com/jogamp/opencl/HighLevelBindingTest.java b/test/com/jogamp/opencl/HighLevelBindingTest.java index ba2b11fa..884e22ee 100644 --- a/test/com/jogamp/opencl/HighLevelBindingTest.java +++ b/test/com/jogamp/opencl/HighLevelBindingTest.java @@ -122,6 +122,7 @@ public class HighLevelBindingTest { out.println(" vendor: "+device.getVendor()); out.println(" vendor id: "+device.getVendorID()); out.println(" version: "+device.getVersion()); +// out.println(" C version: "+device.getCVersion()); //CL 1.1 out.println(" driver version: "+device.getDriverVersion()); out.println(" type: "+device.getType()); out.println(" global mem: "+device.getGlobalMemSize()/(1024*1024)+" MB"); |