From 57bd1b0ae3ab74130ae5e1f2acab2b32cedd173b Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Thu, 29 Feb 2024 12:43:12 -0500 Subject: [PATCH] wgsl: Implement i32 & u32 `dot` execution tests (#3411) Fixes #2516 Fixes #2515 --- src/resources/cache/hashes.json | 214 +++++++++--------- .../cache/webgpu/shader/execution/dot.bin | Bin 333216 -> 374808 bytes src/webgpu/listing_meta.json | 10 +- .../expression/call/builtin/dot.cache.ts | 33 ++- .../expression/call/builtin/dot.spec.ts | 111 ++++++++- .../shader/execution/expression/case.ts | 28 +++ src/webgpu/util/math.ts | 64 ++++++ 7 files changed, 340 insertions(+), 120 deletions(-) diff --git a/src/resources/cache/hashes.json b/src/resources/cache/hashes.json index 27945b7a4a71..8acfa8e5cd9e 100644 --- a/src/resources/cache/hashes.json +++ b/src/resources/cache/hashes.json @@ -1,109 +1,109 @@ { - "webgpu/shader/execution/binary/af_addition.bin": "5067132e", - "webgpu/shader/execution/binary/af_logical.bin": "a7bde13e", - "webgpu/shader/execution/binary/af_division.bin": "19678742", - "webgpu/shader/execution/binary/af_matrix_addition.bin": "42689934", - "webgpu/shader/execution/binary/af_matrix_subtraction.bin": "c6322f74", - "webgpu/shader/execution/binary/af_multiplication.bin": "5f12d793", - "webgpu/shader/execution/binary/af_remainder.bin": "df05ecb8", - "webgpu/shader/execution/binary/af_subtraction.bin": "a13ed62f", - "webgpu/shader/execution/binary/f16_addition.bin": "14e49495", - "webgpu/shader/execution/binary/f16_logical.bin": "9e733738", - "webgpu/shader/execution/binary/f16_division.bin": "f42b09dc", - "webgpu/shader/execution/binary/f16_matrix_addition.bin": "517b60f1", - "webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "66a87207", - "webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "a9c3e5f1", - "webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "f2a25933", - "webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "a886a0b5", - "webgpu/shader/execution/binary/f16_multiplication.bin": "be77033b", - "webgpu/shader/execution/binary/f16_remainder.bin": "50b0b02", - "webgpu/shader/execution/binary/f16_subtraction.bin": "93f65d9", - "webgpu/shader/execution/binary/f32_addition.bin": "278d2454", - "webgpu/shader/execution/binary/f32_logical.bin": "55bcf58e", - "webgpu/shader/execution/binary/f32_division.bin": "3a457201", - "webgpu/shader/execution/binary/f32_matrix_addition.bin": "660aad6a", - "webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "a278509a", - "webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "ace2da73", - "webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "8f986eff", - "webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "c26e2700", - "webgpu/shader/execution/binary/f32_multiplication.bin": "4cdfcb27", - "webgpu/shader/execution/binary/f32_remainder.bin": "e3119b6d", - "webgpu/shader/execution/binary/f32_subtraction.bin": "d71a5a86", - "webgpu/shader/execution/binary/i32_arithmetic.bin": "b880610d", - "webgpu/shader/execution/binary/i32_comparison.bin": "f2f668b2", - "webgpu/shader/execution/binary/u32_arithmetic.bin": "164ebf51", - "webgpu/shader/execution/binary/u32_comparison.bin": "35a31af1", - "webgpu/shader/execution/abs.bin": "ec6cc570", - "webgpu/shader/execution/acos.bin": "d61bb028", - "webgpu/shader/execution/acosh.bin": "609af763", - "webgpu/shader/execution/asin.bin": "64bf727b", - "webgpu/shader/execution/asinh.bin": "273b8028", - "webgpu/shader/execution/atan.bin": "f6384fbb", - "webgpu/shader/execution/atan2.bin": "64163f99", - "webgpu/shader/execution/atanh.bin": "bacbfd59", - "webgpu/shader/execution/bitcast.bin": "4a0d7d41", - "webgpu/shader/execution/ceil.bin": "48020ceb", - "webgpu/shader/execution/clamp.bin": "402bf6c9", - "webgpu/shader/execution/cos.bin": "6b4d2358", - "webgpu/shader/execution/cosh.bin": "dccbe75f", - "webgpu/shader/execution/cross.bin": "a550a630", - "webgpu/shader/execution/degrees.bin": "72d5163b", - "webgpu/shader/execution/determinant.bin": "f1378c53", - "webgpu/shader/execution/distance.bin": "48ee3f00", - "webgpu/shader/execution/dot.bin": "d2f81d75", - "webgpu/shader/execution/exp.bin": "36af62ed", - "webgpu/shader/execution/exp2.bin": "8675703d", - "webgpu/shader/execution/faceForward.bin": "568cc6b8", - "webgpu/shader/execution/floor.bin": "e7ab0a1e", - "webgpu/shader/execution/fma.bin": "3b4ebf3f", - "webgpu/shader/execution/fract.bin": "130ceb8a", - "webgpu/shader/execution/frexp.bin": "a5868197", - "webgpu/shader/execution/inverseSqrt.bin": "e2a63a07", - "webgpu/shader/execution/ldexp.bin": "62948ba1", - "webgpu/shader/execution/length.bin": "ce1440e5", - "webgpu/shader/execution/log.bin": "69b69fa1", - "webgpu/shader/execution/log2.bin": "dc5c999d", - "webgpu/shader/execution/max.bin": "58fc2b9a", - "webgpu/shader/execution/min.bin": "84eec3dd", - "webgpu/shader/execution/mix.bin": "8c176bc2", - "webgpu/shader/execution/modf.bin": "9fcb3629", - "webgpu/shader/execution/normalize.bin": "4bf45f2a", - "webgpu/shader/execution/pack2x16float.bin": "74aac2f5", - "webgpu/shader/execution/pow.bin": "976aaac6", - "webgpu/shader/execution/quantizeToF16.bin": "9b60dec9", - "webgpu/shader/execution/radians.bin": "f37fa7ad", - "webgpu/shader/execution/reflect.bin": "d0da3a14", - "webgpu/shader/execution/refract.bin": "f426dd6e", - "webgpu/shader/execution/round.bin": "ffc365ff", - "webgpu/shader/execution/saturate.bin": "253ffcc7", - "webgpu/shader/execution/sign.bin": "ee72deed", - "webgpu/shader/execution/sin.bin": "c685df75", - "webgpu/shader/execution/sinh.bin": "404bade3", - "webgpu/shader/execution/smoothstep.bin": "4631743e", - "webgpu/shader/execution/sqrt.bin": "29d895f1", - "webgpu/shader/execution/step.bin": "e246e2ed", - "webgpu/shader/execution/tan.bin": "37d5e55c", - "webgpu/shader/execution/tanh.bin": "4964f0af", - "webgpu/shader/execution/transpose.bin": "c0688654", - "webgpu/shader/execution/trunc.bin": "29a4bedf", - "webgpu/shader/execution/unpack2x16float.bin": "45a53d8d", - "webgpu/shader/execution/unpack2x16snorm.bin": "827b024f", - "webgpu/shader/execution/unpack2x16unorm.bin": "dc1bd85a", - "webgpu/shader/execution/unpack4x8snorm.bin": "f9525320", - "webgpu/shader/execution/unpack4x8unorm.bin": "27facc7f", - "webgpu/shader/execution/unary/af_arithmetic.bin": "213bf535", - "webgpu/shader/execution/unary/af_assignment.bin": "7d092411", - "webgpu/shader/execution/unary/bool_conversion.bin": "ef64f29e", - "webgpu/shader/execution/unary/f16_arithmetic.bin": "e7a930c", - "webgpu/shader/execution/unary/f16_conversion.bin": "ed0ad482", - "webgpu/shader/execution/unary/f32_arithmetic.bin": "e32dcdbd", - "webgpu/shader/execution/unary/f32_conversion.bin": "b0b23a1a", - "webgpu/shader/execution/unary/i32_arithmetic.bin": "5a180128", - "webgpu/shader/execution/unary/i32_complement.bin": "7266637b", - "webgpu/shader/execution/unary/i32_conversion.bin": "5f788044", - "webgpu/shader/execution/unary/u32_complement.bin": "44efa30e", - "webgpu/shader/execution/unary/u32_conversion.bin": "d9aec403", - "webgpu/shader/execution/unary/ai_assignment.bin": "cb574671", - "webgpu/shader/execution/binary/ai_arithmetic.bin": "9c9ef2a4", - "webgpu/shader/execution/unary/ai_arithmetic.bin": "6fadb5ac" + "webgpu/shader/execution/binary/af_addition.bin": "bbc5103c", + "webgpu/shader/execution/binary/af_logical.bin": "a483b968", + "webgpu/shader/execution/binary/af_division.bin": "7c221c28", + "webgpu/shader/execution/binary/af_matrix_addition.bin": "ebab2b30", + "webgpu/shader/execution/binary/af_matrix_subtraction.bin": "6078475c", + "webgpu/shader/execution/binary/af_multiplication.bin": "66ad501", + "webgpu/shader/execution/binary/af_remainder.bin": "5a87ed27", + "webgpu/shader/execution/binary/af_subtraction.bin": "66bad739", + "webgpu/shader/execution/binary/f16_addition.bin": "3ff7fed3", + "webgpu/shader/execution/binary/f16_logical.bin": "b89ca9b9", + "webgpu/shader/execution/binary/f16_division.bin": "a01c2499", + "webgpu/shader/execution/binary/f16_matrix_addition.bin": "cb64b0b6", + "webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "edbbdd7b", + "webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "f5ded61d", + "webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "11ad421b", + "webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "5ef65699", + "webgpu/shader/execution/binary/f16_multiplication.bin": "24c6a56f", + "webgpu/shader/execution/binary/f16_remainder.bin": "d47a8347", + "webgpu/shader/execution/binary/f16_subtraction.bin": "755f4b0b", + "webgpu/shader/execution/binary/f32_addition.bin": "6db93d07", + "webgpu/shader/execution/binary/f32_logical.bin": "c7370c09", + "webgpu/shader/execution/binary/f32_division.bin": "c28058b5", + "webgpu/shader/execution/binary/f32_matrix_addition.bin": "3f49bac9", + "webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "592cc2c4", + "webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "e3750b3c", + "webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "b16d21e2", + "webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "c982cd63", + "webgpu/shader/execution/binary/f32_multiplication.bin": "835ec6ee", + "webgpu/shader/execution/binary/f32_remainder.bin": "daf70203", + "webgpu/shader/execution/binary/f32_subtraction.bin": "2fc781f8", + "webgpu/shader/execution/binary/i32_arithmetic.bin": "a0b0a016", + "webgpu/shader/execution/binary/i32_comparison.bin": "f3d9b3f9", + "webgpu/shader/execution/binary/u32_arithmetic.bin": "16e32fd", + "webgpu/shader/execution/binary/u32_comparison.bin": "da33cc5d", + "webgpu/shader/execution/abs.bin": "e8dce87a", + "webgpu/shader/execution/acos.bin": "2762bad", + "webgpu/shader/execution/acosh.bin": "a3b96c53", + "webgpu/shader/execution/asin.bin": "1d9d590", + "webgpu/shader/execution/asinh.bin": "c2cc05", + "webgpu/shader/execution/atan.bin": "3f701bba", + "webgpu/shader/execution/atan2.bin": "559fb65a", + "webgpu/shader/execution/atanh.bin": "6d352d21", + "webgpu/shader/execution/bitcast.bin": "ec72fa7", + "webgpu/shader/execution/ceil.bin": "42f80be0", + "webgpu/shader/execution/clamp.bin": "1440b818", + "webgpu/shader/execution/cos.bin": "c5da20d", + "webgpu/shader/execution/cosh.bin": "a01e8091", + "webgpu/shader/execution/cross.bin": "c756d650", + "webgpu/shader/execution/degrees.bin": "2c481603", + "webgpu/shader/execution/determinant.bin": "1e67d0f3", + "webgpu/shader/execution/distance.bin": "9a305a9d", + "webgpu/shader/execution/dot.bin": "1a3853b8", + "webgpu/shader/execution/exp.bin": "11112dba", + "webgpu/shader/execution/exp2.bin": "583e9c6a", + "webgpu/shader/execution/faceForward.bin": "7528aff7", + "webgpu/shader/execution/floor.bin": "96044530", + "webgpu/shader/execution/fma.bin": "8e795844", + "webgpu/shader/execution/fract.bin": "997d1bb5", + "webgpu/shader/execution/frexp.bin": "4a1efc69", + "webgpu/shader/execution/inverseSqrt.bin": "3e7d725", + "webgpu/shader/execution/ldexp.bin": "79646a61", + "webgpu/shader/execution/length.bin": "177f62e6", + "webgpu/shader/execution/log.bin": "4e0f535c", + "webgpu/shader/execution/log2.bin": "a961449", + "webgpu/shader/execution/max.bin": "3d764667", + "webgpu/shader/execution/min.bin": "c02f865", + "webgpu/shader/execution/mix.bin": "9431b1b0", + "webgpu/shader/execution/modf.bin": "1fdcef82", + "webgpu/shader/execution/normalize.bin": "78dd7ec5", + "webgpu/shader/execution/pack2x16float.bin": "e6859c1a", + "webgpu/shader/execution/pow.bin": "4877dcfb", + "webgpu/shader/execution/quantizeToF16.bin": "c80d80ea", + "webgpu/shader/execution/radians.bin": "ac062ec8", + "webgpu/shader/execution/reflect.bin": "a4e70e5a", + "webgpu/shader/execution/refract.bin": "2ca0bc97", + "webgpu/shader/execution/round.bin": "3471eaad", + "webgpu/shader/execution/saturate.bin": "5bb3dced", + "webgpu/shader/execution/sign.bin": "5b54134", + "webgpu/shader/execution/sin.bin": "c5bb923c", + "webgpu/shader/execution/sinh.bin": "122dba1b", + "webgpu/shader/execution/smoothstep.bin": "91223043", + "webgpu/shader/execution/sqrt.bin": "e630cb4e", + "webgpu/shader/execution/step.bin": "a3349b96", + "webgpu/shader/execution/tan.bin": "ecc23f5e", + "webgpu/shader/execution/tanh.bin": "96c30607", + "webgpu/shader/execution/transpose.bin": "8968d6f9", + "webgpu/shader/execution/trunc.bin": "6c17efc2", + "webgpu/shader/execution/unpack2x16float.bin": "f035f149", + "webgpu/shader/execution/unpack2x16snorm.bin": "e92a1762", + "webgpu/shader/execution/unpack2x16unorm.bin": "abe4e594", + "webgpu/shader/execution/unpack4x8snorm.bin": "9bb9c594", + "webgpu/shader/execution/unpack4x8unorm.bin": "53ceebc", + "webgpu/shader/execution/unary/af_arithmetic.bin": "cd5b7fa3", + "webgpu/shader/execution/unary/af_assignment.bin": "86b66309", + "webgpu/shader/execution/unary/bool_conversion.bin": "dd71f171", + "webgpu/shader/execution/unary/f16_arithmetic.bin": "9537b14", + "webgpu/shader/execution/unary/f16_conversion.bin": "3948e7eb", + "webgpu/shader/execution/unary/f32_arithmetic.bin": "f8aa7493", + "webgpu/shader/execution/unary/f32_conversion.bin": "7ee18c9e", + "webgpu/shader/execution/unary/i32_arithmetic.bin": "c69716e2", + "webgpu/shader/execution/unary/i32_complement.bin": "70c49c98", + "webgpu/shader/execution/unary/i32_conversion.bin": "83218e69", + "webgpu/shader/execution/unary/u32_complement.bin": "84f3d299", + "webgpu/shader/execution/unary/u32_conversion.bin": "8f5bad00", + "webgpu/shader/execution/unary/ai_assignment.bin": "c7e6ac33", + "webgpu/shader/execution/binary/ai_arithmetic.bin": "81c11ec2", + "webgpu/shader/execution/unary/ai_arithmetic.bin": "3d27dc97" } \ No newline at end of file diff --git a/src/resources/cache/webgpu/shader/execution/dot.bin b/src/resources/cache/webgpu/shader/execution/dot.bin index 9783146bff44d8a11d19009a3e06a4db3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T zaIweQx-r1AeRP`4am^T3?wG-?0z4RF<3r7Ai~0O-GIqT(1h?K@W{%kf4{)+BL_W~e zb)oE^V!v{FambKgMQq#6?f8D*vhh6e49x!sp3ndG23)bY`S@{v%Y2V-y|G{M6bC6k zRmQ5~`bTON-QIzJ`NlG5c+bvWC7~sr{<9J>gqX29&&;MhO7|>QC zpzsdg*97tH@me9Xhb03gUko_3ocVLxw?GYI1&G&-6(8Rd|8;nY6|Lvt-xdq@j2^Jn z?%$q11H|57!)t|p9=0pIR*1eh*u6wCfKVdhuq^AfZ%;2AWS|v#R`BusH5Dpqpe3>l;lxFxc&!kiL&l1i3YC-gSPf!{ zS)rqhqdoEb#~1b&xi7Yh+)sICbTe)@x9wL1>Zz@bDb(`v;#H#S?8XApQtZlY?$EDN z_DaucII*MLHuSbPOYlqxieb~q3!qmxbLbVYc&c6fJqt++bP05Kj4qg8j4iXvia1;# zSj5aQD%MJa~G z&x$xcx)}YPnHmi_#xNen`7=^PC0`UVfu==74#SjWc3BYzVX%mqp%#cm)M8|IdW?1- zU({l$MEsqPAww prev + Math.imul(x[idx], y[idx]), 0); +} + // Cases: [f32|f16]_vecN_[non_]const const float_cases = (['f32', 'f16'] as const) .flatMap(trait => @@ -75,6 +88,24 @@ const cases = { abstract_int_vec4: () => { return generateVectorVectorToI64Cases(sparseVectorI64Range(4), sparseVectorI64Range(4), ai_dot); }, + i32_vec2: () => { + return generateVectorVectorToI32Cases(vectorI32Range(2), vectorI32Range(2), ci_dot); + }, + i32_vec3: () => { + return generateVectorVectorToI32Cases(sparseVectorI32Range(3), sparseVectorI32Range(3), ci_dot); + }, + i32_vec4: () => { + return generateVectorVectorToI32Cases(sparseVectorI32Range(4), sparseVectorI32Range(4), ci_dot); + }, + u32_vec2: () => { + return generateVectorVectorToU32Cases(vectorU32Range(2), vectorU32Range(2), ci_dot); + }, + u32_vec3: () => { + return generateVectorVectorToU32Cases(sparseVectorU32Range(3), sparseVectorU32Range(3), ci_dot); + }, + u32_vec4: () => { + return generateVectorVectorToU32Cases(sparseVectorU32Range(4), sparseVectorU32Range(4), ci_dot); + }, }; export const d = makeCaseCache('dot', cases); diff --git a/src/webgpu/shader/execution/expression/call/builtin/dot.spec.ts b/src/webgpu/shader/execution/expression/call/builtin/dot.spec.ts index 6e9eb18b558e..5d27e5044dea 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/dot.spec.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/dot.spec.ts @@ -8,7 +8,14 @@ Returns the dot product of e1 and e2. import { makeTestGroup } from '../../../../../../common/framework/test_group.js'; import { GPUTest } from '../../../../../gpu_test.js'; -import { TypeAbstractInt, TypeF16, TypeF32, TypeVec } from '../../../../../util/conversion.js'; +import { + TypeAbstractInt, + TypeF16, + TypeF32, + TypeI32, + TypeU32, + TypeVec, +} from '../../../../../util/conversion.js'; import { allInputSources, onlyConstInputSource, run } from '../../expression.js'; import { abstractIntBuiltin, builtin } from './builtin.js'; @@ -18,7 +25,7 @@ export const g = makeTestGroup(GPUTest); g.test('abstract_int_vec2') .specURL('https://www.w3.org/TR/WGSL/#vector-builtin-functions') - .desc(`abstract float tests using vec2s`) + .desc(`abstract integer tests using vec2s`) .params(u => u.combine('inputSource', onlyConstInputSource)) .fn(async t => { const cases = await d.get('abstract_int_vec2'); @@ -34,7 +41,7 @@ g.test('abstract_int_vec2') g.test('abstract_int_vec3') .specURL('https://www.w3.org/TR/WGSL/#vector-builtin-functions') - .desc(`abstract float tests using vec3s`) + .desc(`abstract integer tests using vec3s`) .params(u => u.combine('inputSource', onlyConstInputSource)) .fn(async t => { const cases = await d.get('abstract_int_vec3'); @@ -50,7 +57,7 @@ g.test('abstract_int_vec3') g.test('abstract_int_vec4') .specURL('https://www.w3.org/TR/WGSL/#vector-builtin-functions') - .desc(`abstract float tests using vec4s`) + .desc(`abstract integer tests using vec4s`) .params(u => u.combine('inputSource', onlyConstInputSource)) .fn(async t => { const cases = await d.get('abstract_int_vec4'); @@ -64,17 +71,101 @@ g.test('abstract_int_vec4') ); }); -g.test('i32') +g.test('i32_vec2') .specURL('https://www.w3.org/TR/WGSL/#vector-builtin-functions') - .desc(`i32 tests`) + .desc(`i32 tests using vec2s`) .params(u => u.combine('inputSource', allInputSources)) - .unimplemented(); + .fn(async t => { + const cases = await d.get('i32_vec2'); + await run( + t, + builtin('dot'), + [TypeVec(2, TypeI32), TypeVec(2, TypeI32)], + TypeI32, + t.params, + cases + ); + }); -g.test('u32') +g.test('i32_vec3') .specURL('https://www.w3.org/TR/WGSL/#vector-builtin-functions') - .desc(`u32 tests`) + .desc(`i32 tests using vec3s`) .params(u => u.combine('inputSource', allInputSources)) - .unimplemented(); + .fn(async t => { + const cases = await d.get('i32_vec3'); + await run( + t, + builtin('dot'), + [TypeVec(3, TypeI32), TypeVec(3, TypeI32)], + TypeI32, + t.params, + cases + ); + }); + +g.test('i32_vec4') + .specURL('https://www.w3.org/TR/WGSL/#vector-builtin-functions') + .desc(`i32 tests using vec4s`) + .params(u => u.combine('inputSource', allInputSources)) + .fn(async t => { + const cases = await d.get('i32_vec4'); + await run( + t, + builtin('dot'), + [TypeVec(4, TypeI32), TypeVec(4, TypeI32)], + TypeI32, + t.params, + cases + ); + }); + +g.test('u32_vec2') + .specURL('https://www.w3.org/TR/WGSL/#vector-builtin-functions') + .desc(`u32 tests using vec2s`) + .params(u => u.combine('inputSource', allInputSources)) + .fn(async t => { + const cases = await d.get('u32_vec2'); + await run( + t, + builtin('dot'), + [TypeVec(2, TypeU32), TypeVec(2, TypeU32)], + TypeU32, + t.params, + cases + ); + }); + +g.test('u32_vec3') + .specURL('https://www.w3.org/TR/WGSL/#vector-builtin-functions') + .desc(`u32 tests using vec3s`) + .params(u => u.combine('inputSource', allInputSources)) + .fn(async t => { + const cases = await d.get('u32_vec3'); + await run( + t, + builtin('dot'), + [TypeVec(3, TypeU32), TypeVec(3, TypeU32)], + TypeU32, + t.params, + cases + ); + }); + +g.test('u32_vec4') + .specURL('https://www.w3.org/TR/WGSL/#vector-builtin-functions') + .desc(`u32 tests using vec4s`) + .params(u => u.combine('inputSource', allInputSources)) + .fn(async t => { + const cases = await d.get('u32_vec4'); + await run( + t, + builtin('dot'), + [TypeVec(4, TypeU32), TypeVec(4, TypeU32)], + TypeU32, + t.params, + cases + ); + }); g.test('abstract_float') .specURL('https://www.w3.org/TR/WGSL/#vector-builtin-functions') diff --git a/src/webgpu/shader/execution/expression/case.ts b/src/webgpu/shader/execution/expression/case.ts index 1f79b003a833..1cbde7be754f 100644 --- a/src/webgpu/shader/execution/expression/case.ts +++ b/src/webgpu/shader/execution/expression/case.ts @@ -348,6 +348,34 @@ function generateVectorVectorToScalarCases( }); } +/** + * @returns array of Case for the input params with op applied + * @param param0s array of vector params (2, 3, or 4 elements) for the first param + * @param param1s array of vector params (2, 3, or 4 elements) for the second param + * @param op the op to apply to each pair of vectors + */ +export function generateVectorVectorToI32Cases( + param0s: ROArrayArray, + param1s: ROArrayArray, + op: VectorVectorToScalarOp +): Case[] { + return generateVectorVectorToScalarCases(param0s, param1s, op, quantizeToI32, i32); +} + +/** + * @returns array of Case for the input params with op applied + * @param param0s array of vector params (2, 3, or 4 elements) for the first param + * @param param1s array of vector params (2, 3, or 4 elements) for the second param + * @param op the op to apply to each pair of vectors + */ +export function generateVectorVectorToU32Cases( + param0s: ROArrayArray, + param1s: ROArrayArray, + op: VectorVectorToScalarOp +): Case[] { + return generateVectorVectorToScalarCases(param0s, param1s, op, quantizeToU32, u32); +} + /** * @returns array of Case for the input params with op applied * @param param0s array of vector params (2, 3, or 4 elements) for the first param diff --git a/src/webgpu/util/math.ts b/src/webgpu/util/math.ts index 090fcf0fe208..45ea48557b89 100644 --- a/src/webgpu/util/math.ts +++ b/src/webgpu/util/math.ts @@ -1204,6 +1204,38 @@ export function vectorI32Range(dim: number): ROArrayArray { return kVectorI32Values[dim]; } +const kSparseVectorI32Values = { + 2: sparseI32Range().map((i, idx) => [idx % 2 === 0 ? i : idx, idx % 2 === 1 ? i : -idx]), + 3: sparseI32Range().map((i, idx) => [ + idx % 3 === 0 ? i : idx, + idx % 3 === 1 ? i : -idx, + idx % 3 === 2 ? i : idx, + ]), + 4: sparseI32Range().map((i, idx) => [ + idx % 4 === 0 ? i : idx, + idx % 4 === 1 ? i : -idx, + idx % 4 === 2 ? i : idx, + idx % 4 === 3 ? i : -idx, + ]), +}; + +/** + * Minimal set of vectors, indexed by dimension, that contain interesting + * abstract integer values. + * + * This is an even more stripped down version of `vectorI32Range` for when + * pairs of vectors are being tested. + * All interesting integers from sparseI32Range are guaranteed to be + * tested, but not in every position. + */ +export function sparseVectorI32Range(dim: number): ROArrayArray { + assert( + dim === 2 || dim === 3 || dim === 4, + 'sparseVectorI32Range only accepts dimensions 2, 3, and 4' + ); + return kSparseVectorI32Values[dim]; +} + /** * @returns an ascending sorted array of numbers spread over the entire range of 32-bit signed ints * @@ -1282,6 +1314,38 @@ export function vectorU32Range(dim: number): ROArrayArray { return kVectorU32Values[dim]; } +const kSparseVectorU32Values = { + 2: sparseU32Range().map((i, idx) => [idx % 2 === 0 ? i : idx, idx % 2 === 1 ? i : -idx]), + 3: sparseU32Range().map((i, idx) => [ + idx % 3 === 0 ? i : idx, + idx % 3 === 1 ? i : -idx, + idx % 3 === 2 ? i : idx, + ]), + 4: sparseU32Range().map((i, idx) => [ + idx % 4 === 0 ? i : idx, + idx % 4 === 1 ? i : -idx, + idx % 4 === 2 ? i : idx, + idx % 4 === 3 ? i : -idx, + ]), +}; + +/** + * Minimal set of vectors, indexed by dimension, that contain interesting + * abstract integer values. + * + * This is an even more stripped down version of `vectorU32Range` for when + * pairs of vectors are being tested. + * All interesting integers from sparseU32Range are guaranteed to be + * tested, but not in every position. + */ +export function sparseVectorU32Range(dim: number): ROArrayArray { + assert( + dim === 2 || dim === 3 || dim === 4, + 'sparseVectorU32Range only accepts dimensions 2, 3, and 4' + ); + return kSparseVectorU32Values[dim]; +} + /** * @returns an ascending sorted array of numbers spread over the entire range of 32-bit unsigned ints *