intel / intel/llvm

Unintended different behavior between SYCL and OpenCL attributes

Open
#1,596 9 comments 0 reactions 1 assignee Assigned to @bader View on GitHub
upstream
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

```c++
#define __private __attribute__((opencl_private))
#define __local __attribute__((opencl_local))

//struct S { void f() __private; }; //should be OK, but is error

void t() {
//__private int i1; //should be OK, but is error
int i2;
__private int* p;
__local int* l;
p-l; //should be error "non-overlapping address spaces"
}
```

OCL C++ version: https://godbolt.org/z/wCDKhZ

For users to use the decorated pointer (from `multi_ptr::pointer_t`) for performance tuning it is important this doesn't have any unintentional differences.

- Attribute on methods is important to have a `this` pointer with attribute
- Allowing attribute on variable avoids having to strip address space in templated code
- Error for non-overlapping address space is important to have correct code

https://github.com/intel/llvm/pull/1581 contains some previous discussion of this issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.