DPCT1112#

Message#

If the filter mode is set to linear, the behavior of image “read” may be different from tex1Dfetch in the original code. You may need to adjust the code.

Detailed Help#

The CUDA* tex1Dfetch function always applies the nearest filtering mode. In the migrated code, the image read function applies the filtering mode that is set for the texture object. There may be a different result on the image read, so you may need to align the filter mode on image read.

Suggestions to Fix#

For example, this original CUDA code:

1  cudaTextureDesc desc;
2  desc.filterMode = cudaFilterModeLinear;
3  ...
4  cudaTextureObject_t obj;
5  cudaCreateTextureObject(&obj, ..., &desc, ...);
6  ...
7  tex1Dfetch(..., obj, ...);

results in the following migrated SYCL* code:

 1  dpct::sampling_info desc;
 2  desc.set(sycl::filtering_mode::linear);
 3  ...
 4  dpct::image_wrapper_base_p obj;
 5  obj = dpct::create_image_wrapper(..., desc);
 6  ...
 7  /*
 8  DPCT1112:0: If the filter mode is set to 'linear', the behavior of image
 9  "read" may be different from "tex1Dfetch" in the original code. You may need
10  to adjust the code.
11  */
12  obj.read(...);

which is rewritten to:

1  dpct::sampling_info desc;
2  desc.set(sycl::filtering_mode::nearest);  // Update the filtering mode from linear to nearest
3  ...
4  dpct::image_wrapper_base_p obj;
5  obj = dpct::create_image_wrapper(..., desc);
6  ...