KhronosGroup / KhronosGroup/OpenCL-Docs

object in atomic_load should be declared as const

Open
#480 5 comments 0 reactions 0 assignees View on GitHub
needs-new-opencl-minor-version OpenCL C Spec
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.