Visible to Intel only — GUID: GUID-4688EB25-1193-4B0C-88BE-16C51BD13998
Visible to Intel only — GUID: GUID-4688EB25-1193-4B0C-88BE-16C51BD13998
DPCT1056
Message
The use of <variable name> in device code was not detected. If this variable is also used in device code, you need to rewrite the code.
Detailed Help
If __constant__ variable is only used in host code, “__constant__” attribute will be removed.
Suggestions to Fix
For example, this original CUDA* code:
#include <stdio.h>
#include <cuda_runtime.h>
static __constant__ const float const_a = 10.f;
void foo_host() {
printf("%f\n", const_a);
}
is migrated using the following migration command:
dpct --out-root out test.h --extra-arg=-xc
which results in the following migrated SYCL* code:
/*
DPCT1056:0: The use of const_a in device code was not detected. If this variable is
also used in device code, you need to rewrite the code.
*/
static const float const_a = 10.f;
void foo_host() {
printf("%f\n", const_a);
}
If the variable “const_a” is only used in host code, just ignore the DPCT1056 warning. For example:
static const float const_a = 10.f;
void foo_host() {
printf("%f\n", const_a);
}
If the variable “const_a” is used in both host and device code, rewrite the migrated code. For example:
static const float const_a_host_ct1 = 10.f;
static dpct::constant_memory<const float, 0> const_a(10.f);
void foo_host() {
printf("%f\n", const_a_host_ct1);
}