Skip to content

[SYCL][Doc] Specify that invalid host_access_enum values are ill-formed#21445

Merged
sarnex merged 1 commit into
intel:syclfrom
Maetveis:host_access_invalid_values_are_illformed
Mar 4, 2026
Merged

[SYCL][Doc] Specify that invalid host_access_enum values are ill-formed#21445
sarnex merged 1 commit into
intel:syclfrom
Maetveis:host_access_invalid_values_are_illformed

Conversation

@Maetveis

@Maetveis Maetveis commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Currently code like this is accepted by DPC++:

device_global<int, decltype(host_access_key::value_t<static_cast<host_access_enum>(42)>)> var;

and results in the generated SPIR-V with a HostAccess property set to 42, which is not a valid value.

In another change I'm looking to make this an error in some but not all, cases, but nothing in the spec currently prohibits this code in my reading.
Add a sentence to make it ill-formed, no diagnostic required. We could make it a required hard error, but that is surprisingly difficult to implement for little benefit: in practice I don't expect any users to be actually doing this.

Currently code like this is accepted by DPC++:
```cpp
device_global<int, decltype(host_access_key::value_t<static_cast<host_access_enum>(42)>)> var;
```
and results in the generated SPIR-V with a `HostAccess` property set to 42,
which is not a valid value.

In another change I'm looking to make this an error in some *but not
all* cases, but nothing in the spec currently prohibits this code in
my reading.
Add a sentence to make it ill-formed, no diagnostic required.
We could make it a required hard error, but that is surprisingly difficult
to implement for little benefit: in practice I don't expect any
users to be doing this.
@Maetveis
Maetveis requested a review from a team as a code owner March 4, 2026 15:22
@Maetveis
Maetveis requested review from YuriPlyakhin and sarnex March 4, 2026 15:22

@sarnex sarnex left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm from doc pov, will leave to spec reivewers for correctness

@YuriPlyakhin YuriPlyakhin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions

github-actions Bot commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

@intel/llvm-gatekeepers please consider merging

@sarnex
sarnex merged commit a9bc54a into intel:sycl Mar 4, 2026
4 checks passed
@Maetveis
Maetveis deleted the host_access_invalid_values_are_illformed branch March 5, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants