KhronosGroup / KhronosGroup/SYCL-Docs
Clarification is needed about specialization constant types
- Dominant language
- JavaScript
- Stars
- 158
- Forks
- 80
- Avg merge
- 7d 6h
- Merged PRs (30d)
- 5
Description
According to [4.9.5.1. Declaring a specialization constant](https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#_declaring_a_specialization_constant) any `device_copyable` type is allowed to be set as specialization constant type:
> the template parameter T must be a device copyable type;
And that allows using pointers as specialization constants, however, at the same time [`OpSpecConstant`](https://www.khronos.org/registry/SPIR-V/specs/unified1/SPIRV.html#OpSpecConstant) only supports integers and floats:
> Declare a new integer-type or floating-point-type scalar specialization constant.
I guess that there is a workaround for SPIR-V based implementations to convert pointer to `int`, use `int` as specialization constant type and perform backwards conversion to a pointer in `get_specialization_constant`.
So, the question is: was it indented by the spec to allow pointers to be specialization constants or not? Note: corresponding [test plan](https://github.com/KhronosGroup/SYCL-CTS/blob/SYCL-2020/test_plans/spec-constants.asciidoc) doesn't cover pointers as specialization constant types.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.