KhronosGroup / KhronosGroup/SYCL-Docs

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

Open
#433 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
158
Forks
80
Avg merge
7d 6h
Merged PRs (30d)
5

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, #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;
}
```

https://github.com/intel/llvm/ no longer allows submitting bug-reports.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the accessor definition in the linked SYCL accessor documentation and reproduce the template-matching case using the shown sycl/sycl.hpp example. Compare the documented template parameters with the accessor API and verify whether the reproducer compiles after the required specification or implementation changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.