DPCT1127#
Message#
The constant compile-time initialization for device_global is supported when compiling with C++20. You may need to adjust the compile commands.
Detailed Help#
The device_global extension introduces device scoped memory allocations into SYCL* that can be accessed within a kernel, using syntax similar to C++ global variables. Constant compile-time initialization for device_global is supported when compiling with C++20. Ref: intel/llvm.
Suggestions to Fix#
For example, this original CUDA* code:
1// test.cu
2__constant__ int var = 0;
3__global__ void kernel(int* ptr) {
4 *ptr = var;
5}
results in the following migrated SYCL code:
1// test.dp.cpp
2/*
3DPCT1127:0: The constant compile-time initialization for device_global is
4supported when compiling with C++20. You may need to adjust the compile
5commands.
6*/
7static sycl::ext::oneapi::experimental::device_global<const int> var{0};
8void kernel(int* ptr) {
9 *ptr = var.get();
10}
The compile commands need to be rewritten to:
1icpx -fsycl -std=c++20 test.dp.cpp # Linux
2icx-cl -fsycl -Qstd=c++20 test.dp.cpp # Windows