Skip to content

Conversation

@rupprecht
Copy link
Collaborator

LLVM has two tablegen generators: one in llvm/tblgen.bzl (gentbl, macro-based) and one in mlir/tblgen.bzl (gentbl_cc_library, rule-based). The gentbl_cc_library generator in MLIR has some advantages to being a rule, and at any rate, it seems better to just use the same tablegen rule everywhere instead of competing implementations.

LLVM has two tablegen generators: one in llvm/tblgen.bzl (`gentbl`, macro-based)
and one in mlir/tblgen.bzl (`gentbl_cc_library`, rule-based). The
`gentbl_cc_library` generator in MLIR has some advantages to being a rule, and
at any rate, it seems better to just use the same tablegen rule everywhere
instead of competing implementations.
@rupprecht rupprecht requested a review from keith as a code owner January 29, 2025 22:26
@llvmbot llvmbot added the bazel "Peripheral" support tier build system: utils/bazel label Jan 29, 2025
Copy link
Member

@aaronmondal aaronmondal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably aim to remove the tblgen macro entirely at some point (in favor of a tblgen_toolchain + rules) and this moves us towards that 👍

rupprecht added a commit to rupprecht/Enzyme that referenced this pull request Jan 30, 2025
Enzyme uses tablegen generators from both llvm/tblgen.bzl and mlir/tblgen.bzl.
This consolidates usage so that we only use one of them (from MLIR).
Later we may delete the llvm/tblgen.bzl entirely.

This is mostly mechanical, but as a side effect, we need to adjust `includes`
to pick up `bundled_includes.h`. It was probably relying on an `includes`
config from the llvm/tblgen.bzl implementation that is no longer being provided.

See also llvm/llvm-project#124996.
@rupprecht rupprecht merged commit a643e44 into llvm:main Jan 30, 2025
8 checks passed
pashu123 pushed a commit to iree-org/llvm-project that referenced this pull request Feb 1, 2025
LLVM has two tablegen generators: one in llvm/tblgen.bzl (`gentbl`,
macro-based) and one in mlir/tblgen.bzl (`gentbl_cc_library`,
rule-based). The `gentbl_cc_library` generator in MLIR has some
advantages to being a rule, and at any rate, it seems better to just use
the same tablegen rule everywhere instead of competing implementations.
pashu123 pushed a commit to iree-org/llvm-project that referenced this pull request Feb 4, 2025
LLVM has two tablegen generators: one in llvm/tblgen.bzl (`gentbl`,
macro-based) and one in mlir/tblgen.bzl (`gentbl_cc_library`,
rule-based). The `gentbl_cc_library` generator in MLIR has some
advantages to being a rule, and at any rate, it seems better to just use
the same tablegen rule everywhere instead of competing implementations.
pashu123 pushed a commit to iree-org/llvm-project that referenced this pull request Feb 4, 2025
LLVM has two tablegen generators: one in llvm/tblgen.bzl (`gentbl`,
macro-based) and one in mlir/tblgen.bzl (`gentbl_cc_library`,
rule-based). The `gentbl_cc_library` generator in MLIR has some
advantages to being a rule, and at any rate, it seems better to just use
the same tablegen rule everywhere instead of competing implementations.
wsmoses pushed a commit to rupprecht/Enzyme that referenced this pull request Feb 6, 2025
Enzyme uses tablegen generators from both llvm/tblgen.bzl and mlir/tblgen.bzl.
This consolidates usage so that we only use one of them (from MLIR).
Later we may delete the llvm/tblgen.bzl entirely.

This is mostly mechanical, but as a side effect, we need to adjust `includes`
to pick up `bundled_includes.h`. It was probably relying on an `includes`
config from the llvm/tblgen.bzl implementation that is no longer being provided.

See also llvm/llvm-project#124996.
wsmoses pushed a commit to EnzymeAD/Enzyme that referenced this pull request Feb 6, 2025
* [bazel] Fully replace gentbl with gentbl_cc_library

Enzyme uses tablegen generators from both llvm/tblgen.bzl and mlir/tblgen.bzl.
This consolidates usage so that we only use one of them (from MLIR).
Later we may delete the llvm/tblgen.bzl entirely.

This is mostly mechanical, but as a side effect, we need to adjust `includes`
to pick up `bundled_includes.h`. It was probably relying on an `includes`
config from the llvm/tblgen.bzl implementation that is no longer being provided.

See also llvm/llvm-project#124996.

* Write generated files to subdirectories (matching where cmake puts them) and use strip_include_prefix to mirror how they're referenced. Avoids needing to use `includes = ["."]` which is overly broad, and leads to a build failure.
Mittagskogel pushed a commit to Mittagskogel/Enzyme that referenced this pull request Feb 14, 2025
* [bazel] Fully replace gentbl with gentbl_cc_library

Enzyme uses tablegen generators from both llvm/tblgen.bzl and mlir/tblgen.bzl.
This consolidates usage so that we only use one of them (from MLIR).
Later we may delete the llvm/tblgen.bzl entirely.

This is mostly mechanical, but as a side effect, we need to adjust `includes`
to pick up `bundled_includes.h`. It was probably relying on an `includes`
config from the llvm/tblgen.bzl implementation that is no longer being provided.

See also llvm/llvm-project#124996.

* Write generated files to subdirectories (matching where cmake puts them) and use strip_include_prefix to mirror how they're referenced. Avoids needing to use `includes = ["."]` which is overly broad, and leads to a build failure.
@rupprecht rupprecht deleted the bzl-tblgen branch August 14, 2025 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants