Skip to content

Conversation

@kulst
Copy link

@kulst kulst commented Jan 6, 2026

For NVPTX -Ctarget-cpu needs to be the same in all crates linked together into a binary.
This PR converts -Ctarget-cpu into a target-modifier. However, the agreement about it is only enforced when compiling for specific targets based on a flag in the target specification. This makes -Ctarget-cpu effectively a target-modifier only for NVPTX, for which this flag is set.

Previous discussions about this topic can be found here and here.

I also created a Zulip discussion.

I am unsure if a MCP is needed before proceeding. If you think so please let me know.

Creating target-modifiers for NVPTX target-features is to be done in a follow-up.

cc @kjetilkjeka as target maintainer for NVPTX
cc @Flakebi as you might need the same feature for amdgpu
cc @RalfJung you were very involved in the discussions so far

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 6, 2026
@kulst kulst changed the title Making -Ctarget-cpu a target-modifier on NVPTX Make -Ctarget-cpu a target-modifier on NVPTX Jan 6, 2026
@kulst
Copy link
Author

kulst commented Jan 6, 2026

@rustbot label: +O-NVPTX

@rustbot rustbot added the O-NVPTX Target: the NVPTX LLVM backend for running rust on GPUs, https://llvm.org/docs/NVPTXUsage.html label Jan 6, 2026
@kulst kulst changed the title Make -Ctarget-cpu a target-modifier on NVPTX Convert -Ctarget-cpu into a target-modifier on NVPTX Jan 7, 2026
@kulst kulst changed the title Convert -Ctarget-cpu into a target-modifier on NVPTX Convert -Ctarget-cpu into a target-modifier for NVPTX Jan 7, 2026
For NVPTX `-Ctarget-cpu` needs to be the same in all crates linked together
into a binary.
This converts `-Ctarget-cpu` into a target-modifier. However, the agreement
about it is only enforced when compiling for specific targets based on a flag
in the target specification. This makes `-Ctarget-cpu` effectively a
target-modifier only for NVPTX for which this flag is set.
@kulst kulst force-pushed the cpu_is_target_modifier branch from 7164067 to a8f5e96 Compare January 7, 2026 21:26
@kulst kulst marked this pull request as ready for review January 7, 2026 21:34
@rustbot
Copy link
Collaborator

rustbot commented Jan 7, 2026

Some changes occurred in src/doc/rustc/src/platform-support

cc @Noratrieb

These commits modify compiler targets.
(See the Target Tier Policy.)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 7, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 7, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 7, 2026

r? @nnethercote

rustbot has assigned @nnethercote.
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

@kulst
Copy link
Author

kulst commented Jan 7, 2026

r? @bjorn3 as you suggested this change.

@rustbot rustbot assigned bjorn3 and unassigned nnethercote Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-NVPTX Target: the NVPTX LLVM backend for running rust on GPUs, https://llvm.org/docs/NVPTXUsage.html 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants