DPCT1084

メッセージ

関数呼び出しには、統一できなかった異なるテンプレート・インスタンスの複数の移行結果があります。コードを調整する必要があります。

説明

インテル® DPC++ 互換性ツールは、コードを正しく移行できませんでした。コードを手動で変更してください。

以下の例では、オリジナルコード、移行したコード、移行したコードを修正するために行った手動の変更を示します。

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// original code:

__constant__ int4 example_i[32];
__constant__ float4 example_f[32];

struct example_int {
  __device__ int4 foo(int idx) const {
    return example_i[idx];
  }
};

struct example_float {
  __device__ float4 foo(int idx) const {
    return example_f[idx];
  }
};

template <typename T>
_global_ void example_kernel() {
  ...
  T example_v;
  float j = example_v.foo(idx).x;
}

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// migrated DPC++ code:

dpct::constant_memory<sycl::int4, 1> example_i(32);
dpct::constant_memory<sycl::float4, 1> example_f(32);

struct example_int {
  sycl::int4 foo()(int idx, sycl::int4 *example_i) const {
    return example_i[idx];
  }
};

struct example_float {
  sycl::float4 foo()(int idx, sycl::float4 *example_i) const {
    return example_i[idx];
  }
};

template <typename T>
void example_kernel(sycl::nd_item<3> item_ct1, sycl::float4 *example_f) {
  ...
  T example_v;
  /* DPCT1083 */
  float j = example_v.foo(idx, example_f).x();
}

このコードを以下のように手動で調整します。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// adjusted DPC++ code:

dpct::constant_memory<sycl::int4, 1> example_i(32);
dpct::constant_memory<sycl::float4, 1> example_f(32);

struct example_int {
  typedef sycl::int4 data_type;
  sycl::int4 foo()(int idx, sycl::int4 *example_i) const {
    return example_i[idx];
  }
};

struct example_float {
  typedef sycl::float4 data_type;
  sycl::float4 foo()(int idx, sycl::float4 *example_i) const {
    return example_i[idx];
  }
};

template <typename T>
void example_kernel(sycl::nd_item<3> item_ct1, typename T::data_type  *example_f) {
  ...
  T example_v;
  /* DPCT1083 */
  float j = example_v.foo(idx, example_f).x();
}

修正方法の提案

コードを手動で調整する必要があります。