summaryrefslogtreecommitdiff
path: root/src/clpp11.hpp
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2018-07-27 20:53:24 +0200
committerCedric Nugteren <web@cedricnugteren.nl>2018-07-27 20:53:24 +0200
commit429ff070f84212a202091c9173bd5d754dc05b51 (patch)
tree527ff1c32c4579d4fa2847f7eaed92b9ac898c35 /src/clpp11.hpp
parentf84036948b82d5f723f7f82bc2f6c08ea2f891e8 (diff)
Fixed a bug: forgot to initialize the shared pointer for the null kernel
Diffstat (limited to 'src/clpp11.hpp')
-rw-r--r--src/clpp11.hpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/clpp11.hpp b/src/clpp11.hpp
index 093214b3..2d411a41 100644
--- a/src/clpp11.hpp
+++ b/src/clpp11.hpp
@@ -448,9 +448,9 @@ class Program {
// Source-based constructor with memory management
explicit Program(const Context &context, const std::string &source) {
#ifdef AMD_SI_EMPTY_KERNEL_WORKAROUND
- const std::string source_hainan = source + "\n__kernel void null_kernel() {}\n";
- const char *source_ptr = &source_hainan[0];
- const auto length = source_hainan.length();
+ const std::string source_null_kernel = source + "\n__kernel void null_kernel() {}\n";
+ const char *source_ptr = &source_null_kernel[0];
+ const auto length = source_null_kernel.length();
#else
const char *source_ptr = &source[0];
const auto length = source.length();
@@ -770,7 +770,14 @@ class Kernel {
kernel_(new cl_kernel, [](cl_kernel* k) {
if (*k) { CheckErrorDtor(clReleaseKernel(*k)); }
delete k;
- }) {
+ })
+ #ifdef AMD_SI_EMPTY_KERNEL_WORKAROUND
+ , null_kernel_(new cl_kernel, [](cl_kernel* k) {
+ if (*k) { CheckErrorDtor(clReleaseKernel(*k)); }
+ delete k;
+ })
+ #endif
+ {
auto status = CL_SUCCESS;
*kernel_ = clCreateKernel(program->operator()(), name.c_str(), &status);
CLCudaAPIError::Check(status, "clCreateKernel");