-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wgsl: Implement AbstractFloat matrix multiplcation tests (#3446)
Adds in a hash based filtering utility for reducing number of test cases being generated. Issue #1626
- Loading branch information
Showing
14 changed files
with
496 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,110 @@ | ||
{ | ||
"webgpu/shader/execution/binary/af_addition.bin": "38b261fa", | ||
"webgpu/shader/execution/binary/af_logical.bin": "a483b968", | ||
"webgpu/shader/execution/binary/af_division.bin": "ec39b0da", | ||
"webgpu/shader/execution/binary/af_matrix_addition.bin": "ca1373a8", | ||
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "406d99af", | ||
"webgpu/shader/execution/binary/af_multiplication.bin": "2eb6d50d", | ||
"webgpu/shader/execution/binary/af_remainder.bin": "e2b6b21", | ||
"webgpu/shader/execution/binary/af_subtraction.bin": "84794350", | ||
"webgpu/shader/execution/binary/f16_addition.bin": "19e8823d", | ||
"webgpu/shader/execution/binary/f16_logical.bin": "b89ca9b9", | ||
"webgpu/shader/execution/binary/f16_division.bin": "6dc4b748", | ||
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "7533842", | ||
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "2d799920", | ||
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "44e3b295", | ||
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "412f0911", | ||
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "a231201b", | ||
"webgpu/shader/execution/binary/f16_multiplication.bin": "94b11030", | ||
"webgpu/shader/execution/binary/f16_remainder.bin": "de68a200", | ||
"webgpu/shader/execution/binary/f16_subtraction.bin": "f308327a", | ||
"webgpu/shader/execution/binary/f32_addition.bin": "c87c8c08", | ||
"webgpu/shader/execution/binary/f32_logical.bin": "c7370c09", | ||
"webgpu/shader/execution/binary/f32_division.bin": "34ce65ae", | ||
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "f3808d0c", | ||
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "e33e7fe5", | ||
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "41091ebf", | ||
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "37ccb101", | ||
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "4d67866", | ||
"webgpu/shader/execution/binary/f32_multiplication.bin": "5d85a36c", | ||
"webgpu/shader/execution/binary/f32_remainder.bin": "62f591b2", | ||
"webgpu/shader/execution/binary/f32_subtraction.bin": "60fc275a", | ||
"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": "1ead834c", | ||
"webgpu/shader/execution/acos.bin": "e25802ba", | ||
"webgpu/shader/execution/acosh.bin": "2321726f", | ||
"webgpu/shader/execution/asin.bin": "d554a73b", | ||
"webgpu/shader/execution/asinh.bin": "d2bdb21b", | ||
"webgpu/shader/execution/atan.bin": "eb6476f3", | ||
"webgpu/shader/execution/atan2.bin": "cf15e7fa", | ||
"webgpu/shader/execution/atanh.bin": "6c57cc3", | ||
"webgpu/shader/execution/bitcast.bin": "a25e9714", | ||
"webgpu/shader/execution/ceil.bin": "8d120ea3", | ||
"webgpu/shader/execution/clamp.bin": "a762ef58", | ||
"webgpu/shader/execution/cos.bin": "a859da89", | ||
"webgpu/shader/execution/cosh.bin": "86abdd85", | ||
"webgpu/shader/execution/cross.bin": "e4556729", | ||
"webgpu/shader/execution/degrees.bin": "1fa19a41", | ||
"webgpu/shader/execution/determinant.bin": "108c3d65", | ||
"webgpu/shader/execution/distance.bin": "77a1baa6", | ||
"webgpu/shader/execution/dot.bin": "d4ac2e8a", | ||
"webgpu/shader/execution/exp.bin": "15539afd", | ||
"webgpu/shader/execution/exp2.bin": "7f6a8523", | ||
"webgpu/shader/execution/faceForward.bin": "e7b35f43", | ||
"webgpu/shader/execution/floor.bin": "b26656ca", | ||
"webgpu/shader/execution/fma.bin": "5a70c683", | ||
"webgpu/shader/execution/fract.bin": "23c0d5ec", | ||
"webgpu/shader/execution/frexp.bin": "d28e66be", | ||
"webgpu/shader/execution/inverseSqrt.bin": "9f297854", | ||
"webgpu/shader/execution/ldexp.bin": "638db0c7", | ||
"webgpu/shader/execution/length.bin": "7d237c62", | ||
"webgpu/shader/execution/log.bin": "70720bf0", | ||
"webgpu/shader/execution/log2.bin": "93a309be", | ||
"webgpu/shader/execution/max.bin": "36eb4779", | ||
"webgpu/shader/execution/min.bin": "ca772bf1", | ||
"webgpu/shader/execution/mix.bin": "ecbf61ae", | ||
"webgpu/shader/execution/modf.bin": "6ddea900", | ||
"webgpu/shader/execution/normalize.bin": "d3e47c61", | ||
"webgpu/shader/execution/pack2x16float.bin": "e6859c1a", | ||
"webgpu/shader/execution/pow.bin": "a58be71c", | ||
"webgpu/shader/execution/quantizeToF16.bin": "eca85bca", | ||
"webgpu/shader/execution/radians.bin": "a216c9aa", | ||
"webgpu/shader/execution/reflect.bin": "ebce9830", | ||
"webgpu/shader/execution/refract.bin": "59d1e5d6", | ||
"webgpu/shader/execution/round.bin": "9389a090", | ||
"webgpu/shader/execution/saturate.bin": "7ca4b681", | ||
"webgpu/shader/execution/sign.bin": "1f4eeb34", | ||
"webgpu/shader/execution/sin.bin": "a1e234b4", | ||
"webgpu/shader/execution/sinh.bin": "1a62054b", | ||
"webgpu/shader/execution/smoothstep.bin": "d5824fd6", | ||
"webgpu/shader/execution/sqrt.bin": "66f21d02", | ||
"webgpu/shader/execution/step.bin": "310cb6c7", | ||
"webgpu/shader/execution/tan.bin": "1e26f533", | ||
"webgpu/shader/execution/tanh.bin": "4c546d1c", | ||
"webgpu/shader/execution/transpose.bin": "7bef2494", | ||
"webgpu/shader/execution/trunc.bin": "e72535eb", | ||
"webgpu/shader/execution/unpack2x16float.bin": "593d88c6", | ||
"webgpu/shader/execution/unpack2x16snorm.bin": "9ebd3e40", | ||
"webgpu/shader/execution/unpack2x16unorm.bin": "83a36fa9", | ||
"webgpu/shader/execution/unpack4x8snorm.bin": "41b12606", | ||
"webgpu/shader/execution/unpack4x8unorm.bin": "96f1850b", | ||
"webgpu/shader/execution/unary/af_arithmetic.bin": "6fa1d84a", | ||
"webgpu/shader/execution/unary/af_assignment.bin": "98c8f82a", | ||
"webgpu/shader/execution/binary/af_addition.bin": "de575056", | ||
"webgpu/shader/execution/binary/af_logical.bin": "dc2105f8", | ||
"webgpu/shader/execution/binary/af_division.bin": "d7e6d98f", | ||
"webgpu/shader/execution/binary/af_matrix_addition.bin": "c215cf6d", | ||
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "57892276", | ||
"webgpu/shader/execution/binary/af_multiplication.bin": "4c282ac2", | ||
"webgpu/shader/execution/binary/af_remainder.bin": "9fdddf97", | ||
"webgpu/shader/execution/binary/af_subtraction.bin": "a27de3c1", | ||
"webgpu/shader/execution/binary/f16_addition.bin": "ecc2aa17", | ||
"webgpu/shader/execution/binary/f16_logical.bin": "1851f647", | ||
"webgpu/shader/execution/binary/f16_division.bin": "2cfec6de", | ||
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "f5b6ef4f", | ||
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "c47070a0", | ||
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "30b9d67c", | ||
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "46b631ba", | ||
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "19e6a937", | ||
"webgpu/shader/execution/binary/f16_multiplication.bin": "8fbfc97c", | ||
"webgpu/shader/execution/binary/f16_remainder.bin": "66cd384c", | ||
"webgpu/shader/execution/binary/f16_subtraction.bin": "8b5fed3d", | ||
"webgpu/shader/execution/binary/f32_addition.bin": "2ef1211a", | ||
"webgpu/shader/execution/binary/f32_logical.bin": "3c97c69d", | ||
"webgpu/shader/execution/binary/f32_division.bin": "2867ef0a", | ||
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "da9390d1", | ||
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "2d67296e", | ||
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "c79709f5", | ||
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "38b7c05f", | ||
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "f9b675d7", | ||
"webgpu/shader/execution/binary/f32_multiplication.bin": "bb7ee512", | ||
"webgpu/shader/execution/binary/f32_remainder.bin": "e0d16b8f", | ||
"webgpu/shader/execution/binary/f32_subtraction.bin": "755fc63", | ||
"webgpu/shader/execution/binary/i32_arithmetic.bin": "3c1d6f0f", | ||
"webgpu/shader/execution/binary/i32_comparison.bin": "4759dfea", | ||
"webgpu/shader/execution/binary/u32_arithmetic.bin": "6bf6989d", | ||
"webgpu/shader/execution/binary/u32_comparison.bin": "ca8b140b", | ||
"webgpu/shader/execution/abs.bin": "a79b85f3", | ||
"webgpu/shader/execution/acos.bin": "eed1c72", | ||
"webgpu/shader/execution/acosh.bin": "a1b7dc12", | ||
"webgpu/shader/execution/asin.bin": "fbf69cb0", | ||
"webgpu/shader/execution/asinh.bin": "7b8f7a8", | ||
"webgpu/shader/execution/atan.bin": "250334d8", | ||
"webgpu/shader/execution/atan2.bin": "9df3f787", | ||
"webgpu/shader/execution/atanh.bin": "5c79c30d", | ||
"webgpu/shader/execution/bitcast.bin": "964fdecd", | ||
"webgpu/shader/execution/ceil.bin": "246bf087", | ||
"webgpu/shader/execution/clamp.bin": "3a299eaf", | ||
"webgpu/shader/execution/cos.bin": "d3efc52b", | ||
"webgpu/shader/execution/cosh.bin": "867cbf85", | ||
"webgpu/shader/execution/cross.bin": "a1089567", | ||
"webgpu/shader/execution/degrees.bin": "d1cfaeac", | ||
"webgpu/shader/execution/determinant.bin": "44faf0f8", | ||
"webgpu/shader/execution/distance.bin": "e1191c92", | ||
"webgpu/shader/execution/dot.bin": "242201b", | ||
"webgpu/shader/execution/exp.bin": "e5f97f39", | ||
"webgpu/shader/execution/exp2.bin": "65bd37ec", | ||
"webgpu/shader/execution/faceForward.bin": "ebb6017a", | ||
"webgpu/shader/execution/floor.bin": "a24e0ff8", | ||
"webgpu/shader/execution/fma.bin": "87615a5f", | ||
"webgpu/shader/execution/fract.bin": "eab1b9fa", | ||
"webgpu/shader/execution/frexp.bin": "7dd8033", | ||
"webgpu/shader/execution/inverseSqrt.bin": "356b47c5", | ||
"webgpu/shader/execution/ldexp.bin": "788fdf3e", | ||
"webgpu/shader/execution/length.bin": "69f13c20", | ||
"webgpu/shader/execution/log.bin": "dc9c311c", | ||
"webgpu/shader/execution/log2.bin": "d1a49443", | ||
"webgpu/shader/execution/max.bin": "6750f2eb", | ||
"webgpu/shader/execution/min.bin": "c8200395", | ||
"webgpu/shader/execution/mix.bin": "86c40712", | ||
"webgpu/shader/execution/modf.bin": "50483a83", | ||
"webgpu/shader/execution/normalize.bin": "244a8e05", | ||
"webgpu/shader/execution/pack2x16float.bin": "dcd8656d", | ||
"webgpu/shader/execution/pow.bin": "633c917a", | ||
"webgpu/shader/execution/quantizeToF16.bin": "f6044bd2", | ||
"webgpu/shader/execution/radians.bin": "a90b21ea", | ||
"webgpu/shader/execution/reflect.bin": "670fbba2", | ||
"webgpu/shader/execution/refract.bin": "63b06feb", | ||
"webgpu/shader/execution/round.bin": "d4c09bde", | ||
"webgpu/shader/execution/saturate.bin": "d4f8a4d0", | ||
"webgpu/shader/execution/sign.bin": "57c988b9", | ||
"webgpu/shader/execution/sin.bin": "59aab9f5", | ||
"webgpu/shader/execution/sinh.bin": "3890a90c", | ||
"webgpu/shader/execution/smoothstep.bin": "b695fd45", | ||
"webgpu/shader/execution/sqrt.bin": "9524c93", | ||
"webgpu/shader/execution/step.bin": "b9cc90a4", | ||
"webgpu/shader/execution/tan.bin": "e5792957", | ||
"webgpu/shader/execution/tanh.bin": "ba99c688", | ||
"webgpu/shader/execution/transpose.bin": "83588805", | ||
"webgpu/shader/execution/trunc.bin": "aad5d037", | ||
"webgpu/shader/execution/unpack2x16float.bin": "493cbe7b", | ||
"webgpu/shader/execution/unpack2x16snorm.bin": "fd0b5eb9", | ||
"webgpu/shader/execution/unpack2x16unorm.bin": "f7436a6c", | ||
"webgpu/shader/execution/unpack4x8snorm.bin": "eca842d9", | ||
"webgpu/shader/execution/unpack4x8unorm.bin": "8654f67e", | ||
"webgpu/shader/execution/unary/af_arithmetic.bin": "e05d3c45", | ||
"webgpu/shader/execution/unary/af_assignment.bin": "45da8cfe", | ||
"webgpu/shader/execution/unary/bool_conversion.bin": "dd71f171", | ||
"webgpu/shader/execution/unary/f16_arithmetic.bin": "2f2d38fc", | ||
"webgpu/shader/execution/unary/f16_conversion.bin": "70c94538", | ||
"webgpu/shader/execution/unary/f32_arithmetic.bin": "db90c01c", | ||
"webgpu/shader/execution/unary/f32_conversion.bin": "81912140", | ||
"webgpu/shader/execution/unary/f16_arithmetic.bin": "9c17fdca", | ||
"webgpu/shader/execution/unary/f16_conversion.bin": "c02b6c8", | ||
"webgpu/shader/execution/unary/f32_arithmetic.bin": "feff26f7", | ||
"webgpu/shader/execution/unary/f32_conversion.bin": "f2639f4c", | ||
"webgpu/shader/execution/unary/i32_arithmetic.bin": "c69716e2", | ||
"webgpu/shader/execution/unary/i32_conversion.bin": "83218e69", | ||
"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" | ||
"webgpu/shader/execution/binary/ai_arithmetic.bin": "dfcd593a", | ||
"webgpu/shader/execution/unary/ai_arithmetic.bin": "3d27dc97", | ||
"webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "7e551ea1", | ||
"webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "fe7ea65b", | ||
"webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "2a98deaa" | ||
} |
Binary file added
BIN
+1.54 MB
src/resources/cache/webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin
Binary file not shown.
Binary file added
BIN
+941 KB
src/resources/cache/webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin
Binary file not shown.
Binary file added
BIN
+564 KB
src/resources/cache/webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/webgpu/shader/execution/expression/binary/af_matrix_matrix_multiplication.cache.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { FP } from '../../../../util/floating_point.js'; | ||
import { sparseMatrixF64Range } from '../../../../util/math.js'; | ||
import { selectNCases } from '../case.js'; | ||
import { makeCaseCache } from '../case_cache.js'; | ||
|
||
// Cases: matKxR_matCxK | ||
const mat_mat_cases = ([2, 3, 4] as const) | ||
.flatMap(k => | ||
([2, 3, 4] as const).flatMap(cols => | ||
([2, 3, 4] as const).map(rows => ({ | ||
[`mat${k}x${rows}_mat${cols}x${k}`]: () => { | ||
return selectNCases( | ||
'binary/af_matrix_matrix_multiplication', | ||
50, | ||
FP.abstract.generateMatrixPairToMatrixCases( | ||
sparseMatrixF64Range(k, rows), | ||
sparseMatrixF64Range(cols, k), | ||
'finite', | ||
FP.abstract.multiplicationMatrixMatrixInterval | ||
) | ||
); | ||
}, | ||
})) | ||
) | ||
) | ||
.reduce((a, b) => ({ ...a, ...b }), {}); | ||
|
||
export const d = makeCaseCache('binary/af_matrix_matrix_multiplication', mat_mat_cases); |
48 changes: 48 additions & 0 deletions
48
src/webgpu/shader/execution/expression/binary/af_matrix_matrix_multiplication.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
export const description = ` | ||
Execution Tests for matrix-matrix AbstractFloat multiplication expression | ||
`; | ||
|
||
import { makeTestGroup } from '../../../../../common/framework/test_group.js'; | ||
import { GPUTest } from '../../../../gpu_test.js'; | ||
import { TypeAbstractFloat, TypeMat } from '../../../../util/conversion.js'; | ||
import { onlyConstInputSource, run } from '../expression.js'; | ||
|
||
import { d } from './af_matrix_matrix_multiplication.cache.js'; | ||
import { abstractFloatBinary } from './binary.js'; | ||
|
||
export const g = makeTestGroup(GPUTest); | ||
|
||
g.test('matrix_matrix') | ||
.specURL('https://www.w3.org/TR/WGSL/#floating-point-evaluation') | ||
.desc( | ||
` | ||
Expression: x * y, where x is a matrix and y is a matrix | ||
Accuracy: Correctly rounded | ||
` | ||
) | ||
.params(u => | ||
u | ||
.combine('inputSource', onlyConstInputSource) | ||
.combine('common_dim', [2, 3, 4] as const) | ||
.combine('x_rows', [2, 3, 4] as const) | ||
.combine('y_cols', [2, 3, 4] as const) | ||
) | ||
.beforeAllSubcases(t => { | ||
t.selectDeviceOrSkipTestCase({ requiredFeatures: ['shader-f16'] }); | ||
}) | ||
.fn(async t => { | ||
const x_cols = t.params.common_dim; | ||
const x_rows = t.params.x_rows; | ||
const y_cols = t.params.y_cols; | ||
const y_rows = t.params.common_dim; | ||
|
||
const cases = await d.get(`mat${x_cols}x${x_rows}_mat${y_cols}x${y_rows}`); | ||
await run( | ||
t, | ||
abstractFloatBinary('*'), | ||
[TypeMat(x_cols, x_rows, TypeAbstractFloat), TypeMat(y_cols, y_rows, TypeAbstractFloat)], | ||
TypeMat(y_cols, x_rows, TypeAbstractFloat), | ||
t.params, | ||
cases | ||
); | ||
}); |
Oops, something went wrong.