[SYCL] [Driver] Add offload-arch support for SYCL offloading
Implement --offload-arch option to enable SYCL offloading to Intel CPUs, Intel GPUs, NVidia and AMD GPUs.
--offload-arch implementation is currently supported in the new driver model ( i.e. with --offload-new-driver option)
Example usage:
clang++ --offload-new-driver -fsycl --offload-arch=bdw // Offload SYCL code to Intel GPU
clang++ --offload-new-driver -fsycl --offload-arch=broadwell // Offload SYCL code to Intel CPU
clang++ --offload-new-driver -fsycl --offload-arch=sm_80 // Offload SYCL code to NVidia GPU
clang++ --offload-new-driver -fsycl --offload-arch=gfx700 // Offload SYCL code to AMD GPU
Overall, despite not being a pinged reviewer, I wanted to say I like the direction of these changes. I am aware this is still a
Draftbut is there a plan to address the--offload-archwith no-fsycl-targetscase inhttps://github.com/intel/llvm/blob/35b926a88318efc9599441c3084e4d9c722dc1d7/clang/lib/Driver/Driver.cpp#L6397
either as part of this PR or a follow-up? I am asking this because the effect of these changes will also require extra handling in
OffloadingActionBuilder::SYCLActionBuilder::initialize(). Thanks.
Hello,
AFAIK, OffloadingActionBuilder::SYCLActionBuilder::initialize() is the path taken when we do not pass --offload-new-driver option.
Currently, --offloard-arch option is supported only in the new driver model ( i.e with --offload-new-driver option passed)
Hence the --offload-arch implementation is not handled in OffloadingActionBuilder::SYCLActionBuilder::initialize()
Hello, AFAIK,
OffloadingActionBuilder::SYCLActionBuilder::initialize()is the path taken when we do not pass--offload-new-driveroption. Currently,--offloard-archoption is supported only in the new driver model ( i.e with--offload-new-driveroption passed) Hence the--offload-archimplementation is not handled inOffloadingActionBuilder::SYCLActionBuilder::initialize()
I see, I must've missed the chain of changes wrt the new offload driver for SYCL.
I only pointed the above, likely due to confusion, because for me clang++ -fsycl --offload-new-driver --offload-arch=sm_75 test.cpp still hits OffloadingActionBuilder::SYCLActionBuilder::initialize() but does nothing really as it returns early as no SYCL Toolchain has been found as of yet. Since the implementation for --offload-arch with the new offload driver logic is handled elsewhere, I guess that's okay then. Thanks for explaining :)!
Ping @intel/dpcpp-cfe-reviewers
@intel/llvm-gatekeepers Hello, this PR is ready to be merged. Thanks!