-
Notifications
You must be signed in to change notification settings - Fork 13.6k
add nvptx_target_feature #138689
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
add nvptx_target_feature #138689
Conversation
r? @wesleywiser rustbot has assigned @wesleywiser. Use |
This comment has been minimized.
This comment has been minimized.
It looks like the failing build environment is using LLVM-18 (sm_100 onward were added recently llvm/llvm-project#124155). I could remove those entirely (such hardware isn't available yet) or guard them based on LLVM version (how?). |
IIUC LLVM exposes these as target CPUs ( |
I think it'd be good to have more testing (could be punted into an issue and done later):
I think it'd also be good to have more docs:
|
You can address this issue by modifying rust/compiler/rustc_codegen_llvm/src/llvm_util.rs Lines 280 to 285 in c4b38a5
LLVM actually supports Outputs of both --print target-cpus and --print target-features also show them$ rustc --target nvptx64-nvidia-cuda --print target-cpus
Available CPUs for this target:
sm_100
sm_100a
sm_101
sm_101a
sm_120
sm_120a
sm_20
sm_21
sm_30 - This is the default target CPU for the current build target (currently nvptx64-nvidia-cuda).
sm_32
sm_35
sm_37
sm_50
sm_52
sm_53
sm_60
sm_61
sm_62
sm_70
sm_72
sm_75
sm_80
sm_86
sm_87
sm_89
sm_90
sm_90a
$ rustc --target nvptx64-nvidia-cuda --print target-features
Features supported by rustc for this target:
crt-static - Enables C Run-time Libraries to be statically linked.
Code-generation features supported by LLVM for this target:
ptx32 - Use PTX version 32.
ptx40 - Use PTX version 40.
ptx41 - Use PTX version 41.
ptx42 - Use PTX version 42.
ptx43 - Use PTX version 43.
ptx50 - Use PTX version 50.
ptx60 - Use PTX version 60.
ptx61 - Use PTX version 61.
ptx62 - Use PTX version 62.
ptx63 - Use PTX version 63.
ptx64 - Use PTX version 64.
ptx65 - Use PTX version 65.
ptx70 - Use PTX version 70.
ptx71 - Use PTX version 71.
ptx72 - Use PTX version 72.
ptx73 - Use PTX version 73.
ptx74 - Use PTX version 74.
ptx75 - Use PTX version 75.
ptx76 - Use PTX version 76.
ptx77 - Use PTX version 77.
ptx78 - Use PTX version 78.
ptx80 - Use PTX version 80.
ptx81 - Use PTX version 81.
ptx82 - Use PTX version 82.
ptx83 - Use PTX version 83.
ptx84 - Use PTX version 84.
ptx85 - Use PTX version 85.
ptx86 - Use PTX version 86.
ptx87 - Use PTX version 87.
sm_100 - Target SM 100.
sm_100a - Target SM 100a.
sm_101 - Target SM 101.
sm_101a - Target SM 101a.
sm_120 - Target SM 120.
sm_120a - Target SM 120a.
sm_20 - Target SM 20.
sm_21 - Target SM 21.
sm_30 - Target SM 30.
sm_32 - Target SM 32.
sm_35 - Target SM 35.
sm_37 - Target SM 37.
sm_50 - Target SM 50.
sm_52 - Target SM 52.
sm_53 - Target SM 53.
sm_60 - Target SM 60.
sm_61 - Target SM 61.
sm_62 - Target SM 62.
sm_70 - Target SM 70.
sm_72 - Target SM 72.
sm_75 - Target SM 75.
sm_80 - Target SM 80.
sm_86 - Target SM 86.
sm_87 - Target SM 87.
sm_89 - Target SM 89.
sm_90 - Target SM 90.
sm_90a - Target SM 90a.
Use +feature to enable a feature, or -feature to disable it.
For example, rustc -C target-cpu=mycpu -C target-feature=+feature1,-feature2
Code-generation features cannot be used in cfg or #[target_feature],
and may be renamed or removed in a future version of LLVM or rustc. |
Btw, is it intentional that the |
Thanks @taiki-e. I'll update accordingly. I'm seeing PTX 7.8 being written in an otherwise-default configuration with target |
b593748
to
00c6bb7
Compare
I updated to add the One remaining issue (for the tests @gonzalobg requested) is that |
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #139229) made this pull request unmergeable. Please resolve the merge conflicts. |
00c6bb7
to
f56ad5d
Compare
Some changes occurred in src/doc/rustc/src/platform-support cc @Noratrieb |
This comment has been minimized.
This comment has been minimized.
f56ad5d
to
150e5a7
Compare
This comment has been minimized.
This comment has been minimized.
150e5a7
to
3921290
Compare
This comment has been minimized.
This comment has been minimized.
3921290
to
118f5a9
Compare
f25c822
to
35a485d
Compare
Some changes occurred in compiler/rustc_codegen_ssa |
I rebased. The warnings for implied features were fixed by #140920. I updated a stale comment left behind in that refactor, and my handling of features transitively implied by base features moved to rustc_codegen_ssa. |
@wesleywiser 👋 What are the next steps for this PR? |
It looks like all the feedback was addressed. I went through the PR and so far the changes look sensible to me, and seem to unblock some follow-up work. Since it's properly feature gated and
I don't think we should let this work be blocked for longer. @bors r+ |
… r=ZuseZ4 add nvptx_target_feature Tracking issue: rust-lang#141468 (nvptx), which is part of rust-lang#44839 (catch-all arches) The feature gate is `#![feature(nvptx_target_feature)]` This exposes the target features `sm_20` through `sm_120a` [as defined](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.1/llvm/lib/Target/NVPTX/NVPTX.td#L59-L85) by LLVM. Cc: `@gonzalobg` `@rustbot` label +O-NVPTX +A-target-feature
Rollup of 9 pull requests Successful merges: - #137831 (Tweak auto trait errors) - #138689 (add nvptx_target_feature) - #140267 (implement continue_ok and break_ok for ControlFlow) - #143764 (lower pattern bindings in the order they're written and base drop order on primary bindings' order) - #143857 (Port #[macro_export] to the new attribute parsing infrastructure) - #144650 (Additional tce tests) - #144676 (Add documentation for unstable_feature_bound) - #144794 (Port `#[coroutine]` to the new attribute system) - #144835 (Anonymize binders in tail call sig) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 9 pull requests Successful merges: - #137831 (Tweak auto trait errors) - #138689 (add nvptx_target_feature) - #140267 (implement continue_ok and break_ok for ControlFlow) - #143764 (lower pattern bindings in the order they're written and base drop order on primary bindings' order) - #143857 (Port #[macro_export] to the new attribute parsing infrastructure) - #144650 (Additional tce tests) - #144676 (Add documentation for unstable_feature_bound) - #144794 (Port `#[coroutine]` to the new attribute system) - #144835 (Anonymize binders in tail call sig) r? `@ghost` `@rustbot` modify labels: rollup
… r=ZuseZ4 add nvptx_target_feature Tracking issue: rust-lang#141468 (nvptx), which is part of rust-lang#44839 (catch-all arches) The feature gate is `#![feature(nvptx_target_feature)]` This exposes the target features `sm_20` through `sm_120a` [as defined](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.1/llvm/lib/Target/NVPTX/NVPTX.td#L59-L85) by LLVM. Cc: ``@gonzalobg`` ``@rustbot`` label +O-NVPTX +A-target-feature
… r=ZuseZ4 add nvptx_target_feature Tracking issue: rust-lang#141468 (nvptx), which is part of rust-lang#44839 (catch-all arches) The feature gate is `#![feature(nvptx_target_feature)]` This exposes the target features `sm_20` through `sm_120a` [as defined](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.1/llvm/lib/Target/NVPTX/NVPTX.td#L59-L85) by LLVM. Cc: ```@gonzalobg``` ```@rustbot``` label +O-NVPTX +A-target-feature
Rollup of 9 pull requests Successful merges: - #137831 (Tweak auto trait errors) - #138689 (add nvptx_target_feature) - #140267 (implement continue_ok and break_ok for ControlFlow) - #143764 (lower pattern bindings in the order they're written and base drop order on primary bindings' order) - #143857 (Port #[macro_export] to the new attribute parsing infrastructure) - #144676 (Add documentation for unstable_feature_bound) - #144794 (Port `#[coroutine]` to the new attribute system) - #144835 (Anonymize binders in tail call sig) - #144836 (Change visibility of Args new function) r? `@ghost` `@rustbot` modify labels: rollup
… r=ZuseZ4 add nvptx_target_feature Tracking issue: rust-lang#141468 (nvptx), which is part of rust-lang#44839 (catch-all arches) The feature gate is `#![feature(nvptx_target_feature)]` This exposes the target features `sm_20` through `sm_120a` [as defined](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.1/llvm/lib/Target/NVPTX/NVPTX.td#L59-L85) by LLVM. Cc: ````@gonzalobg```` ````@rustbot```` label +O-NVPTX +A-target-feature
Rollup of 21 pull requests Successful merges: - #137831 (Tweak auto trait errors) - #138689 (add nvptx_target_feature) - #140267 (implement continue_ok and break_ok for ControlFlow) - #143679 (Preserve the .debug_gdb_scripts section) - #143857 (Port #[macro_export] to the new attribute parsing infrastructure) - #143929 (Mark all deprecation lints in name resolution as deny-by-default and report-in-deps) - #144133 (Stabilize const TypeId::of) - #144369 (Upgrade semicolon_in_expressions_from_macros from warn to deny) - #144473 (Address libunwind.a inconsistency issues in the bootstrap program) - #144498 (Add --print target-spec-json-schema) - #144552 (Rehome 33 `tests/ui/issues/` tests to other subdirectories under `tests/ui/`) - #144659 (bootstrap: refactor mingw dist and fix gnullvm) - #144676 (Add documentation for unstable_feature_bound) - #144794 (Port `#[coroutine]` to the new attribute system) - #144835 (Anonymize binders in tail call sig) - #144836 (Change visibility of Args new function) - #144861 (Stabilize `panic_payload_as_str` feature) - #144910 (Add regression tests for seemingly fixed issues) - #144913 ([rustdoc] Fix wrong `i` tooltip icon) - #144917 (Enforce tail call type is related to body return type in borrowck) - #144924 (compiletest: add hint for when a ui test produces no errors) r? `@ghost` `@rustbot` modify labels: rollup
… r=ZuseZ4 add nvptx_target_feature Tracking issue: rust-lang#141468 (nvptx), which is part of rust-lang#44839 (catch-all arches) The feature gate is `#![feature(nvptx_target_feature)]` This exposes the target features `sm_20` through `sm_120a` [as defined](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.1/llvm/lib/Target/NVPTX/NVPTX.td#L59-L85) by LLVM. Cc: `````@gonzalobg````` `````@rustbot````` label +O-NVPTX +A-target-feature
Rollup of 7 pull requests Successful merges: - #138689 (add nvptx_target_feature) - #140267 (implement continue_ok and break_ok for ControlFlow) - #143807 (Pass -Werror when building the LLVM wrapper) - #144369 (Upgrade semicolon_in_expressions_from_macros from warn to deny) - #144601 (Allow `cargo fix` to partially apply `mismatched_lifetime_syntaxes`) - #144682 (Stabilize `strict_overflow_ops`) - #145026 (Update books) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 19 pull requests Successful merges: - #137831 (Tweak auto trait errors) - #138689 (add nvptx_target_feature) - #140267 (implement continue_ok and break_ok for ControlFlow) - #143028 (emit `StorageLive` and schedule `StorageDead` for `let`-`else`'s bindings after matching) - #143764 (lower pattern bindings in the order they're written and base drop order on primary bindings' order) - #143808 (Port `#[should_panic]` to the new attribute parsing infrastructure ) - #143906 (Miri: non-deterministic floating point operations in `foreign_items`) - #143929 (Mark all deprecation lints in name resolution as deny-by-default and report-in-deps) - #144133 (Stabilize const TypeId::of) - #144369 (Upgrade semicolon_in_expressions_from_macros from warn to deny) - #144439 (Introduce ModernIdent type to unify macro 2.0 hygiene handling) - #144473 (Address libunwind.a inconsistency issues in the bootstrap program) - #144601 (Allow `cargo fix` to partially apply `mismatched_lifetime_syntaxes`) - #144650 (Additional tce tests) - #144659 (bootstrap: refactor mingw dist and fix gnullvm) - #144682 (Stabilize `strict_overflow_ops`) - #145026 (Update books) - #145033 (Reimplement `print_region` in `type_name.rs`.) - #145040 (rustc-dev-guide subtree update) Failed merges: - #143857 (Port #[macro_export] to the new attribute parsing infrastructure) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #138689 - jedbrown:jed/nvptx-target-feature, r=ZuseZ4 add nvptx_target_feature Tracking issue: #141468 (nvptx), which is part of #44839 (catch-all arches) The feature gate is `#![feature(nvptx_target_feature)]` This exposes the target features `sm_20` through `sm_120a` [as defined](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.1/llvm/lib/Target/NVPTX/NVPTX.td#L59-L85) by LLVM. Cc: ``````@gonzalobg`````` ``````@rustbot`````` label +O-NVPTX +A-target-feature
Rollup of 19 pull requests Successful merges: - rust-lang/rust#137831 (Tweak auto trait errors) - rust-lang/rust#138689 (add nvptx_target_feature) - rust-lang/rust#140267 (implement continue_ok and break_ok for ControlFlow) - rust-lang/rust#143028 (emit `StorageLive` and schedule `StorageDead` for `let`-`else`'s bindings after matching) - rust-lang/rust#143764 (lower pattern bindings in the order they're written and base drop order on primary bindings' order) - rust-lang/rust#143808 (Port `#[should_panic]` to the new attribute parsing infrastructure ) - rust-lang/rust#143906 (Miri: non-deterministic floating point operations in `foreign_items`) - rust-lang/rust#143929 (Mark all deprecation lints in name resolution as deny-by-default and report-in-deps) - rust-lang/rust#144133 (Stabilize const TypeId::of) - rust-lang/rust#144369 (Upgrade semicolon_in_expressions_from_macros from warn to deny) - rust-lang/rust#144439 (Introduce ModernIdent type to unify macro 2.0 hygiene handling) - rust-lang/rust#144473 (Address libunwind.a inconsistency issues in the bootstrap program) - rust-lang/rust#144601 (Allow `cargo fix` to partially apply `mismatched_lifetime_syntaxes`) - rust-lang/rust#144650 (Additional tce tests) - rust-lang/rust#144659 (bootstrap: refactor mingw dist and fix gnullvm) - rust-lang/rust#144682 (Stabilize `strict_overflow_ops`) - rust-lang/rust#145026 (Update books) - rust-lang/rust#145033 (Reimplement `print_region` in `type_name.rs`.) - rust-lang/rust#145040 (rustc-dev-guide subtree update) Failed merges: - rust-lang/rust#143857 (Port #[macro_export] to the new attribute parsing infrastructure) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 19 pull requests Successful merges: - rust-lang/rust#137831 (Tweak auto trait errors) - rust-lang/rust#138689 (add nvptx_target_feature) - rust-lang/rust#140267 (implement continue_ok and break_ok for ControlFlow) - rust-lang/rust#143028 (emit `StorageLive` and schedule `StorageDead` for `let`-`else`'s bindings after matching) - rust-lang/rust#143764 (lower pattern bindings in the order they're written and base drop order on primary bindings' order) - rust-lang/rust#143808 (Port `#[should_panic]` to the new attribute parsing infrastructure ) - rust-lang/rust#143906 (Miri: non-deterministic floating point operations in `foreign_items`) - rust-lang/rust#143929 (Mark all deprecation lints in name resolution as deny-by-default and report-in-deps) - rust-lang/rust#144133 (Stabilize const TypeId::of) - rust-lang/rust#144369 (Upgrade semicolon_in_expressions_from_macros from warn to deny) - rust-lang/rust#144439 (Introduce ModernIdent type to unify macro 2.0 hygiene handling) - rust-lang/rust#144473 (Address libunwind.a inconsistency issues in the bootstrap program) - rust-lang/rust#144601 (Allow `cargo fix` to partially apply `mismatched_lifetime_syntaxes`) - rust-lang/rust#144650 (Additional tce tests) - rust-lang/rust#144659 (bootstrap: refactor mingw dist and fix gnullvm) - rust-lang/rust#144682 (Stabilize `strict_overflow_ops`) - rust-lang/rust#145026 (Update books) - rust-lang/rust#145033 (Reimplement `print_region` in `type_name.rs`.) - rust-lang/rust#145040 (rustc-dev-guide subtree update) Failed merges: - rust-lang/rust#143857 (Port #[macro_export] to the new attribute parsing infrastructure) r? `@ghost` `@rustbot` modify labels: rollup
Tracking issue: #141468 (nvptx), which is part of #44839 (catch-all arches)
The feature gate is
#![feature(nvptx_target_feature)]
This exposes the target features
sm_20
throughsm_120a
as defined by LLVM.Cc: @gonzalobg
@rustbot label +O-NVPTX +A-target-feature