Rust-GPU / Rust-GPU/rust-gpu

Tracking issue: undo `rustc_codegen_ssa` patching (aka `pqp_cg_ssa`).

Abierto
#182 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

tracking
Lenguaje dominante
Rust
Estrellas
3.4k
Forks
126
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

PR that introduced rustc_codegen_ssa patching (aka pqp_cg_ssa):

Legitimate solutions are needed, to replace the patching "hack"arounds:

  • (easy?) transition away from #[repr(simd)] for SPIR-V vector types
    • easy version: use #[spirv(vector)] as a replacement
      • worst part is glam would need to depend on spirv-std-macros
      • however, it does unlock glam using #[spirv(matrix)], too!
    • hard version: actually rely on core::simd::Simd<T, N>
      • glam already has some features for this but only for some types
        (and largely as an optimization, i.e. accelerating operations)
      • glam needs to cast &Simd<T, 2> to &struct { x: T, y: T }
        (with #[repr(C)] on the latter struct, this is 100% defined)
      • without some hacky special-cases, qptr may be required for this
  • (hard) support untyped function-local variables (alloca in LLVM terms)
    • see https://github.com/rust-lang/rust/pull/122053
      (instead of a type, creating a variable now takes only size & alignment)
    • (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
      • ideal solution looks more like wasm externref, i.e. !Pointee in e.g.:
        https://github.com/rust-lang/rfcs/pull/3729

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza leyendo PR 170 y revisando el parcheado de rustc_codegen_ssa descrito allí; después, revisa el trabajo listado en torno a #[repr(simd)], las variables locales de función sin tipo, la inferencia de tipos de asm! y las variables handle. El issue solo estará completo cuando reemplazos legítimos eliminen los hacks de parcheado de pqp_cg_ssa, pero no identifica una ruta de implementación o de pruebas acotada.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
rust
Área
compilers
Tipo de issue
Refactorización
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
20/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.