Repository navigation
[LLVMCPU] strip per-function target attributes to allow inlining ukernels - #24833
Merged
Merged
Conversation
…ning The ukernel bitcode carries per-function target-cpu/tune-cpu/target-features attributes that conflict with the attribute-less dispatch (which inherits the module-level TargetMachine)and stop LLVM from inlining the ukernel. Strip them (and vscale_range, so RVV bitcode inlines) at link time. Co-Authored-By: Stefan Schuermans <[email protected]> Co-Authored-By: Federico Bruzzone <[email protected]> Signed-off-by: Ege Beysel <[email protected]>
egebeysel
requested review from
AGindinson,
FedericoBruzzone and
schuermans-roofline
August 21, 2026 16:15
AGindinson
reviewed
Aug 21, 2026
| for (auto &func : module.get()->functions()) { | ||
| func.addFnAttr(llvm::Attribute::AlwaysInline); | ||
| stripFunctionTargetAttrs(func); | ||
| func.removeFnAttr(llvm::Attribute::VScaleRange); |
Contributor
There was a problem hiding this comment.
This is known from RISC-V target properties too, right? Or unneeded whatsoever?
Contributor
Author
There was a problem hiding this comment.
yes, it's known, but it's unneeded on the ukernel here. the target properties will have a user-specified value in a future PR of mine, but they currently get the same default (unless the specific llvm flags are passed).
AGindinson
approved these changes
Aug 21, 2026
FedericoBruzzone
approved these changes
Aug 22, 2026
FedericoBruzzone
left a comment
Member
There was a problem hiding this comment.
Super clean, LGTM @egebeysel!
P.S. Thanks for co-authoring it with me too 🙏
devtbi
added a commit
to devtbi/iree
that referenced
this pull request
Nov 9, 2026
ukernel_inlining.mlir, added in iree-org#24833, compiles for aarch64 and riscv64, but byo_llvm.sh builds LLVM with only the X86 target. The test has failed the scheduled linux_x64_clang_byollvm job since iree-org#24833 landed. Since 2026-10-26 that job fails earlier, while configuring LLVM. Move the aarch64 and riscv64 RUN lines into their own tests, tag them with the LLVM target they need, and exclude those tags in build_and_test_byo_llvm.sh. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Tobias Fuchs <[email protected]>
devtbi
added a commit
that referenced
this pull request
Nov 9, 2026
…25221) ukernel_inlining.mlir, added in #24833, compiles for aarch64 and riscv64, but byo_llvm.sh builds LLVM with only the X86 target. The test has failed the scheduled linux_x64_clang_byollvm job since #24833 landed. Move the aarch64 and riscv64 RUN lines into their own tests. CMake adds these tests only if iree_compiler_targeting_iree_arch() is true for their architecture. The same check decides whether CMake builds the ukernel bitcode for the architecture. Without the LLVM target, CMake writes an empty bitcode file instead, so the tests cannot pass in such a build. The Bazel build always has these targets. The aarch64 RUN lines also crashed iree-compile: populateDefaultsFromTargetMachine only asserted that LLVM could create the target machine, so builds without assertions dereferenced a null pointer. It now reports a fatal usage error. --------- Signed-off-by: Tobias Fuchs <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
The ukernel bitcode carries per-function target-cpu/tune-cpu/target-features attributes that conflict with the attribute-less dispatch (which inherits the module-level TargetMachine) and stop LLVM from inlining the ukernel. Strip them (and vscale_range, so RVV bitcode inlines) at link time.
Fixes #24755.
Assisted-by: Claude Code