intel / intel/llvm

accessor should export its template arguments / template matching error on accessor<T,int,auto...>

Open
#10,057 2 comments 0 reactions 0 assignees View on GitHub
bug confirmed
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

When storing SYCL accessors inside a struct, it is important to be able to access the accessor's template parameters. (Refs: https://github.com/intel/llvm/issues/9434, https://github.com/KhronosGroup/SYCL-Docs/issues/421).

The [accessor documentation](https://github.com/KhronosGroup/SYCL-Docs/blob/9b616cef64dbdd658cb5fb6bcaf9e0bac22cad17/adoc/headers/accessorBuffer.h#L32-L47) shows a definition:

```
template ? access_mode::read
: access_mode::read_write),
target AccessTarget = target::device,
access::placeholder isPlaceholder = access::placeholder::false_t>
class accessor
```

However, this definition is defective, because the accessor does not re-export its access mode or target.

Further, attempting to work around this limitation exposes an implementation flaw in DPCPP. The following code [works generally](https://stackoverflow.com/questions/76534038/how-to-match-c-varadic-template-parameter-pack-to-enum-class) and also succeeds with hipSYCL. However, it fails to compile with dpcpp:

```
#include

template
struct apply_accessor {};

template typename Acc,
typename T1, typename T, auto... A>
struct apply_accessor, T> {
using type = Acc;
};

struct A {
using X = sycl::accessor;//, sycl::access::placeholder::false_t>;

using Y = typename apply_accessor::type;
};

int main() {
A a;
}
```

Copy of filing from: https://github.com/KhronosGroup/SYCL-Docs/issues/433

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.