KhronosGroup / KhronosGroup/OpenCL-Docs
object in atomic_load should be declared as const
- Dominant language
- Python
- Stars
- 420
- Forks
- 131
- Avg merge
- 5d 13h
- Merged PRs (30d)
- 11
Description
OpenCL C [atomic_load](https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_C.html#atomic_load) declaration does not contain `const` qualifier. As a result below kernel can't be compiled.
```c
kernel void test(global const atomic_int* a, global int* b)
{
b[0] = atomic_load(a);
}
```
C, C++ and OpenCL C++ specifications contain `const` qualifier, so it seems natural that OpenCL C should also follow this pattern:
1. https://en.cppreference.com/w/c/atomic/atomic_load
1. https://en.cppreference.com/w/cpp/atomic/atomic_load
1. https://www.khronos.org/registry/OpenCL/specs/2.2/html/OpenCL_Cxx.html#atomic-operations-library
Contributor guide
Research direction
Start with the linked OpenCL C atomic_load specification and compare its declaration with the linked C, C++, and OpenCL C++ references. Use the kernel example to verify the reported compilation issue is addressed; done means the OpenCL C declaration matches the intended const-qualified form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100