rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.48k stars 12.73k forks source link

nvptx "ptx-kernel" ABI (feature: abi_ptx) uses PassMode::Direct for Aggregates #117271

Open kjetilkjeka opened 1 year ago

kjetilkjeka commented 1 year ago

It produces seemingly correct behavior. However, it needs to be switched over to a less fragile ABI handling (https://github.com/rust-lang/compiler-team/issues/672) before stabilization may happen.

@RalfJung's comment explains the problem and why it is considered harmless enough to allow this exception until a better solution is found.

kjetilkjeka commented 1 year ago

@rustbot label +O-NVPTX

RalfJung commented 1 year ago

@RalfJung's https://github.com/rust-lang/rust/pull/117247#issuecomment-1782361541 explains the problem and why it is considered harmless enough to allow this exception until a better solution is found.

This comment is an important part of that argument as well.

bjorn3 commented 5 days ago

Would it be possible to use PassMode::Cast? Maybe by adapting the code at https://github.com/rust-lang/rust/blob/3d1dba830a564d1118361345d7ada47a05241f45/compiler/rustc_codegen_llvm/src/type_of.rs#L15-L140 (which is what effectively defines how PassMode::Direct arguments are passed currently)