DPCT1132#

Message#

SYCL 2020 does not support accessing the <property name> for the kernel. The API is replaced with member variable “<variable name>”. Please set the appropriate value for “<variable name>”.

Detailed Help#

There is limited support for querying the kernel attribute such as shared memory or number of registers used by a kernel in SYCL* 2020. The tool migrates the following attributes to member variables of a class defined in the DPCT namespace helper function, in order to ensure the compilability of migrated code.

  • Shared-memory size per-block required by the kernel

  • Local memory size used by each thread in the kernel

  • Constant memory size required by the kernel

  • Number of registers used by each thread in the kernel

It is recommend to use an appropriate value to replace the member variable access, provided it is statically available. Otherwise, consider removing the code along with the part that depends on it.

Suggestions to Fix#

For example, this original CUDA* code:

 1void foo(CUfunction f) {
 2  int smsize;
 3  int lcsize;
 4  int cnsize;
 5  int nreg;
 6
 7  cuFuncGetAttribute(&smsize, CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES, f);
 8
 9  cuFuncGetAttribute(&lcsize, CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES, f);
10
11  cuFuncGetAttribute(&cnsize, CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES, f);
12
13  cuFuncGetAttribute(&nreg, CU_FUNC_ATTRIBUTE_NUM_REGS, f);
14}

results in the following migrated SYCL code:

 1void foo(dpct::kernel_function f) {
 2  int smsize;
 3  int lcsize;
 4  int cnsize;
 5  int nreg;
 6  /*
 7  DPCT1132:0: SYCL 2020 does not support accessing the statically allocated
 8  shared memory for the kernel. The API is replaced with member variable
 9  "shared_size_bytes". Please set the appropriate value for "shared_size_bytes".
10  */
11  smsize = dpct::get_kernel_function_info(f)
12               .shared_size_bytes /* statically allocated shared memory per
13                                     work-group in bytes */
14      ;
15
16  /*
17  DPCT1132:1: SYCL 2020 does not support accessing the local memory for the
18  kernel. The API is replaced with member variable "local_size_bytes". Please
19  set the appropriate value for "local_size_bytes".
20  */
21  lcsize = dpct::get_kernel_function_info(f)
22               .local_size_bytes /* local memory per work-item in bytes */;
23
24  /*
25  DPCT1132:2: SYCL 2020 does not support accessing the memory size of
26  user-defined constants for the kernel. The API is replaced with member
27  variable "const_size_bytes". Please set the appropriate value for
28  "const_size_bytes".
29  */
30  cnsize =
31      dpct::get_kernel_function_info(f)
32          .const_size_bytes /* user-defined constant kernel memory in bytes */;
33
34  /*
35  DPCT1132:3: SYCL 2020 does not support accessing the required number of
36  registers for the kernel. The API is replaced with member variable
37  "num_regs". Please set the appropriate value for "num_regs".
38  */
39  nreg = dpct::get_kernel_function_info(f)
40             .num_regs /* number of registers for each thread */;
41}

which is rewritten to:

 1void foo(dpct::kernel_function f) {
 2  int smsize;
 3  int lcsize;
 4  int cnsize;
 5  int nreg;
 6
 7  smsize = 1024 /* statically allocated shared memory per-group in bytes according
 8  to kernel function f */;
 9
10  lcsize = 1024 /* local memory per work-item in bytes according to kernel function
11  f */;
12
13  cnsize = 1024 /* user-defined constant kernel memory in bytes according to kernel
14  function f */;
15
16  nreg = 4 /* number of registers for each thread according to kernel function f */;
17}