llvm icon indicating copy to clipboard operation
llvm copied to clipboard

[NewOffloadModel] Pass link-time options through device-compiler and device-linker argument for ClangLinkerWrapper

Open YixingZhang007 opened this issue 1 month ago • 1 comments

In another patch https://github.com/intel/llvm/pull/19579, compilation and linking options used in ClangLinkerWrapper are changed to be consumed from the SYCLImage, instead of sycl_backend_compile_options_EQ and sycl_target_link_options_EQ that are passed as argument to the ClangLinkerWrapper. Because option in SYCLImage are options passed at compiler-time, we want to support for link-time options by passing them through device-compiler and device-linker argument for ClangLinkerWrapper. The specific changes are listed below.

  1. Remove gpu_tool_arg_EQ and cpu_tool_arg_EQ options specification in LinkerWrapperOpts.td. We are now passing the link time backend compile option through OPT_device_compiler_args_EQ to ClangLinkerWrapper, as coded in Clang.cpp. We are also passing link time linker option through OPT_device_linker_args_EQ to ClangLinkerWrapper
  2. In ClangLinkerWrapper.cpp, the options in OPT_device_compiler_args_EQ and OPT_device_linker_args_EQ are added and handled together with other compiler and linker options passed through SYCLImage.
  3. Modify the tests that are associated with these changes, such as those that are checking the compiler backend option and linker option passed into ClangLinkerWrapper.

With this patch, the following SYCL E2E tests pass with the new offloading model:

  1. KernelAndProgram/kernel-bundle-merge-options-env.cpp
  2. KernelAndProgram/level-zero-link-flags.cpp
  3. ESIMD/private_memory/pm_access_1.cpp
  4. ESIMD/private_memory/pm_access_2.cpp
  5. ESIMD/private_memory/pm_access_3.cpp

YixingZhang007 avatar Nov 19 '25 18:11 YixingZhang007

5 SYCL E2E tests passed (test names are listed in the PR description, and 3 pm_access_n test were only failing in Self Build CI before), and no SYCL E2E test or driver test regression occurred when the new offloading model was enabled as default together with my changes (the CI before removing new offloading changes from this PR can be found at https://github.com/intel/llvm/actions/runs/19864471834/job/56923211306?pr=20691)

YixingZhang007 avatar Dec 02 '25 16:12 YixingZhang007