-
Notifications
You must be signed in to change notification settings - Fork 246
Closed
Labels
a: simdIssues involving Single Instruction Multiple Data instructions.Issues involving Single Instruction Multiple Data instructions.t: designDesign of our rust-gpu language and stdDesign of our rust-gpu language and stdt: good first issueGood for newcomersGood for newcomers
Description
spir-v has vector types that are dramatically useful on e.g. nvidia hardware for optimizing loads/stores. At first, let's just directly expose vector types, instead of trying to do things like auto-vectorization.
- Rustc already has the notion of vector types, and we directly translate them to spir-v vector types. We need to investigate under what conditions rustc emits vector types, and if we can re-use the same framework.
rust-gpu/rustc_codegen_spirv/src/abi.rs
Lines 332 to 339 in 9697c22
Abi::Vector { ref element, count } => { let elem_spirv = trans_scalar(cx, ty, element, None, is_immediate); SpirvType::Vector { element: elem_spirv, count: count as u32, } .def(cx) } - If we cannot re-use the same framework, create an attribute to specify a type is a builtin vector, recognize the attribute in
abi.rs
(example for storage classes), and emit a vector type. Perhaps do a mix of the two, e.g. if rust supports f32x2 and f32x4, but not f32x3, then we need to define our own f32x3. - Investigate the spec: is emitting a spir-v "OpTypeVector" enough, or are there additional decorations/etc. we need to apply to get it to be a proper "vector type"?
SpirvType::Vector { element, count } => cx.emit_global().type_vector(element, count), - Implement the above in
spirv-std
, adding things like swizzling ops and other shenanigans (can come later).
This seems like a good not-quite-first-but-kinda-first task for someone other than me to do. Step 2 is a little involved and will likely need some mentorship - abi.rs
is hecking wild - but getting more people who know how abi.rs
works would be really really good.
Metadata
Metadata
Assignees
Labels
a: simdIssues involving Single Instruction Multiple Data instructions.Issues involving Single Instruction Multiple Data instructions.t: designDesign of our rust-gpu language and stdDesign of our rust-gpu language and stdt: good first issueGood for newcomersGood for newcomers