You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(note: experimental qptr branches can handle some of this already)
typed variables are currently relied on for:
regular data type accesses (turning offsets into field accesses)
would be subsumed by qptr (which infers typed memory in general)
might be fixable pre-qptr by collecting types from accesses (however, typed GEPs have been replaced with raw byte offsets by now, so this would observe N disjoint leaves, no "field N of struct S", and borderline reimplement the qptr type recovery algorithm)
inline asm!typeof*/type inference
sadly needed because we can't use normal value in/out in asm! (without being limited to no generics, no vectors, etc.) and have to resort to passing &T for inputs and &MaybeUninit<T> for outputs - or rather, *mut T from the latter)
thankfully, rustc_codegen_ssa does pass the Rust type of each input, so this has a relatively simple fix (just need to open a PR for it)
variables containing handles (e.g. Images), not data
also needs to allow (for asm!) e.g. MaybeUninit<SomeHandle> (newtype unpacking of this is messy due to MaybeUninit<T> containing ManuallyDrop<T>, more than anything else, but now that typed GEP is gone, we can more aggressively unpack newtypes and disallow rustc_codegen_ssa giving struct field constant indices, only at most dynamic array indices)
even qptr wouldn't accept the size & alignment form for handles
thankfully, handle types being opaque means these variables will always be accessed with the same type, so "infer type from accesses" would work here
PR that introduced
rustc_codegen_ssapatching (akapqp_cg_ssa):nightly-2024-11-22(~1.84). #170(its description goes into much more detail)
Legitimate solutions are needed, to replace the patching "hack"arounds:
#[repr(simd)]for SPIR-V vector types#[spirv(vector)]as a replacementglamwould need to depend onspirv-std-macrosglamusing#[spirv(matrix)], too!core::simd::Simd<T, N>glamalready has some features for this but only for some types(and largely as an optimization, i.e. accelerating operations)
glamneeds to cast&Simd<T, 2>to&struct { x: T, y: T }(with
#[repr(C)]on the latterstruct, this is 100% defined)qptrmay be required for thisallocain LLVM terms)(instead of a type, creating a variable now takes only size & alignment)
qptrbranches can handle some of this already)qptr(which infers typed memory in general)qptrby collecting types from accesses(however, typed GEPs have been replaced with raw byte offsets by now, so this would observe N disjoint leaves, no "field
Nof structS", and borderline reimplement theqptrtype recovery algorithm)asm!typeof*/type inferencein/outinasm!(without being limited to no generics, no vectors, etc.) and have to resort to passing&Tfor inputs and&MaybeUninit<T>for outputs - or rather,*mut Tfrom the latter)rustc_codegen_ssadoes pass the Rust type of each input, so this has a relatively simple fix (just need to open a PR for it)Images), not dataasm!) e.g.MaybeUninit<SomeHandle>(newtype unpacking of this is messy due to
MaybeUninit<T>containingManuallyDrop<T>, more than anything else, but now that typed GEP is gone, we can more aggressively unpack newtypes and disallowrustc_codegen_ssagivingstructfield constant indices, only at most dynamic array indices)qptrwouldn't accept the size & alignment form for handlesexternref, i.e.!Pointeein e.g.:Hierarchy of Sized traits rust-lang/rfcs#3729