Skip to content

Commit

Permalink
wgsl: Implement AbstractFloat determinant execution tests
Browse files Browse the repository at this point in the history
Fixes #2523
  • Loading branch information
zoddicus committed Mar 11, 2024
1 parent f4bc7d3 commit d24022b
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 102 deletions.
186 changes: 93 additions & 93 deletions src/resources/cache/hashes.json
Original file line number Diff line number Diff line change
@@ -1,109 +1,109 @@
{
"webgpu/shader/execution/binary/af_addition.bin": "360aab58",
"webgpu/shader/execution/binary/af_addition.bin": "672ec525",
"webgpu/shader/execution/binary/af_logical.bin": "4269127d",
"webgpu/shader/execution/binary/af_division.bin": "2a1ae6a9",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "135913e7",
"webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "83a7b6ab",
"webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "5959bc9f",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "9c125148",
"webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "efbe60ca",
"webgpu/shader/execution/binary/af_multiplication.bin": "923ed423",
"webgpu/shader/execution/binary/af_remainder.bin": "c17bb87f",
"webgpu/shader/execution/binary/af_subtraction.bin": "6457d271",
"webgpu/shader/execution/binary/af_division.bin": "6e8ad892",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "32da2b7c",
"webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "91deee9f",
"webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "fee3b7a9",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "a88e71",
"webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "b4125c67",
"webgpu/shader/execution/binary/af_multiplication.bin": "9169a7cc",
"webgpu/shader/execution/binary/af_remainder.bin": "cca81a43",
"webgpu/shader/execution/binary/af_subtraction.bin": "492e9fa6",
"webgpu/shader/execution/binary/ai_arithmetic.bin": "f89aeb4",
"webgpu/shader/execution/binary/f16_addition.bin": "85c17d72",
"webgpu/shader/execution/binary/f16_addition.bin": "dc6254bc",
"webgpu/shader/execution/binary/f16_logical.bin": "36a51091",
"webgpu/shader/execution/binary/f16_division.bin": "7c38f4b7",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "9e6258d7",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "916ca7e6",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "a4f59720",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "5e94030b",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "45b64fd9",
"webgpu/shader/execution/binary/f16_multiplication.bin": "ee7ba392",
"webgpu/shader/execution/binary/f16_remainder.bin": "ea8f78e",
"webgpu/shader/execution/binary/f16_subtraction.bin": "f5e0d152",
"webgpu/shader/execution/binary/f32_addition.bin": "d82339c6",
"webgpu/shader/execution/binary/f16_division.bin": "6d2b053a",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "341ba083",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "bd8dd00b",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "14c4703f",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "995297a6",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "195412f0",
"webgpu/shader/execution/binary/f16_multiplication.bin": "9698f93f",
"webgpu/shader/execution/binary/f16_remainder.bin": "171e75c7",
"webgpu/shader/execution/binary/f16_subtraction.bin": "7b6a942f",
"webgpu/shader/execution/binary/f32_addition.bin": "3b4de4ba",
"webgpu/shader/execution/binary/f32_logical.bin": "e1d07173",
"webgpu/shader/execution/binary/f32_division.bin": "46721765",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "6fdf77f1",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "73520069",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "5ea144ba",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "5f5213d2",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "2ff78c70",
"webgpu/shader/execution/binary/f32_multiplication.bin": "3eb2748f",
"webgpu/shader/execution/binary/f32_remainder.bin": "a6728c3e",
"webgpu/shader/execution/binary/f32_subtraction.bin": "6d3120c0",
"webgpu/shader/execution/binary/f32_division.bin": "27d0e4",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "4712fb9d",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "7340d9ed",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "67894b46",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "90a68302",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "4ad5ee6",
"webgpu/shader/execution/binary/f32_multiplication.bin": "1f42db44",
"webgpu/shader/execution/binary/f32_remainder.bin": "5556d99f",
"webgpu/shader/execution/binary/f32_subtraction.bin": "54a6d2db",
"webgpu/shader/execution/binary/i32_arithmetic.bin": "936d712",
"webgpu/shader/execution/binary/i32_comparison.bin": "5db8f3b0",
"webgpu/shader/execution/binary/u32_arithmetic.bin": "415ac05e",
"webgpu/shader/execution/binary/u32_comparison.bin": "f90d60f3",
"webgpu/shader/execution/abs.bin": "3bcfb49e",
"webgpu/shader/execution/acos.bin": "86824420",
"webgpu/shader/execution/acosh.bin": "95f9a9a4",
"webgpu/shader/execution/asin.bin": "1d017518",
"webgpu/shader/execution/asinh.bin": "56df3876",
"webgpu/shader/execution/atan.bin": "6aaa6b50",
"webgpu/shader/execution/atan2.bin": "82bcc1a2",
"webgpu/shader/execution/atanh.bin": "36a1f68a",
"webgpu/shader/execution/bitcast.bin": "6b7ea46b",
"webgpu/shader/execution/ceil.bin": "7308c54f",
"webgpu/shader/execution/clamp.bin": "9bfd2fce",
"webgpu/shader/execution/cos.bin": "2fa872d3",
"webgpu/shader/execution/cosh.bin": "2e6538aa",
"webgpu/shader/execution/cross.bin": "71a7e274",
"webgpu/shader/execution/degrees.bin": "31d8728f",
"webgpu/shader/execution/determinant.bin": "399a64cb",
"webgpu/shader/execution/distance.bin": "4282ab43",
"webgpu/shader/execution/dot.bin": "b4940f90",
"webgpu/shader/execution/exp.bin": "3801f256",
"webgpu/shader/execution/exp2.bin": "fb531b99",
"webgpu/shader/execution/faceForward.bin": "ac35ad68",
"webgpu/shader/execution/floor.bin": "177dc3a6",
"webgpu/shader/execution/fma.bin": "27a3e818",
"webgpu/shader/execution/fract.bin": "8ed3cd4b",
"webgpu/shader/execution/frexp.bin": "b6d69258",
"webgpu/shader/execution/inverseSqrt.bin": "b08786b3",
"webgpu/shader/execution/ldexp.bin": "6b8bcdb3",
"webgpu/shader/execution/length.bin": "3dc4b222",
"webgpu/shader/execution/log.bin": "9219d5e4",
"webgpu/shader/execution/log2.bin": "d5ca64af",
"webgpu/shader/execution/max.bin": "9051c302",
"webgpu/shader/execution/min.bin": "e950d75f",
"webgpu/shader/execution/mix.bin": "3a720d24",
"webgpu/shader/execution/modf.bin": "ef00e883",
"webgpu/shader/execution/normalize.bin": "52231704",
"webgpu/shader/execution/abs.bin": "dff57464",
"webgpu/shader/execution/acos.bin": "13c72b8d",
"webgpu/shader/execution/acosh.bin": "f3daea94",
"webgpu/shader/execution/asin.bin": "c562907e",
"webgpu/shader/execution/asinh.bin": "721deb57",
"webgpu/shader/execution/atan.bin": "5b88238b",
"webgpu/shader/execution/atan2.bin": "418abbf",
"webgpu/shader/execution/atanh.bin": "8a76120d",
"webgpu/shader/execution/bitcast.bin": "913ebd59",
"webgpu/shader/execution/ceil.bin": "c392b09d",
"webgpu/shader/execution/clamp.bin": "2b379332",
"webgpu/shader/execution/cos.bin": "d70daf38",
"webgpu/shader/execution/cosh.bin": "3dd70510",
"webgpu/shader/execution/cross.bin": "aaf9b866",
"webgpu/shader/execution/degrees.bin": "50eed4f2",
"webgpu/shader/execution/determinant.bin": "1efb7155",
"webgpu/shader/execution/distance.bin": "6b4cb2e9",
"webgpu/shader/execution/dot.bin": "ac1a7cfa",
"webgpu/shader/execution/exp.bin": "4878be34",
"webgpu/shader/execution/exp2.bin": "2cc28715",
"webgpu/shader/execution/faceForward.bin": "180bb8cd",
"webgpu/shader/execution/floor.bin": "17dc4618",
"webgpu/shader/execution/fma.bin": "442ff796",
"webgpu/shader/execution/fract.bin": "4fd27c33",
"webgpu/shader/execution/frexp.bin": "e4230e28",
"webgpu/shader/execution/inverseSqrt.bin": "2676cff9",
"webgpu/shader/execution/ldexp.bin": "ae727461",
"webgpu/shader/execution/length.bin": "d8effb69",
"webgpu/shader/execution/log.bin": "db27f8e3",
"webgpu/shader/execution/log2.bin": "b59594e4",
"webgpu/shader/execution/max.bin": "637391a",
"webgpu/shader/execution/min.bin": "77a38ad5",
"webgpu/shader/execution/mix.bin": "b57d9e7d",
"webgpu/shader/execution/modf.bin": "83847917",
"webgpu/shader/execution/normalize.bin": "573a4169",
"webgpu/shader/execution/pack2x16float.bin": "54f11627",
"webgpu/shader/execution/pow.bin": "9fdb1669",
"webgpu/shader/execution/quantizeToF16.bin": "e980118b",
"webgpu/shader/execution/radians.bin": "a676aec1",
"webgpu/shader/execution/reflect.bin": "a951c771",
"webgpu/shader/execution/refract.bin": "d8953376",
"webgpu/shader/execution/round.bin": "eee2fc9",
"webgpu/shader/execution/saturate.bin": "161df54c",
"webgpu/shader/execution/sign.bin": "9d9a22ff",
"webgpu/shader/execution/sin.bin": "29f7032a",
"webgpu/shader/execution/sinh.bin": "9d282f12",
"webgpu/shader/execution/smoothstep.bin": "f4230ffb",
"webgpu/shader/execution/sqrt.bin": "1dba9696",
"webgpu/shader/execution/step.bin": "2048f771",
"webgpu/shader/execution/tan.bin": "adc5217b",
"webgpu/shader/execution/tanh.bin": "20f7d479",
"webgpu/shader/execution/transpose.bin": "727afd91",
"webgpu/shader/execution/trunc.bin": "bc14dd25",
"webgpu/shader/execution/unpack2x16float.bin": "b8428e59",
"webgpu/shader/execution/unpack2x16snorm.bin": "e38f4982",
"webgpu/shader/execution/unpack2x16unorm.bin": "c7cdd947",
"webgpu/shader/execution/unpack4x8snorm.bin": "71e176b1",
"webgpu/shader/execution/unpack4x8unorm.bin": "5e61d6ea",
"webgpu/shader/execution/unary/af_arithmetic.bin": "29bc881a",
"webgpu/shader/execution/unary/af_assignment.bin": "33c25997",
"webgpu/shader/execution/pow.bin": "4d6b8a2d",
"webgpu/shader/execution/quantizeToF16.bin": "27f31831",
"webgpu/shader/execution/radians.bin": "64ae45ec",
"webgpu/shader/execution/reflect.bin": "3c91581c",
"webgpu/shader/execution/refract.bin": "a2d4d097",
"webgpu/shader/execution/round.bin": "d7c23e09",
"webgpu/shader/execution/saturate.bin": "a87c0a3d",
"webgpu/shader/execution/sign.bin": "a07df7f6",
"webgpu/shader/execution/sin.bin": "ffff8ea5",
"webgpu/shader/execution/sinh.bin": "6c88ea46",
"webgpu/shader/execution/smoothstep.bin": "367d70e8",
"webgpu/shader/execution/sqrt.bin": "b7d719f5",
"webgpu/shader/execution/step.bin": "20139205",
"webgpu/shader/execution/tan.bin": "706bad5e",
"webgpu/shader/execution/tanh.bin": "790da524",
"webgpu/shader/execution/transpose.bin": "75ca5973",
"webgpu/shader/execution/trunc.bin": "277331f6",
"webgpu/shader/execution/unpack2x16float.bin": "8a53b5cc",
"webgpu/shader/execution/unpack2x16snorm.bin": "c9a57618",
"webgpu/shader/execution/unpack2x16unorm.bin": "3b79443e",
"webgpu/shader/execution/unpack4x8snorm.bin": "ebac364a",
"webgpu/shader/execution/unpack4x8unorm.bin": "e16576d7",
"webgpu/shader/execution/unary/af_arithmetic.bin": "d456bf2c",
"webgpu/shader/execution/unary/af_assignment.bin": "18fdbe7d",
"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": "925ed6d",
"webgpu/shader/execution/unary/f16_conversion.bin": "751ff969",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "b26d9187",
"webgpu/shader/execution/unary/f32_conversion.bin": "482ee20f",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "512f3d36",
"webgpu/shader/execution/unary/f16_conversion.bin": "7aff8026",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "40109b41",
"webgpu/shader/execution/unary/f32_conversion.bin": "a79a1a09",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "8f3c4616",
"webgpu/shader/execution/unary/i32_conversion.bin": "972063c",
"webgpu/shader/execution/unary/u32_conversion.bin": "168fcf74"
Expand Down
Binary file modified src/resources/cache/webgpu/shader/execution/determinant.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion src/unittests/floating_point.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6504,7 +6504,7 @@ interface MatrixToScalarCase {
g.test('determinantInterval')
.params(u =>
u
.combine('trait', ['f32', 'f16'] as const)
.combine('trait', ['f32', 'f16', 'abstract'] as const)
.beginSubcases()
.combineWithParams<MatrixToScalarCase>([
// Extreme values, i.e. subnormals, very large magnitudes, and those lead to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,21 @@ const f16_cases = ([2, 3, 4] as const)
)
.reduce((a, b) => ({ ...a, ...b }), {});

// Cases: abstract_matDxD
const abstract_cases = ([2, 3, 4] as const)
.map(dim => ({
[`abstract_mat${dim}x${dim}`]: () => {
return FP.abstract.generateMatrixToScalarCases(
kDeterminantMatrixValues[dim],
'finite',
FP.abstract.determinantInterval
);
},
}))
.reduce((a, b) => ({ ...a, ...b }), {});

export const d = makeCaseCache('determinant', {
...f32_cases,
...f16_cases,
...abstract_cases,
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,29 @@ Returns the determinant of e.
import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
import { GPUTest } from '../../../../../gpu_test.js';
import { Type } from '../../../../../util/conversion.js';
import { allInputSources, run } from '../../expression.js';
import { allInputSources, onlyConstInputSource, run } from '../../expression.js';

import { builtin } from './builtin.js';
import { abstractFloatBuiltin, builtin } from './builtin.js';
import { d } from './determinant.cache.js';

export const g = makeTestGroup(GPUTest);

g.test('abstract_float')
.specURL('https://www.w3.org/TR/WGSL/#matrix-builtin-functions')
.desc(`abstract float tests`)
.params(u => u.combine('inputSource', allInputSources).combine('dimension', [2, 3, 4] as const))
.unimplemented();
.params(u => u.combine('inputSource', onlyConstInputSource).combine('dim', [2, 3, 4] as const))
.fn(async t => {
const dim = t.params.dim;
const cases = await d.get(`abstract_mat${dim}x${dim}`);
await run(
t,
abstractFloatBuiltin('determinant'),
[Type.mat(dim, dim, Type.abstractFloat)],
Type.abstractFloat,
t.params,
cases
);
});

g.test('f32')
.specURL('https://www.w3.org/TR/WGSL/#matrix-builtin-functions')
Expand Down
5 changes: 1 addition & 4 deletions src/webgpu/util/floating_point.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5128,10 +5128,7 @@ class FPAbstractTraits extends FPTraits {
public readonly coshInterval = this.unimplementedScalarToInterval.bind(this, 'coshInterval');
public readonly crossInterval = this.crossIntervalImpl.bind(this);
public readonly degreesInterval = this.degreesIntervalImpl.bind(this);
public readonly determinantInterval = this.unimplementedMatrixToInterval.bind(
this,
'determinantInterval'
);
public readonly determinantInterval = this.determinantIntervalImpl.bind(this);
public readonly distanceInterval = this.unimplementedDistance.bind(this);
public readonly divisionInterval = (
x: number | FPInterval,
Expand Down

0 comments on commit d24022b

Please sign in to comment.