SYCLomatic icon indicating copy to clipboard operation
SYCLomatic copied to clipboard

Mistranslation of CUDA constant memory

Open tomatih opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe Syclomatic translates memory marked with __constant__ in CUDA as just a standard marked read only SYCL buffer/accessor. This means that the memory is allocated in global memory instead of constant memory, which means that it doesn't benefit from the constant cache.

Describe the solution you would like For syclomatic to translate memory marked with __constant__ into SYCL Specialization constants or some other means to access cuda constant memory cache instead of read only accessors.

Describe alternatives you have considered N/A

Additional context This can be seen in Intel's oneAPI-samples where one of the SYCL migration examples uses constant memory .

tomatih avatar Aug 03 '23 14:08 tomatih

@tomatih

  1. In SYCL side, there is no constant memory, "Constant memory no longer appears in the SYCL device memory model in SYCL 2020." in https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html
  2. SYCL Specialization constants is a compiler constant, will be literal when compiling kernel. For example, in a loop block each time we call a kernel, before call, the constant variable value can be changed. while for SYCL Specialization constants, each time the value change will result in kernel function re-compiled.

tomflinda avatar Aug 04 '23 02:08 tomflinda

cc @AerialMantis

JackAKirk avatar Aug 04 '23 10:08 JackAKirk

The issue was raised a while ago:

https://github.com/intel/llvm/issues/5827

jinz2014 avatar Aug 27 '23 21:08 jinz2014

@jinz2014 There is no further action needed in SYCLomatic, so I close this issue.

tomflinda avatar Jun 05 '24 02:06 tomflinda