DPCT1089¶
メッセージ¶
サブグループ・サイズ属性引数 ‘%0’ の値は、インテル® DPC++ 互換性ツールで評価できません。"dpct_placeholder" を整数定数式に置き換えてください。
説明¶
属性の引数は整数定数式である必要があります。この警告は、インテル® DPC++ 互換性ツールがサブグループ・サイズの引数値を整数定数式として評価できない場合に出力されます。サブグループ・サイズ属性の引数を整数定数式に置き換えられるかどうかを確認し、置き換えられない場合は、コードロジックを再設計します。
例えば、以下のオリジナルコードについて考えてみます。
1 2 3 4 5 6 7 8 | // original code
_global_ void kernel(int WarpSize) { int Input, Output, Lane; ... Output = __shfl(Input, Lane, WarpSize); }
...
if(condition)
{ kernel<<<GirdSize, BlockSize>>>(16); }
else
{ kernel<<<GirdSize, BlockSize>>>(32); }
|
このコードは、以下の DPC++ コードに移行されます。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | // migrated DPC++ code
void kernel(int WarpSize, sycl::nd_item<3> item_ct1)
{ int Input, Output, Lane; ... Output = Item_ct1.get_sub_group().shuffle(Input, Lane); }
...
if(condition) {
/* DPCT1089 */
q_ct1.parallel_for(
sycl::nd_range<3>(GridSize * BlockSize, BlockSize),
[=](sycl::nd_item<3> item_ct1) [[intel::reqd_sub_group_size(dpct_placeholder)]] { kernel(16, item_ct1); });
} else {
/* DPCT1089 */
q_ct1.parallel_for(
sycl::nd_range<3>(GridSize * BlockSize, BlockSize),
[=](sycl::nd_item<3> item_ct1) [[intel::reqd_sub_group_size(dpct_placeholder)]] { kernel(32, item_ct1); }
|
このコードを以下のように手動で調整します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | // fixed DPC++ code
void kernel(int WarpSize, sycl::nd_item<3> item_ct1) { int Input, Output, Lane; ... Output = Item_ct1.get_sub_group().shuffle(Input, Lane); }
...
if(condition) {
/* DPCT1089 */
q_ct1.parallel_for(
sycl::nd_range<3>(GridSize * BlockSize, BlockSize),
[=](sycl::nd_item<3> item_ct1) [[intel::reqd_sub_group_size(16)]]
{ kernel(16, item_ct1); }
);
} else {
/* DPCT1089 */
q_ct1.parallel_for(
sycl::nd_range<3>(GridSize * BlockSize, BlockSize),
[=](sycl::nd_item<3> item_ct1) [[intel::reqd_sub_group_size(32)]]
{ kernel(32, item_ct1); }
|
修正方法の提案¶
コードを手動で修正する必要があります。「dpct_placeholder」を整数定数式に置き換えます。