mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Emit optimized code for `dot4{I, U}8Packed` regardless of SPIR-V version
as long as the required capabilities are available. On SPIR-V < 1.6,
require the extension "SPV_KHR_integer_dot_product" for this. On
SPIR-V >= 1.6, don't require the extension because the corresponding
capabilities are part of SPIR-V >= 1.6 proper.
20 lines
452 B
WebGPU Shading Language
20 lines
452 B
WebGPU Shading Language
fn test_packed_integer_dot_product() -> u32 {
|
|
let a_5 = 1u;
|
|
let b_5 = 2u;
|
|
let c_5: i32 = dot4I8Packed(a_5, b_5);
|
|
|
|
let a_6 = 3u;
|
|
let b_6 = 4u;
|
|
let c_6: u32 = dot4U8Packed(a_6, b_6);
|
|
|
|
// test baking of arguments
|
|
let c_7: i32 = dot4I8Packed(5u + c_6, 6u + c_6);
|
|
let c_8: u32 = dot4U8Packed(7u + c_6, 8u + c_6);
|
|
return c_8;
|
|
}
|
|
|
|
@compute @workgroup_size(1)
|
|
fn main() {
|
|
let c = test_packed_integer_dot_product();
|
|
}
|