You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
USM allocation functions aligned_alloc templated on allocation type T returns non-null when the alignment argument is not a power of 2 (source ), which conflicts with the SYCL2020 specification 4.8.3 USM allocations: Some of the allocation functions take an explicit alignment parameter. Like std::aligned_alloc, these functions return nullptr if the alignment is not supported by the implementation.
Specify the command which should be used to compile the program
compile: clang++ -fsycl -fsycl-targets=spir64 align.cpp -o align.cpp.tmp.out
run: env ONEAPI_DEVICE_SELECTOR=opencl:cpu align.cpp.tmp.out
Indicate what is wrong and what was expected
CI SYCL E2E test shows that the non-templated aligned_alloc_xxx cases return nullptr as expected, but the templated aligned_alloc_xxx<T> cases return non-null
Environment (please complete the following information):
OS: Linux
Target device and vendor: Intel CPU
DPC++ version: clang version 18.0.0
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
…12569)
Implementation is supposed to return `nullptr` when requested alignment is not supported. Since our runtime performs all allocations through Unified Runtime that means for us that any alignment which is not a power of two is unsupported.
Note that the resulting alignment may not be the same as requested one (per the SYCL 2020 specification) and therefore we can't just rely on return value of underlying non-templated version of the alloc function and have to perform the check explicitly.
There is an issue with some backends not properly returning error on an unsupported alignment, it wis reported in #11642
---------
Signed-off-by: Hu, Peisen <peisen.hu@intel.com>
Describe the bug
USM allocation functions
aligned_alloc
templated on allocation type T returns non-null when the alignment argument is not a power of 2 (source ), which conflicts with the SYCL2020 specification 4.8.3 USM allocations: Some of the allocation functions take an explicit alignment parameter. Like std::aligned_alloc, these functions return nullptr if the alignment is not supported by the implementation.To Reproduce
source code
https://github.com/intel/llvm/blob/e75f21902a944c2776c43082d3f01843426a9525/sycl/test-e2e/USM/align.cpp
This test checks that
aligned_alloc_xxx
andaligned_alloc_xxx<T>
return nullptr when the alignment argument is not a power of 2Specify the command which should be used to compile the program
compile:
clang++ -fsycl -fsycl-targets=spir64 align.cpp -o align.cpp.tmp.out
run:
env ONEAPI_DEVICE_SELECTOR=opencl:cpu align.cpp.tmp.out
Indicate what is wrong and what was expected
CI SYCL E2E test shows that the non-templated
aligned_alloc_xxx
cases return nullptr as expected, but the templatedaligned_alloc_xxx<T>
cases return non-nullEnvironment (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: