Fix a bug in the ptx-kernel calling convention where structs was passed indirectly

Structs being passed indirectly is suprpising and have a high chance not to work as the device and host usually do not share memory.
This commit is contained in:
Kjetil Kjeka 2022-03-07 15:09:28 +01:00
parent 297273c45b
commit 352abbaade
5 changed files with 98 additions and 9 deletions

View file

@ -2568,6 +2568,22 @@ where
pointee_info
}
fn is_adt(this: TyAndLayout<'tcx>) -> bool {
matches!(this.ty.kind(), ty::Adt(..))
}
fn is_never(this: TyAndLayout<'tcx>) -> bool {
this.ty.kind() == &ty::Never
}
fn is_tuple(this: TyAndLayout<'tcx>) -> bool {
matches!(this.ty.kind(), ty::Tuple(..))
}
fn is_unit(this: TyAndLayout<'tcx>) -> bool {
matches!(this.ty.kind(), ty::Tuple(list) if list.len() == 0)
}
}
impl<'tcx> ty::Instance<'tcx> {