Skip to content

Commit

Permalink
[SYCL][CUDA] Use __nvvm_reflect_ocl instead of LLVM IR workaround (in…
Browse files Browse the repository at this point in the history
…tel#9250)

We needed an IR workaround in order to use `__nvvm_reflect` in OpenCL.
This is because passing a string in OpenCL to `__nvvm_reflect` requires
the extern declaration of `__nvvm_reflect` like so:

`int __nvvm_reflect(__constant char *)` 

Since strings in OpenCL are in the `__constant` address space. This then
clashes with use of `__nvvm_reflect` within CUDA's libdevice which uses
the generic address space to pass in the string.

Therefore a new func name was needed to allow nvvm reflect capabilities,
but while using a ptr input in different address space. This change was
made upstream see
intel@ce43e2f
and has been available in DPC++ since the pulldown.

Therefore in OpenCL we can now use `__nvvm_reflect_ocl` without worrying
about how it will clash with nvvm libdevice's use of `__nvvm_reflect`.
Removing the need for the IR workaround in `reflect.ll`

I have also changed the `.gitignore` just since it is a small
uncontroversial change so we can do in-tree tests in a local build dir
of `sycl-e2e`
  • Loading branch information
hdelan authored Sep 12, 2023
1 parent fb127bc commit 936bfff
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
2 changes: 1 addition & 1 deletion libclc/ptx-nvidiacl/libspirv/SOURCES
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
reflect.ll
reflect.cl
atomic/loadstore_helpers_release.ll
atomic/loadstore_helpers_acquire.ll
atomic/loadstore_helpers_seq_cst.ll
Expand Down
5 changes: 5 additions & 0 deletions libclc/ptx-nvidiacl/libspirv/reflect.cl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extern int __nvvm_reflect_ocl(constant char *);

int __clc_nvvm_reflect_arch() { return __nvvm_reflect_ocl("__CUDA_ARCH"); }

int __clc_nvvm_reflect_ftz() { return __nvvm_reflect_ocl("__CUDA_FTZ"); }
15 changes: 0 additions & 15 deletions libclc/ptx-nvidiacl/libspirv/reflect.ll

This file was deleted.

0 comments on commit 936bfff

Please sign in to comment.