summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/expression/binary/af_matrix_vector_multiplication.cache.ts
diff options
context:
space:
mode:
Diffstat (limited to 'dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/expression/binary/af_matrix_vector_multiplication.cache.ts')
-rw-r--r--dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/expression/binary/af_matrix_vector_multiplication.cache.ts51
1 files changed, 51 insertions, 0 deletions
diff --git a/dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/expression/binary/af_matrix_vector_multiplication.cache.ts b/dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/expression/binary/af_matrix_vector_multiplication.cache.ts
new file mode 100644
index 0000000000..4578eb0ce4
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/expression/binary/af_matrix_vector_multiplication.cache.ts
@@ -0,0 +1,51 @@
+import { FP } from '../../../../util/floating_point.js';
+import { sparseMatrixF64Range, sparseVectorF64Range } from '../../../../util/math.js';
+import { selectNCases } from '../case.js';
+import { makeCaseCache } from '../case_cache.js';
+
+// Cases: matCxR_vecC
+const mat_vec_cases = ([2, 3, 4] as const)
+ .flatMap(cols =>
+ ([2, 3, 4] as const).map(rows => ({
+ [`mat${cols}x${rows}_vec${cols}`]: () => {
+ return selectNCases(
+ 'binary/af_matrix_vector_multiplication_mat_vec',
+ 50,
+ FP.abstract.generateMatrixVectorToVectorCases(
+ sparseMatrixF64Range(cols, rows),
+ sparseVectorF64Range(cols),
+ 'finite',
+ // Matrix-vector multiplication has an inherited accuracy, so abstract is only expected to be as accurate as f32
+ FP.f32.multiplicationMatrixVectorInterval
+ )
+ );
+ },
+ }))
+ )
+ .reduce((a, b) => ({ ...a, ...b }), {});
+
+// Cases: vecR_matCxR
+const vec_mat_cases = ([2, 3, 4] as const)
+ .flatMap(rows =>
+ ([2, 3, 4] as const).map(cols => ({
+ [`vec${rows}_mat${cols}x${rows}`]: () => {
+ return selectNCases(
+ 'binary/af_matrix_vector_multiplication_vec_mat',
+ 50,
+ FP.abstract.generateVectorMatrixToVectorCases(
+ sparseVectorF64Range(rows),
+ sparseMatrixF64Range(cols, rows),
+ 'finite',
+ // Vector-matrix multiplication has an inherited accuracy, so abstract is only expected to be as accurate as f32
+ FP.f32.multiplicationVectorMatrixInterval
+ )
+ );
+ },
+ }))
+ )
+ .reduce((a, b) => ({ ...a, ...b }), {});
+
+export const d = makeCaseCache('binary/af_matrix_vector_multiplication', {
+ ...mat_vec_cases,
+ ...vec_mat_cases,
+});