From 84c9c4aca7665e40986392845406a1b7524da07f Mon Sep 17 00:00:00 2001 From: Kjetil Kjeka Date: Thu, 26 Oct 2023 21:43:43 +0200 Subject: [PATCH 1/3] NVPTX: Allow PassMode::Direct for ptx kernels for now --- compiler/rustc_codegen_llvm/src/abi.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs index 9e834b83df43c..6bface44a6305 100644 --- a/compiler/rustc_codegen_llvm/src/abi.rs +++ b/compiler/rustc_codegen_llvm/src/abi.rs @@ -362,8 +362,13 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> { // currently use this mode so we have to allow it -- but we absolutely // shouldn't let any more targets do that. // (Also see .) + // + // The unstable api `PtxKernel` also uses Direct for now. + // It needs to switch to something else before stabilization can happen. + // (Tracking issue abi_ptx: https://github.com/rust-lang/rust/issues/38788) assert!( - matches!(&*cx.tcx.sess.target.arch, "wasm32" | "wasm64"), + matches!(&*cx.tcx.sess.target.arch, "wasm32" | "wasm64") + || self.conv == Conv::PtxKernel, "`PassMode::Direct` for aggregates only allowed on wasm targets\nProblematic type: {:#?}", arg.layout, ); From 4d33876778011f7273ab3ebdbdbc35928832332b Mon Sep 17 00:00:00 2001 From: Kjetil Kjeka Date: Fri, 27 Oct 2023 00:47:52 +0200 Subject: [PATCH 2/3] Documentation and error message improvements related to PassMode::Direct assert Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com> --- compiler/rustc_codegen_llvm/src/abi.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs index 6bface44a6305..7d742ac732c05 100644 --- a/compiler/rustc_codegen_llvm/src/abi.rs +++ b/compiler/rustc_codegen_llvm/src/abi.rs @@ -363,13 +363,13 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> { // shouldn't let any more targets do that. // (Also see .) // - // The unstable api `PtxKernel` also uses Direct for now. + // The unstable abi `PtxKernel` also uses Direct for now. // It needs to switch to something else before stabilization can happen. // (Tracking issue abi_ptx: https://github.com/rust-lang/rust/issues/38788) assert!( matches!(&*cx.tcx.sess.target.arch, "wasm32" | "wasm64") || self.conv == Conv::PtxKernel, - "`PassMode::Direct` for aggregates only allowed on wasm targets\nProblematic type: {:#?}", + "`PassMode::Direct` for aggregates only allowed on wasm and `extern \"ptx-kernel\"` fns\nProblematic type: {:#?}", arg.layout, ); } From bb45c812e0b8e45a704b768a6a2080f6f794667b Mon Sep 17 00:00:00 2001 From: Kjetil Kjeka Date: Fri, 27 Oct 2023 11:38:07 +0200 Subject: [PATCH 3/3] Link to correct issue in PassMode::Direct ptx-kernel exception --- compiler/rustc_codegen_llvm/src/abi.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs index 7d742ac732c05..6e3a4cae2f62b 100644 --- a/compiler/rustc_codegen_llvm/src/abi.rs +++ b/compiler/rustc_codegen_llvm/src/abi.rs @@ -365,7 +365,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> { // // The unstable abi `PtxKernel` also uses Direct for now. // It needs to switch to something else before stabilization can happen. - // (Tracking issue abi_ptx: https://github.com/rust-lang/rust/issues/38788) + // (See issue: https://github.com/rust-lang/rust/issues/117271) assert!( matches!(&*cx.tcx.sess.target.arch, "wasm32" | "wasm64") || self.conv == Conv::PtxKernel,