DPCT1132#

メッセージ#

SYCL* 2020 はカーネルの <property name> へのアクセスをサポートしていません。API はメンバー変数 “<variable name>” に置き換えられます。“<variable name>” に適切な値を設定してください。

詳細な説明#

SYCL* 2020 では、共有メモリーやカーネルで使用されるレジスター数などのカーネル属性の照会に対するサポートが制限されています。このツールは、移行されたコードのコンパイルの可能性を確保するため、DPCT 名前空間ヘルパー関数で定義されたクラスのメンバー変数に次の属性を移行します。

  • カーネルに必要なブロックあたりの共有メモリーサイズ

  • カーネルの各スレッドで使用されたローカル・メモリー・サイズ

  • カーネルに必要な一定のメモリーサイズ

  • カーネル内の各スレッドが使用するレジスター数

静的に使用可能である場合、メンバー変数アクセスを置き換えるため適切な値を使用することをお勧めします。それ以外では、コードとそれに依存する部分を削除することを検討してください。

修正方法の提案#

例えば、以下のオリジナル CUDA* コードについて考えてみます。

1  void 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 }

このコードは、以下の SYCL* コードに移行されます。


1  void 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 /* ワークグループごとに静的に割り当てられた 
13  共有メモリー (バイト単位)  */ 
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 /* ワーク項目あたりのローカルメモリー (バイト単位) */; 
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 /* ユーザー定義の定数カーネルメモリー (バイト単位) */; 
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 /* 各スレッドのレジスター数 */; 
41 }

このコードは次のように書き換えられます。

1  void foo(dpct::kernel_function f) { 
2   int smsize; 
3   int lcsize; 
4   int cnsize; 
5   int nreg; 
6 
7   smsize = 1024 /* カーネル関数 f に従ってグループごとに 
8   バイト単位で静的に割り当てられた共有メモリー */; 
9 
10  lcsize = 1024 /* カーネル関数 f に応じたバイト単位の 
11  ワーク項目あたりのローカルメモリー */; 
12 
13  cnsize = 1024 /* カーネル関数 f に応じたバイト単位の 
14  ユーザー定義定数カーネルメモリー */; 
15 
16  nreg = 4 /* カーネル関数 f に応じた各スレッドのレジスター数*/; 
17 }