Resolve cuda_toolkit in exec config#482
Merged
Merged
Conversation
`cuda_toolchain.compiler_files` is gathered with `cfg = "exec"`, so the files materialized as inputs to CudaCompile actions live under `bazel-out/<exec>/bin/`. The clang toolchain config, however, derives `--cuda-path=` from `ctx.attr.cuda_toolkit[CudaToolkitInfo].libdevice` without specifying a config, so it picks up the target-config File object whose `dirname` points at `bazel-out/<target>/bin/`. When the CTK files are generated (e.g. a synthetic CUDA root that drops in wrappers next to real headers), the flag and the materialized inputs land at different paths and clang fails with "cannot find CUDA installation". Match the toolchain's exec-config view of the CTK in the toolchain config rule so the rendered `--cuda-path` lines up with the inputs in the sandbox. Source-file CTKs are unaffected because source files are config-independent. Signed-off-by: Austin Schuh <austin.linux@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cuda_toolchain.compiler_filesis gathered withcfg = "exec", so the files materialized as inputs to CudaCompile actions live underbazel-out/<exec>/bin/. The clang toolchain config, however, derives--cuda-path=fromctx.attr.cuda_toolkit[CudaToolkitInfo].libdevicewithout specifying a config, so it picks up the target-config File object whosedirnamepoints atbazel-out/<target>/bin/. When the CTK files are generated (e.g. a synthetic CUDA root that drops in wrappers next to real headers), the flag and the materialized inputs land at different paths and clang fails with "cannot find CUDA installation".Match the toolchain's exec-config view of the CTK in the toolchain config rule so the rendered
--cuda-pathlines up with the inputs in the sandbox. Source-file CTKs are unaffected because source files are config-independent.