Skip to content

Commit

Permalink
wgsl: Use selectNCases to restrict the number of AF Matrix cases
Browse files Browse the repository at this point in the history
Fixes #3457
  • Loading branch information
zoddicus committed Mar 7, 2024
1 parent adaa479 commit 6e6a92f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/resources/cache/hashes.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"webgpu/shader/execution/binary/af_addition.bin": "1a138e40",
"webgpu/shader/execution/binary/af_logical.bin": "2a334d4b",
"webgpu/shader/execution/binary/af_division.bin": "801a63d2",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "d392437a",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "5c7c1cc9",
"webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "8a56ca30",
"webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "3b36edc4",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "c2a167d1",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "ab2b8211",
"webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "3bdd724b",
"webgpu/shader/execution/binary/af_multiplication.bin": "af6472be",
"webgpu/shader/execution/binary/af_remainder.bin": "582570bc",
Expand Down
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 6e6a92f

Please sign in to comment.