-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vector types #34
Comments
Possibly relevant: https://github.com/hsivonen/simd/blob/045d4dae4e65f99fd43cd9042f5132812cae717e/src/lib.rs#L75-L79 #![feature(repr_simd)]
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy)]
#[repr(simd)]
pub struct f32x4(f32, f32, f32, f32); |
It looks like item 2 is not necessary - seems like f32x4 is already implemented in spirv-std by copying the above type, but it's just that, and needs all the impls and operators and whatnot (as well as all the other types). Defining all that repitition using macros seems neat. |
Hi, I would be interested with working on this. From what I understand in this thread, the first thing to do would be to write the operators and impls for f32x4 using macros? |
Awesome! This issue is a bit out of date, though: #71 added quite a few vector items. However, it wasn't very cleanly or thoroughly implemented, and needs significant work. Some tasks remaining are:
|
Sure. I'll ping you on #rust-gpu on Discord. |
With glam and whatnot in, this is pretty much resolved. |
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.
rust-gpu/rustc_codegen_spirv/src/abi.rs
Lines 332 to 339 in 9697c22
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.rust-gpu/rustc_codegen_spirv/src/spirv_type.rs
Line 166 in 9697c22
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 howabi.rs
works would be really really good.The text was updated successfully, but these errors were encountered: