Skip to content

rustc_codegen_llvm: handle sm_101* features being an alias - #160696

Open
durin42 wants to merge 1 commit into
rust-lang:mainfrom
durin42:llvm-24-nvptx-subtarget-rename
Open

rustc_codegen_llvm: handle sm_101* features being an alias#160696
durin42 wants to merge 1 commit into
rust-lang:mainfrom
durin42:llvm-24-nvptx-subtarget-rename

Conversation

@durin42

@durin42 durin42 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

LLVM 24 moved sm_101{,a,f} features to just be an alias for the matching sm_110 feature. Since the sm_110 feature already exists, we can do the remapping unconditionally rather than gating it on LLVM 24.

  • I did not use an LLM to create a change in this PR.
  • I used an LLM to create a change in this PR, and I have explained below how it was used.

An LLM processed the build failure to identify the breaking change. From there the fix was obvious and performed by hand.

@rustbot label: +llvm-main

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 7, 2026
@rustbot

rustbot commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

r? @folkertdev

rustbot has assigned @folkertdev.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 75 candidates
  • Random selection from 20 candidates

@rustbot rustbot added the llvm-main Marks PRs that are making Rust work with LLVM main (this label is consumed by CI tooling) label Aug 7, 2026
@folkertdev

Copy link
Copy Markdown
Contributor

cc target maintainers @kjetilkjeka @kulst

@folkertdev folkertdev added the O-NVPTX Target: the NVPTX LLVM backend for running rust on GPUs, https://llvm.org/docs/NVPTXUsage.html label Aug 7, 2026
@rust-log-analyzer

This comment has been minimized.

@folkertdev

folkertdev commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

tbh it would be easier to review if you just gate it on >= LLVM 24

LLVM 24 moved sm_101{,a,f} features to just be an alias for the matching
sm_110 feature. Even though the breaking change in LLVM didn't introduce
the 110 flavors, they appear to not exist in older LLVMs so we just gate
on LLVM 24.
@durin42
durin42 force-pushed the llvm-24-nvptx-subtarget-rename branch from 62a47c4 to 1bd2075 Compare August 7, 2026 13:31
@durin42

durin42 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

tbh it would be easier to review if you just gate it on >= LLVM 24

Yep. I was misled by the shape of the diff I guess. Fixed.

@kulst

kulst commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Thank you for bringing this up!
Your fix LGTM.

IIUC LLVM started to model the compatibility of compute capabilities as subtarget features. Previously those were subtarget features, too, but were not implied by compatible ones (for example sm_90a did not imply sm_90).
With #138689 we introduced corresponding Rust target features that do imply compatible ones long before LLVM introduced this.

However, the same LLVM patch also removed sm_101 and its variants from being subtarget features at all. So our implication logic may enable subtarget features that are not present in LLVM 24.
For example compiling with -Ctarget-cpu=sm_120 probably would enable a sm_120 Rust target feature and our implication logic would then enable a sm_101 subtarget feature.

Just out of curiosity, did you encounter this bug in this way, or did you manually enable the Rust target feature sm_101 or one of its variants?

@durin42

durin42 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

We've got CI running on buildkite which caught this shortly after the LLVM change landed.

@folkertdev

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@rust-bors

rust-bors Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1bd2075 has been approved by folkertdev

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 7, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 7, 2026
…name, r=folkertdev

rustc_codegen_llvm: handle sm_101* features being an alias

LLVM 24 [moved sm_101{,a,f} features](llvm/llvm-project#214335) to just be an alias for the matching sm_110 feature. Since the sm_110 feature already exists, we can do the remapping unconditionally rather than gating it on LLVM 24.

@rustbot label: +llvm-main
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 7, 2026
…name, r=folkertdev

rustc_codegen_llvm: handle sm_101* features being an alias

LLVM 24 [moved sm_101{,a,f} features](llvm/llvm-project#214335) to just be an alias for the matching sm_110 feature. Since the sm_110 feature already exists, we can do the remapping unconditionally rather than gating it on LLVM 24.

@rustbot label: +llvm-main
rust-bors Bot pushed a commit that referenced this pull request Aug 7, 2026
…uwer

Rollup of 28 pull requests

Successful merges:

 - #159784 (Hint that memchr returns an in-bounds index)
 - #160673 (Improve `canonical_param_env_cache`)
 - #150885 (Revive L4Re target)
 - #159643 (Add support for splatted function pointers)
 - #160433 (delegation: add support for wrapping of the return value with `From::from`)
 - #160530 (refactor handling of target features in Session)
 - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`)
 - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items)
 - #160683 (Add regression test for unknown feaeture name reported with other errors)
 - #157641 (Do not promote extern statics)
 - #158904 (Fix FutureDropPoll shim for by-move async closures)
 - #159816 (added note/help about iterator invalidation when mutating a collection inside a for loop)
 - #160103 (Add regression test for GAT bound mismatched type error)
 - #160335 (dlopen offload)
 - #160445 (codegen: classify localized MSVC linker progress as linker_info)
 - #160499 (rustc_resolve: move diagnostic attribute linting to attr parsing)
 - #160504 (cleanup borrowck, improve c-variadic handling)
 - #160577 (expand: Feature gate AST-based attribute macros on expressions and statements)
 - #160587 (Add regression test for associated type outlives bound at call site)
 - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.)
 - #160633 (delegation: fix determining wrong `FnKind` when delegation is inside const arg)
 - #160636 (derive(Diagnostic): link to proper docs)
 - #160644 (Clean up some manual debug impls)
 - #160649 (move naked function ui tests)
 - #160672 (Improve `MaybeLiveLocals`)
 - #160693 (Add branch config for perf. unrolling in bors)
 - #160696 (rustc_codegen_llvm: handle sm_101* features being an alias)
 - #160706 (renovate: clarify that vulnerability PRs are opened automatically)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. llvm-main Marks PRs that are making Rust work with LLVM main (this label is consumed by CI tooling) O-NVPTX Target: the NVPTX LLVM backend for running rust on GPUs, https://llvm.org/docs/NVPTXUsage.html S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants