Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map of OpenCL macros should use std::string instead of const char* #1297

SteveBronder opened this issue Aug 5, 2019 · 0 comments


Copy link

commented Aug 5, 2019


As described in this discourse thread @alashworth found a bug when we grab the macros for the OpenCL kernels. We were using a map as std::map<const char*, int>, but when we tried updating new options in the kernels this would do a pointer comparison instead of a comparison of the non-null elements of the const char array.



const kernel_cl<in_buffer, out_buffer, int, int> inv_lower_tri_multiply(
    {thread_block_helpers, inv_lower_tri_multiply_kernel_code},
    {{"THREAD_BLOCK_SIZE", 32}, {"WORK_PER_THREAD", 8}});

The {{"THREAD_BLOCK_SIZE", 32}, {"WORK_PER_THREAD", 8}} is a std::map<const char*, int>. When we add / update these elements to the kernel's macros instead of looking up "WORK_PER_THREAD" the maps find method looks for the const char*s address. It doesn't see that and so adds the new map value even though what we actually wanted to do was just update the "WORK_PER_THREAD" key.

Expected Output

No duplicates in OpenCL options map

Current Version:


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.