DPCT1042

メッセージ

SYCL* カーネルに渡される引数のサイズが、カスタムではない SYCL* デバイスの最小サイズ制限 (1024) を超えています。ハードウェア引数のサイズの上限は、info::device::max_parameter_size で照会できます。引数のサイズがハードウェアの制限を超える場合、このコードを書き換える必要があります。

説明

カスタムでない SYCL* デバイスの SYCL* カーネルに渡される引数のサイズには制限があります (SYCL* 1.2.1 仕様の「4.6.4.2 デバイス情報記述子」を参照)。

この警告が出力された場合は、SYCL* カーネルのラムダでキャプチャーされるアクセサーやその他の引数の数を減らすように、コードを手動で調整する必要があります。

以下の例では、同じ型の 2 つのバッファーをマージすることで、1 つのアクセサーを削除しています。

以下に例を示します。この例では、SYCL* カーネルのラムダでキャプチャーされる引数がサイズ制限を超えています。

1...// device0 から device30 の宣言 
2 dpct::constant_memory<int, 1> device31(ARRAY_SIZE); 3 dpct::constant_memory<int, 1> device32(ARRAY_SIZE); 
4 
5 // カーネル関数の宣言 
6 void kernel(sycl::nd_item<3> item_ct1, int *device0, ..., int *device32); 
7 
8 void test_function() { 9 ... // device0 から device30 の memcpy 操作 
10 dpct::dpct_memcpy(device31.get_ptr(), host, ARRAY_SIZE * sizeof(int)); 
11 dpct::dpct_memcpy(device32.get_ptr(), host, ARRAY_SIZE * sizeof(int)); 
12 { 
13 dpct::get_default_queue().submit([&](sycl::handler &cgh) { 
14 ... // device0 から device30 のアクセサー、SYCL* カーネルのラムダで取得 
15 auto device31_acc_ct1 = device31.get_access(cgh); 
16 auto device32_acc_ct1 = device32.get_access(cgh); 
17 cgh.parallel_for(sycl::nd_range<3>(sycl::range<3>(1), sycl::range<3>(1)), 
18 [=](sycl::nd_item<3> item_ct1) { 
19 kernel(item_ct1, ... /* device0 から device30 の引数 */ 
20 device31_acc_ct1.get_pointer(), 
21 device32_acc_ct1.get_pointer()); 
22 }); 
23 }); 
24 } 
25 }

次のようにコードを更新することで、同じ型の 2 つのバッファー (device31 と device32) を 1 つ (device31) に統合し、アクセサー数を 1 つ減らします。

1 ... // device0 から device30 の宣言 
2 dpct::constant_memory<int, 1> device32(ARRAY_SIZE + ARRAY_SIZE); // 2つではなく 1 つのバッファー 
3 
4 // カーネル関数の宣言 
5 void kernel(sycl::nd_item<3> item_ct1, int *device0, ..., int *device32); 
6 
7 void test_function() { 8 ... // device0 から device30 の memcpy 操作 
9 dpct::dpct_memcpy(device31.get_ptr(), host, ARRAY_SIZE * sizeof(int)); 
10 // オフセットでメモリーコピー: 11 dpct::dpct_memcpy(device31.get_ptr() + ARRAY_SIZE, host, 
12 ARRAY_SIZE * sizeof(int)); 
13 { 
14 dpct::get_default_queue().submit([&](sycl::handler &cgh) { 
15 ... // device0 から device30 のアクセサー、SYCL* カーネルのラムダで取得 
16 auto device31_acc_ct1 = 
17 device31.get_access(cgh); // 2つではなく 1 つのアクセサー 
18 cgh.parallel_for(sycl::nd_range<3>(sycl::range<3>(1), sycl::range<3>(1)), 
19 [=](sycl::nd_item<3> item_ct1) { 
20 // 最後のパラメーターは、オフセットと前のパラメーター 
21 // と同じアクセサーを使用するように変更されています 
22 kernel(item_ct1, ... /* device0 から device30 の引数*/ 
23 device31_acc_ct1.get_pointer(), 
24 device31_acc_ct1.get_pointer() + ARRAY_SIZE); 
25 }); 
26 }); 
27 } 
28 }

修正方法の提案

コードを確認して、調整してください。