Skip to content

Commit

Permalink
wgsl: Use selectNCases to restrict the number of AF Matrix cases (#3465)
Browse files Browse the repository at this point in the history
Fixes #3457
  • Loading branch information
zoddicus authored Mar 11, 2024
1 parent f71a834 commit 11d3770
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
18 changes: 9 additions & 9 deletions src/resources/cache/hashes.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
"webgpu/shader/execution/binary/af_addition.bin": "590ce5d0",
"webgpu/shader/execution/binary/af_logical.bin": "4269127d",
"webgpu/shader/execution/binary/af_division.bin": "d4ff5475",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "9593eb85",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "aa460371",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "298ef48e",
"webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "7fed8020",
"webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "48e954b2",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "6d4ead98",
"webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "209e2c19",
"webgpu/shader/execution/binary/af_multiplication.bin": "5eafc30c",
"webgpu/shader/execution/binary/af_remainder.bin": "75cfdd3",
"webgpu/shader/execution/binary/af_subtraction.bin": "5acd5252",
"webgpu/shader/execution/binary/ai_arithmetic.bin": "f89aeb4",
"webgpu/shader/execution/binary/f16_addition.bin": "b3b843b9",
"webgpu/shader/execution/binary/f16_logical.bin": "36a51091",
"webgpu/shader/execution/binary/f16_division.bin": "67fc610",
Expand Down Expand Up @@ -93,18 +97,14 @@
"webgpu/shader/execution/unpack4x8unorm.bin": "31999cab",
"webgpu/shader/execution/unary/af_arithmetic.bin": "446e85d9",
"webgpu/shader/execution/unary/af_assignment.bin": "9911dc5f",
"webgpu/shader/execution/unary/ai_arithmetic.bin": "497ec1e1",
"webgpu/shader/execution/unary/ai_assignment.bin": "fc978bdd",
"webgpu/shader/execution/unary/bool_conversion.bin": "bcab7d9a",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "b0a84279",
"webgpu/shader/execution/unary/f16_conversion.bin": "4bbd348e",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "a98d962e",
"webgpu/shader/execution/unary/f32_conversion.bin": "9af02ab5",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "8f3c4616",
"webgpu/shader/execution/unary/i32_conversion.bin": "972063c",
"webgpu/shader/execution/unary/u32_conversion.bin": "168fcf74",
"webgpu/shader/execution/unary/ai_assignment.bin": "fc978bdd",
"webgpu/shader/execution/binary/ai_arithmetic.bin": "f89aeb4",
"webgpu/shader/execution/unary/ai_arithmetic.bin": "497ec1e1",
"webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "7fed8020",
"webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "48e954b2",
"webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "209e2c19"
"webgpu/shader/execution/unary/u32_conversion.bin": "168fcf74"
}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
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: matCxR
const mat_cases = ([2, 3, 4] as const)
.flatMap(cols =>
([2, 3, 4] as const).map(rows => ({
[`mat${cols}x${rows}`]: () => {
return FP.abstract.generateMatrixPairToMatrixCases(
sparseMatrixF64Range(cols, rows),
sparseMatrixF64Range(cols, rows),
'finite',
FP.abstract.additionMatrixMatrixInterval
return selectNCases(
'binary/af_matrix_addition',
50,
FP.abstract.generateMatrixPairToMatrixCases(
sparseMatrixF64Range(cols, rows),
sparseMatrixF64Range(cols, rows),
'finite',
FP.abstract.additionMatrixMatrixInterval
)
);
},
}))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
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: matCxR
const mat_cases = ([2, 3, 4] as const)
.flatMap(cols =>
([2, 3, 4] as const).map(rows => ({
[`mat${cols}x${rows}`]: () => {
return FP.abstract.generateMatrixPairToMatrixCases(
sparseMatrixF64Range(cols, rows),
sparseMatrixF64Range(cols, rows),
'finite',
FP.abstract.subtractionMatrixMatrixInterval
return selectNCases(
'binary/af_matrix_subtraction',
50,
FP.abstract.generateMatrixPairToMatrixCases(
sparseMatrixF64Range(cols, rows),
sparseMatrixF64Range(cols, rows),
'finite',
FP.abstract.subtractionMatrixMatrixInterval
)
);
},
}))
Expand Down

0 comments on commit 11d3770

Please sign in to comment.