Tracking issue: undo `rustc_codegen_ssa` patching (aka `pqp_cg_ssa`).
オープン
まだ誰も着手していません。
tracking
- 主要言語
- Rust
- スター
- 3.4k
- フォーク
- 126
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
PR that introduced rustc_codegen_ssa patching (aka pqp_cg_ssa):
- https://github.com/Rust-GPU/rust-gpu/pull/170
(its description goes into much more detail)
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
glamwould need to depend onspirv-std-macros - however, it does unlock
glamusing#[spirv(matrix)], too!
- worst part is
- hard version: actually rely on
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)- without some hacky special-cases,
qptrmay be required for this
- easy version: use
- (hard) support untyped function-local variables (
allocain 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
qptrbranches 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-
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 "fieldNof structS", and borderline reimplement theqptrtype recovery algorithm)
- would be subsumed by
- inline
asm!typeof*/type inference- sadly needed because we can't use normal value
in/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) - thankfully,
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)
- sadly needed because we can't use normal value
- 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 toMaybeUninit<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) - even
qptrwouldn'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.!Pointeein e.g.:
https://github.com/rust-lang/rfcs/pull/3729
- also needs to allow (for
- see https://github.com/rust-lang/rust/pull/122053
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず PR 170 と、そこで説明されている rustc_codegen_ssa のパッチ適用を読み、その後、#[repr(simd)]、型指定のない関数ローカル変数、asm! の型推論、handle 変数に関して列挙されている作業を確認してください。正当な置き換えによって pqp_cg_ssa のパッチ適用ハックが削除された時点で issue は完了となりますが、範囲を限定した実装またはテストの進め方は特定されていません。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- rust
- 領域
- compilers
- issue の種類
- リファクタリング
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 20/100