llvm icon indicating copy to clipboard operation
llvm copied to clipboard

SYCL Driver unable to support multiple outputs for a single triple

Open Alexander-Johnston opened this issue 6 years ago • 2 comments

SYCL driver is unable to accept multiple CUDA gpu architectures (sm_*) at once. Instead it only takes the final architecture given. It seems this is an inherent problem in the SYCL drivers design, probably inhereted from the OpenMP driver.

The current driver has some builtin assumption that there is a 1-1 mapping between device binary output, toolchain, and triple. This holds for SPI, but not for CUDA where triple and arch are managed separately, so one may correspond to serveral objects linked together, as demonstrated by the following example of compiling for CUDA:

./bin/clang foo.cu --cuda-gpu-arch=sm_35 --cuda-gpu-arch=sm_70 -ccc-print-phases -c
            +- 0: input, "foo.cu", cuda, (host-cuda)
         +- 1: preprocessor, {0}, cuda-cpp-output, (host-cuda)
      +- 2: compiler, {1}, ir, (host-cuda)
      |                 +- 3: input, "foo.cu", cuda, (device-cuda, sm_35)
      |              +- 4: preprocessor, {3}, cuda-cpp-output, (device-cuda, sm_35)
      |           +- 5: compiler, {4}, ir, (device-cuda, sm_35)
      |        +- 6: backend, {5}, assembler, (device-cuda, sm_35)
      |     +- 7: assembler, {6}, object, (device-cuda, sm_35)
      |  +- 8: offload, "device-cuda (nvptx64-nvidia-cuda:sm_35)" {7}, object
      |  |- 9: offload, "device-cuda (nvptx64-nvidia-cuda:sm_35)" {6}, assembler
      |  |              +- 10: input, "foo.cu", cuda, (device-cuda, sm_70)
      |  |           +- 11: preprocessor, {10}, cuda-cpp-output, (device-cuda, sm_70)
      |  |        +- 12: compiler, {11}, ir, (device-cuda, sm_70)
      |  |     +- 13: backend, {12}, assembler, (device-cuda, sm_70)
      |  |  +- 14: assembler, {13}, object, (device-cuda, sm_70)
      |  |- 15: offload, "device-cuda (nvptx64-nvidia-cuda:sm_70)" {14}, object
      |  |- 16: offload, "device-cuda (nvptx64-nvidia-cuda:sm_70)" {13}, assembler
      |- 17: linker, {8, 9, 15, 16}, cuda-fatbin, (device-cuda)
   +- 18: offload, "host-cuda (x86_64-unknown-linux-gnu)" {2}, "device-cuda (nvptx64-nvidia-cuda)" {17}, ir
+- 19: backend, {18}, assembler, (host-cuda)
20: assembler, {19}, object, (host-cuda)

We believe that some driver restructuring is required to remove this assumption and allow multiple outputs for a single triple. Is there any work to this end that Intel is currently doing or planning?

Alexander-Johnston avatar Mar 24 '20 10:03 Alexander-Johnston

@Alexander-Johnston,

Some work in this direction has been already done: intel/llvm#3471, for example, allows us to generate both LLVM IR and integration header by a single clang invocation. However, I'm not that familiar with driver so I'm not exactly sure that your problem was fixed by that PR. @mdtoguchi and @AGindinson should know better

AlexeySachkov avatar May 20 '21 15:05 AlexeySachkov

This is now available and I believe is in the 2023.1 release package.

rodburns avatar Jun 23 '23 10:06 rodburns