Skip to content

Update features tables to LLVM 21.1.8#22

Merged
topolarity merged 9 commits into
JuliaLang:mainfrom
giordano:mg/llvm-21
May 11, 2026
Merged

Update features tables to LLVM 21.1.8#22
topolarity merged 9 commits into
JuliaLang:mainfrom
giordano:mg/llvm-21

Conversation

@giordano
Copy link
Copy Markdown
Member

@giordano giordano commented May 9, 2026

CC @gbaraldi @topolarity (none of you is watching the repo...)

@giordano
Copy link
Copy Markdown
Member Author

giordano commented May 9, 2026

Don't quite understand what I'm supposed to do with the test failures. I frankly don't quite understand how to read the output, it's very confusing, there are lot of messages indicating "failures" and it's hard to tell what's relevant and what's not. I'm going to assume the relevant part is

 --- HW feature detection coverage ---
  FAIL: 'sve-sha3' is implied by a detectable HW bit but is not itself detectable (or baseline).  FAIL: 
  FAIL: 'sve-sm4' is implied by a detectable HW bit but is not itself detectable (or baseline).  FAIL: 
  FAIL: HW feature 'chk' is unhandled
  FAIL: HW feature 'sve-sha3' is unhandled
  FAIL: HW feature 'sve-sm4' is unhandled
  FAIL: HW feature 'use-fixed-over-scalable-if-equal-cost' is unhandled
  FAIL:     All HW features must be categorized: 
      - baseline (always present)
      - detectable (has a runtime probe implemented)
      - undetectable (no runtime probe, unsafe to enable)
      - featureset (only groups other features, no probe necessary)

  HW feature detection: FAILED

FAILED: 3 test(s) failed.

No idea what that "3 test(s) failed" refers to, it's impossible to understand what test fail, and what are those 3 (I see a lot more than 3 "FAIL" messages)

@christiangnrd

This comment was marked as resolved.

@topolarity
Copy link
Copy Markdown
Member

CC @gbaraldi @topolarity (none of you is watching the repo...)

I only ended up here to fix some conspicuous bugs 🙂

Don't quite understand what I'm supposed to do with the test failures.

All of the failures are relevant.

If the tables are updated such that new features are added, the host detection logic needs to be updated to detect them so that we can safely enable them ("All HW features must be categorized"). That is your situation for chk, sve-sha3, and sve-sm4. On the other hand, use-fixed-over-scalable-if-equal-cost is being incorrectly categorized as a HW bit. If you get the detection resolved for the other features, I can help with that one.

@giordano
Copy link
Copy Markdown
Member Author

giordano commented May 9, 2026

All of the failures are relevant.

So messages like

--- CPU lookup test ---
  generic: 8 features
  haswell: NOT FOUND
  skylake: NOT FOUND
  znver4: NOT FOUND
  znver3: NOT FOUND
  nonexistent: NOT FOUND

are relevant? Would look like something bad at a quick glance, but I know this is running on aarch64 and not finding haswell/skylake/znver4/znver3 doesn't seem surprising, but then this is confusing ("what am I supposed to do with this?"), which is my point.

If the tables are updated such that new features are added, the host detection logic needs to be updated to detect them so that we can safely enable them ("All HW features must be categorized"). That is your situation for chk, sve-sha3, and sve-sm4.

Any hint of where the detection logic happens?

@giordano
Copy link
Copy Markdown
Member Author

giordano commented May 10, 2026

Ok, I asked for help to a friendly assistant, and at least tests are passing on this platform. It claimed that

  • sve-sha3 and sve-sm4 are equivalent to sve2-sha3 and sve2-sm4, respectively, which seems plausible based on comments in LLVM source code
  • chk and use-fixed-over-scalable-if-equal-cost both don't have any runtime probe on any platform, so it classified them as such. Not sure about this one, you said use-fixed-over-scalable-if-equal-cost may be wrong?

I also got it to add some more information to the README about what to do when upgrading LLVM version, with references.

I kept the changes in separate commits, to make review easier. Feel free to fix anything wrong!

@gbaraldi
Copy link
Copy Markdown
Member

The sky lake etc messages are kind of sanity checks for doing things locally (and just to know what cpu CI might have) but thanks for reminding me that I need if defs around them

@topolarity
Copy link
Copy Markdown
Member

The use-fixed-over-scalable-if-equal-cost being marked as a HW feature is indeed an LLVM bug, already fixed in trunk by llvm/llvm-project#152156. I blacklisted it for now, which should have the same effect.

It sounds like chk is effectively part of the baseline feature set on all AArch64 platforms:

Since the CHKFEAT instruction is in the Hint instruction encoding space, it is effectively implemented on all PEs that support AArch64

https://developer.arm.com/documentation/ddi0487/mb/-Part-D-The-AArch64-System-Level-Architecture/-Chapter-D1-The-AArch64-System-Level-Programmers--Model/-D1-11-Check-Feature

Pushed 2 commits to fix each. I think the host detection is OK now

Comment thread tools/gen_target_tables.cpp
giordano and others added 5 commits May 11, 2026 15:43
Co-authored-by: Christian Guinard <28689358+christiangnrd@users.noreply.github.com>
LLVM 21 changed `sve2-sha3` to be shorthand for `+sve2,+sve-sha3` so we
no longer need to worry about this as a HW bit.
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This was a bug in upstream LLVM 21, already fixed in trunk.

See llvm/llvm-project#152156
Windows and macOS don't expose this yet, but Linux does.
Comment thread README.md Outdated
Co-authored-by: Cody Tapscott <84105208+topolarity@users.noreply.github.com>
Comment thread README.md Outdated
Comment thread README.md
Comment thread README.md Outdated
Comment thread README.md Outdated
Co-authored-by: Cody Tapscott <84105208+topolarity@users.noreply.github.com>
Copy link
Copy Markdown
Member

@topolarity topolarity left a comment

Choose a reason for hiding this comment

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

Took the liberty of rebasing on top of #25.

I think this is ready to merge, assuming CI is happy.

@topolarity topolarity merged commit 41f9bf5 into JuliaLang:main May 11, 2026
9 checks passed
@topolarity
Copy link
Copy Markdown
Member

Thanks for kicking this process off @giordano !

@giordano giordano deleted the mg/llvm-21 branch May 11, 2026 20:27
@giordano
Copy link
Copy Markdown
Member Author

Thanks for pushing it to the finish line 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants