DPCT1076#

Message#

The device attribute was not recognized. You may need to adjust the code.

Detailed Help#

This warning appears if the device attribute parameter in the original code is enum variable instead of enum constant and could not be deduced.

Suggestions to Fix#

Review the code and adjust it.

For example, this original CUDA* code:

 1void foo(bool condition, int *val) {
 2  cudaDeviceAttr attr;
 3  if (condition)
 4    attr = cudaDevAttrHostNativeAtomicSupported;
 5  else
 6    attr = cudaDevAttrComputeCapabilityMajor;
 7
 8  ...
 9
10  cudaDeviceGetAttribute(val, attr, 0);
11}

results in the following migrated SYCL code:

 1void foo(bool condition, int *val) {
 2  int attr;
 3  if (condition)
 4    attr = 86;
 5  else
 6    attr = 75;
 7
 8  ...
 9
10  /*
11  DPCT1076:1: The device attribute was not recognized. You may need to adjust
12  the code.
13  */
14  cudaDeviceGetAttribute(val, attr, 0);
15}

which is rewritten to:

1void foo(bool condition, int *val) {
2  ...
3
4  if (condition)
5    *val = dpct::dev_mgr::instance().get_device(0).is_native_atomic_supported();
6  else
7    *val = dpct::dev_mgr::instance().get_device(0).get_major_version();
8}

Visit the Migrating to SYCL forum for additional help.