KhronosGroup / KhronosGroup/SYCL-Docs

Inconsistency since `marray` is `constexpr` while `half` is not

Open
#438 2 comments 1 reaction 0 assignees View on GitHub
clarification
Dominant language
JavaScript
Stars
158
Forks
80
Avg merge
7d 6h
Merged PRs (30d)
5

Description

According to the spec, the constructors of `marray` should be `constexpr`. Also, `marray` should accept `sycl::half` as element type (see 4.14.3 where it says "The element type parameter, DataT, must be a numeric type as it is defined by C++ standard."; `sycl::half` is a numeric type).

Hence, the following should compile
```
constexpr sycl::marray m{sycl::half{1}};
```
However, the spec does not require `half` to be constexpr-constructible and in C++17 this is basically impossible to achieve without using builtins that allow compile time bitcasts.

How should implementations handle this? Should there be a non-constexpr `marray` overload for `DataT == sycl::half`?

Contributor guide

No contributing guide indexed for this repository

Research direction

Review SYCL specification section 4.14.3 and the requirements for constexpr marray constructors, then compare them with the stated constraints on sycl::half in C++17. The issue is done when the specification clearly resolves whether marray must support constexpr construction with sycl::half or defines an alternative requirement.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.