Skip to content

Align range with SYCL 2020 #22736

Description

@KornevNikita

Describe the bug

Many functions are missing the noexcept keyword:

size_t size() const
all operators, e.g. https://github.com/intel/llvm/blob/sycl/sycl/include/sycl/range.hpp#L74

Also, range inherits detail::array (https://github.com/intel/llvm/blob/sycl/sycl/include/sycl/detail/array.hpp), so the rest of functions are declared there. They're still missing `noexcept`:
size_t get(int dimension) const
size_t &operator[](int dimension)
size_t operator[](int dimension) const

This could break the ABI, so these functions should be modified in a such way:

#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
size_t size() const {
#else
size_t size() const noexcept {
#endif // __INTEL_PREVIEW_BREAKING_CHANGES

UPD. IIUC this doesn't break ABI.
Also, there are more functions that don't have noexcept, e.g. different operators. Need to compare our implementation with the spec and add noexcept to all required functions.

To reproduce

  1. Include a code snippet that is as short as possible
  2. Specify the command which should be used to compile the program
  3. Specify the command which should be used to launch the program
  4. Indicate what is wrong and what was expected

Environment

  • OS: [e.g Windows/Linux]
  • Target device and vendor: [e.g. Intel GPU]
  • DPC++ version: [e.g. commit hash or output of clang++ --version]
  • Dependencies version: [e.g. the output of sycl-ls --verbose]

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions