-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Convert -Ctarget-cpu into a target-modifier for NVPTX
#150732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
-Ctarget-cpu a target-modifier on NVPTX
|
@rustbot label: +O-NVPTX |
-Ctarget-cpu a target-modifier on NVPTX-Ctarget-cpu into a target-modifier on NVPTX
-Ctarget-cpu into a target-modifier on NVPTX-Ctarget-cpu into a target-modifier for NVPTX
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.
7164067 to
a8f5e96
Compare
|
Some changes occurred in src/doc/rustc/src/platform-support cc @Noratrieb These commits modify compiler targets. |
|
r? @nnethercote rustbot has assigned @nnethercote. Use |
|
r? @bjorn3 as you suggested this change. |
| // With `ptx-linker` approach, it can be later overridden via link flags. | ||
| cpu: "sm_30".into(), | ||
| // The target cpu for NVPTX must be the same for a complete binary. | ||
| cpu_is_target_modifier: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe AVR has the same requirement and probably amdgcn too. Also why does nvptx not have need_explicit_cpu set? Would we ever need to set need_explicit_cpu without cpu_is_target_modifier and vice versa?
|
It works out really nice with -CTarget-cpu being able to be a target modifier. It would be nice to know what the plan was with the ptx isa version as well. I asked that question here |
|
I can't vouch for the implementation, but the approach sounds good. :) Cc @Darksonn |
For NVPTX
-Ctarget-cpuneeds to be the same in all crates linked together into a binary.This PR converts
-Ctarget-cpuinto 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-cpueffectively 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
Target modifier tracking issue: #136966