[PATCH] D132248: [CUDA][OpenMP] Fix the new driver crashing on multiple device-only outputs

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 19 10:43:45 PDT 2022


tra added a comment.

> The old driver would put all the outputs in the final action list akin to a linker job.

IIRC that's where HIP and CUDA behaved differently. CUDA compilation does not allow device-only compilation for multiple targets if we have explicitly specified output. It does produce individual per-gpu .o files if compiled without `-o`.

  bin/clang++ --cuda-path=$HOME/local/cuda-11.7 --offload-arch=sm_80 --offload-arch=sm_86 -x cuda axpy.cu  --cuda-device-only -O3  -c -o axpy.o
  clang-15: error: cannot specify -o when generating multiple output files





================
Comment at: clang/test/Driver/cuda-bindings.cu:160
+// MULTI-D-ONLY-NEXT: # "nvptx64-nvidia-cuda" - "clang", inputs: ["[[INPUT]]"], output: "[[PTX_52:.+]]"
+// MULTI-D-ONLY-NEXT: # "nvptx64-nvidia-cuda" - "NVPTX::Assembler", inputs: ["[[PTX_52]]"], output: "[[CUBIN_52:.+]]"
----------------
If we've specified `-o foo.o`, where do those multiple outputs go to?

The old driver disallowed using `-o` when compiling for multiple GPUs.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132248/new/

https://reviews.llvm.org/D132248



More information about the cfe-commits mailing list