Skip to content

[Bazel] LLVM builds fail unless NVPTX backend is enabled in llvm_configure #63135

Open
@j2kun

Description

@j2kun

When I set up the build rules for a project (https://github.com/google/heir/tree/2054509f517a1b2abaaeff0e592f99d223f383a6), I decided I only wanted to compile the X86 backend in llvm_configure.

The result was a build error like this when building most targets.

ERROR: /home/j2kun/.cache/bazel/_bazel_j2kun/fc8ffaa09c93321753c7c87483153cea/external/llvm-project/mlir/test/BUILD.bazel:591:11: 
no such target '@llvm-project//llvm:NVPTXCodeGen': target 'NVPTXCodeGen' not declared in package 'llvm' defined by 
/home/j2kun/.cache/bazel/_bazel_j2kun/fc8ffaa09c93321753c7c87483153cea/external/llvm-project/llvm/BUILD.bazel 
(Tip: use `query "@llvm-project//llvm:*"` to see all the targets in that package) 
and referenced by '@llvm-project//mlir/test:TestGPU'

This can be reproduced by checking out the above repository at 2054509f517a1b2abaaeff0e592f99d223f383a6 and commenting out this line, and then running

bazel build @llvm-project//mlir/...:all

It seems like these GPU-related targets should be conditionally included when the relevant backend targets are present.

I asked about this on discord and got no response. Seems like a minor bug, and I understand bazel support is best effort, so for now the workaround is just to compile NVPTX as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bazel"Peripheral" support tier build system: utils/bazel

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions