Skip to content

Commit a2897c3

Browse files
authored
wgsl: Migrate AF multiplication tests to use lookup table (gpuweb#3691)
Also converts some of the existing lookup tables to use Map instead of Record, this allows to having missing key errors appear at the key lookup, instead of later then the value is trying to be used. Fixes gpuweb#2993
1 parent 3531212 commit a2897c3

File tree

9 files changed

+404
-141
lines changed

9 files changed

+404
-141
lines changed

src/resources/cache/hashes.json

+94-94
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

src/unittests/floating_point.spec.ts

+2-26
Original file line numberDiff line numberDiff line change
@@ -4710,22 +4710,12 @@ const kMultiplicationInterval64BitsNormalCases = {
47104710
{ input: [0.1, -0.1], expected: [reinterpretU16AsF16(0xa120), reinterpretU16AsF16(0xa11e)] }, // ~-0.01
47114711
{ input: [-0.1, 0.1], expected: [reinterpretU16AsF16(0xa120), reinterpretU16AsF16(0xa11e)] }, // ~-0.01
47124712
] as ScalarPairToIntervalCase[],
4713-
abstract: [
4714-
// 0.1 isn't exactly representable in f64, but will be quantized to an
4715-
// exact value when storing to a 'number' (0x3FB999999999999A).
4716-
// This is why below the expectations are not intervals.
4717-
// f64 0.1 * 0.1 = 0x3f847ae147ae147c,
4718-
{ input: [0.1, 0.1], expected: reinterpretU64AsF64(0x3f847ae147ae147cn) }, // ~0.01
4719-
{ input: [-0.1, -0.1], expected: reinterpretU64AsF64(0x3f847ae147ae147cn) }, // ~0.01
4720-
{ input: [0.1, -0.1], expected: reinterpretU64AsF64(0xbf847ae147ae147cn) }, // ~-0.01
4721-
{ input: [-0.1, 0.1], expected: reinterpretU64AsF64(0xbf847ae147ae147cn) }, // ~-0.01
4722-
] as ScalarPairToIntervalCase[],
47234713
} as const;
47244714

47254715
g.test('multiplicationInterval')
47264716
.params(u =>
47274717
u
4728-
.combine('trait', ['f32', 'f16', 'abstract'] as const)
4718+
.combine('trait', ['f32', 'f16'] as const)
47294719
.beginSubcases()
47304720
.expandWithParams<ScalarPairToIntervalCase>(p => {
47314721
const trait = FP[p.trait];
@@ -7685,26 +7675,12 @@ const kMultiplicationMatrixScalarIntervalCases = {
76857675
],
76867676
},
76877677
] as MatrixScalarToMatrixCase[],
7688-
abstract: [
7689-
// From https://github.com/gpuweb/cts/issues/3044
7690-
{
7691-
matrix: [
7692-
[kValue.f64.negative.min, 0],
7693-
[0, 0],
7694-
],
7695-
scalar: kValue.f64.negative.subnormal.min,
7696-
expected: [
7697-
[[0, reinterpretU64AsF64(0x400ffffffffffffdn)], 0], // [[0, 3.9999995...], 0],
7698-
[0, 0],
7699-
],
7700-
},
7701-
] as MatrixScalarToMatrixCase[],
77027678
} as const;
77037679

77047680
g.test('multiplicationMatrixScalarInterval')
77057681
.params(u =>
77067682
u
7707-
.combine('trait', ['f32', 'f16', 'abstract'] as const)
7683+
.combine('trait', ['f32', 'f16'] as const)
77087684
.beginSubcases()
77097685
.expandWithParams<MatrixScalarToMatrixCase>(p => {
77107686
const trait = FP[p.trait];

0 commit comments

Comments
 (0)