diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2016-07-03 16:34:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-03 16:34:44 +0200 |
commit | 4105a7959861597b97c1d72a64fff773a426a940 (patch) | |
tree | 58adc005b95c441f5e0d27f18424de5b93245918 /src | |
parent | 5a690f4e36ea50d5401ba37d013ef425a98f2542 (diff) | |
parent | 7424532859ff91321da56a72ae1e9195a059a351 (diff) |
Merge pull request #76 from gcp/fix_local_mem_size
Fixes clGetKernelWorkGroupInfo to work well with both 32-bit and 64-bit systems
Diffstat (limited to 'src')
-rw-r--r-- | src/clpp11.hpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/clpp11.hpp b/src/clpp11.hpp index 1eeaf702..2b21e1e1 100644 --- a/src/clpp11.hpp +++ b/src/clpp11.hpp @@ -199,8 +199,8 @@ class Device { std::vector<size_t> MaxWorkItemSizes() const { return GetInfoVector<size_t>(CL_DEVICE_MAX_WORK_ITEM_SIZES); } - size_t LocalMemSize() const { - return static_cast<size_t>(GetInfo<cl_ulong>(CL_DEVICE_LOCAL_MEM_SIZE)); + cl_ulong LocalMemSize() const { + return GetInfo<cl_ulong>(CL_DEVICE_LOCAL_MEM_SIZE); } std::string Capabilities() const { return GetInfoString(CL_DEVICE_EXTENSIONS); } size_t CoreClock() const { return GetInfo(CL_DEVICE_MAX_CLOCK_FREQUENCY); } @@ -211,7 +211,7 @@ class Device { size_t MemoryBusWidth() const { return 0; } // Not exposed in OpenCL // Configuration-validity checks - bool IsLocalMemoryValid(const size_t local_mem_usage) const { + bool IsLocalMemoryValid(const cl_ulong local_mem_usage) const { return (local_mem_usage <= LocalMemSize()); } bool IsThreadConfigValid(const std::vector<size_t> &local) const { @@ -655,11 +655,11 @@ class Kernel { } // Retrieves the amount of local memory used per work-group for this kernel - size_t LocalMemUsage(const Device &device) const { + cl_ulong LocalMemUsage(const Device &device) const { auto bytes = size_t{0}; auto query = cl_kernel_work_group_info{CL_KERNEL_LOCAL_MEM_SIZE}; CheckError(clGetKernelWorkGroupInfo(*kernel_, device(), query, 0, nullptr, &bytes)); - auto result = size_t{0}; + auto result = cl_ulong{0}; CheckError(clGetKernelWorkGroupInfo(*kernel_, device(), query, bytes, &result, nullptr)); return result; } |