Can we drop target triple environment component -sycldevice? · Issue #3534 · intel/llvm (original) (raw)

One of the use cases for this target triple component is configuring SPIR target address space map.
During discussion in https://reviews.llvm.org/D89909 comments we decided to implement a different approach, which doesn't require adding environment component for SYCL.
I'd like to gather to all existing use cases for -sycldevice and check if it's really necessary.

Use cases:

  1. NVPTX
  1. llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp - deletes "dead" SPIR kernel parameters. This is safe to do only when host part of the application setting SPIR kernel arguments is adjusted. TODO: check if we can enable this optimization w/o target triple modifications (e.g. metadata?)
  2. libclc uses a hack using -sycldevice to work around for [SYCL][Driver] fsycl-device-only does not offload, target triple is used to define programing model #1814. TODO: check if we can remove the hack as [SYCL][Driver] fsycl-device-only does not offload, target triple is used to define programing model #1814 is fixed.
  3. Driver. There are a lot of places where -sycldevice component is checked and I hope we can replace all these checks with the language mode check i.e. if -fsycl-[device,host]-only mode is set. @mdtoguchi, can we do this?
  4. AllocateTarget in clang/lib/Basic/Targets.cpp uses environment triple and host OS component for OS specific configuration. TODO: check if this needed and if not, revert. Probably should should be handled w/o checking environment triple within SPIRTargetInfo methods.
  5. Back-ends. DPC++ uses SPIR-V for Intel devices, which doesn't preserve -sycldevice, but we need to check if it's the case for other targets as well (e.g. NVPTX, Xilinx, Intel FPGA, ???).
  6. Documentation and LIT tests. These can be easily updated.