Avoid using make_direct_deprecated() in extern "ptx-kernel"#133932
Avoid using make_direct_deprecated() in extern "ptx-kernel"#133932bors merged 2 commits intorust-lang:masterfrom
Conversation
|
r? @wesleywiser rustbot has assigned @wesleywiser. Use |
|
|
||
| // CHECK: .visible .entry f_single_u8_arg( | ||
| // CHECK: .param .align 1 .b8 f_single_u8_arg_param_0[1] | ||
| // CHECK: .param .u8 f_single_u8_arg_param_0 |
There was a problem hiding this comment.
I presume this has an identical ABI.
There was a problem hiding this comment.
That might be correct. My worry here is that it goes against the "ptx-interoperability" docs.
https://docs.nvidia.com/cuda/ptx-writers-guide-to-interoperability/index.html#aggregates-and-unions
Getting these kind of struct correct (per interop docs) was a big reason I couldn't get it "just right" when attempting to remove the PassMode::Direct
There was a problem hiding this comment.
The last commit reverts the ABI for this function back to what it was.
| // CHECK: .visible .entry f_u32_slice_arg( | ||
| // CHECK: .param .u64 f_u32_slice_arg_param_0 | ||
| // CHECK: .param .u64 f_u32_slice_arg_param_1 | ||
| // CHECK: .param .align 8 .b8 f_u32_slice_arg_param_0[16] |
There was a problem hiding this comment.
We don't guarantee any ABI for wide pointers anyway and if this is breaks the ABI all users can be updated to pass #[repr(C)] struct Slice<'a, T> { ptr: *const (), len: usize, _marker: PhantomData<&'a [T]> } on the host side anyway (and preferably also the gpu side to avoid depending on the unstable ABI).
| // CHECK: .visible .entry f_tuple_u8_u8_u32_arg( | ||
| // CHECK: .param .align 4 .b8 f_tuple_u8_u8_u32_arg_param_0[8] | ||
| #[no_mangle] | ||
| pub unsafe extern "ptx-kernel" fn f_tuple_u8_u8_u32_arg(_a: (u8, u8, u32)) {} |
There was a problem hiding this comment.
Tuples don't have a stable ABI for any calling convention. And can always be replaced with structs anyway.
|
cc @kjetilkjeka @RDambrosio016 as target maintainers, but given that this is a tier 3 target without documentation about what the |
f38e850 to
9aca298
Compare
|
I will try to run this patch through my workplace internal rust CUDA projects and see if anything interesting turns up later today. |
|
I'm a colleague of Kjetil. This change does not seem to break our codebase. |
0a44f67 to
7f69c46
Compare
FYI |
This method will be removed in the future as it produces a broken ABI that depends on cg_llvm implementation details. After this PR wasm32-unknown-unknown is the only remaining user of make_direct_deprecated().
7f69c46 to
1c1c13a
Compare
|
@bors r+ rollup |
…kingjubilee Rollup of 13 pull requests Successful merges: - rust-lang#133932 (Avoid using make_direct_deprecated() in extern "ptx-kernel") - rust-lang#136269 (Pass spans around new solver) - rust-lang#136550 (Fix `rustc_hidden_type_of_opaques` for RPITITs with no default body) - rust-lang#136558 (Document minimum supported host tooling on macOS) - rust-lang#136563 (Clean up `Trivial*Impls` macros) - rust-lang#136566 (Fix link in from_fn.rs) - rust-lang#136573 (Document why some "type mismatches" exist) - rust-lang#136583 (Only highlight unmatchable parameters at the definition site) - rust-lang#136587 (Update browser-ui-test version to `0.20.2`) - rust-lang#136590 (Implement RustcInternal for RawPtrKind) - rust-lang#136591 (Add `rustc_hir_pretty::expr_to_string` function) - rust-lang#136595 (Fix `unreachable_pub` lint for hermit target) - rust-lang#136611 (cg_llvm: Remove the `mod llvm_` hack, which should no longer be necessary) Failed merges: - rust-lang#136565 (compiler: Clean up weird `rustc_abi` reexports) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#133932 - bjorn3:fix_ptx_kernel_abi, r=wesleywiser Avoid using make_direct_deprecated() in extern "ptx-kernel" This method will be removed in the future as it produces a broken ABI that depends on cg_llvm implementation details. After this PR wasm32-unknown-unknown is the only remaining user of make_direct_deprecated(). Fixes rust-lang#117271 Blocks rust-lang#38788
…kingjubilee Rollup of 13 pull requests Successful merges: - rust-lang#133932 (Avoid using make_direct_deprecated() in extern "ptx-kernel") - rust-lang#136269 (Pass spans around new solver) - rust-lang#136550 (Fix `rustc_hidden_type_of_opaques` for RPITITs with no default body) - rust-lang#136558 (Document minimum supported host tooling on macOS) - rust-lang#136563 (Clean up `Trivial*Impls` macros) - rust-lang#136566 (Fix link in from_fn.rs) - rust-lang#136573 (Document why some "type mismatches" exist) - rust-lang#136583 (Only highlight unmatchable parameters at the definition site) - rust-lang#136587 (Update browser-ui-test version to `0.20.2`) - rust-lang#136590 (Implement RustcInternal for RawPtrKind) - rust-lang#136591 (Add `rustc_hir_pretty::expr_to_string` function) - rust-lang#136595 (Fix `unreachable_pub` lint for hermit target) - rust-lang#136611 (cg_llvm: Remove the `mod llvm_` hack, which should no longer be necessary) Failed merges: - rust-lang#136565 (compiler: Clean up weird `rustc_abi` reexports) r? `@ghost` `@rustbot` modify labels: rollup
This method will be removed in the future as it produces a broken ABI that depends on cg_llvm implementation details. After this PR wasm32-unknown-unknown is the only remaining user of make_direct_deprecated().
Fixes #117271
Blocks #38788