DPCT1010

メッセージ

SYCL* はエラーの報告に例外を使用するため、エラーコードは使用していません。呼び出しは 0 に置き換えられます。このコードを書き換える必要があります。

説明

SYCL* では、エラーの報告に例外を使用しており、エラーコードは使用していません。元のコードでは、エラーコードを取得しようとしていますが、SYCL* ではそのような機能は必要ありません。呼び出しは 0 に置き換えられます。

修正方法の提案

コードを修正する必要があります。

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


1__global__ void kernel() { 
2   ...
3} 
4 
5void foo() { 
6 kernel<<<1, 1>>>(); 
7 cudaDeviceSynchronize(); 
8 cudaError_t err = cudaGetLastError(); 
9 printf("%d\n", err); 
10}

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


1void kernel() { 
2    ... 
3} 
4 
5void foo() { 
6 dpct::get_default_queue().parallel_for( 
7 sycl::nd_range<3>(sycl::range<3>(1, 1, 1), sycl::range<3>(1, 1, 1)), 
8 [=](sycl::nd_item<3> item_ct1) { 
9 kernel(); 
10 }); 
11 dpct::get_current_device().queues_wait_and_throw(); 
12 /* 
13 DPCT1010:0: SYCL uses exceptions to report errors and does not use the error 
14 codes.The call was replaced with 0.You need to rewrite this code.
15 */ 
16 int err = 0; 
17 printf("%d\n", err); 
18}

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


1void kernel() { 
2    ... 
3} 
4 
5void foo() { 
6 try { 
7 dpct::get_default_queue().parallel_for( 
8 sycl::nd_range<3>(sycl::range<3>(1, 1, 1), sycl::range<3>(1, 1, 1)), 
9 [=](sycl::nd_item<3> item_ct1) { 
10 kernel(); 
11 }); 
12 dpct::get_current_device().queues_wait_and_throw(); 
13 } catch (sycl::exception const &e) { 
14 std::cerr << e.what() << std::endl; 
15 } 
16}