Skip to content

Can we drop target triple environment component -sycldevice? #3534

Closed
@bader

Description

@bader

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
  • We have two passes added in llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp to process GlobalOffset and Local accessors. These are added to the pipeline only if module has sycldevice environment component. @Naghasan, would be safe to enable them by default?
  • NVPTX target configures TLSSupported for SYCL. We should be able to overload adjust member function and uses language option for configuration. Done by [SYCL][NVPTX][NFC] Refactor NVPTX target configuration #3535.
  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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestupstreamThis change is related to upstreaming SYCL support to llorg.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions