diff --git a/src/resources/cache/hashes.json b/src/resources/cache/hashes.json index a92aa14b76db..1dfb7379313f 100644 --- a/src/resources/cache/hashes.json +++ b/src/resources/cache/hashes.json @@ -1,110 +1,110 @@ { - "webgpu/shader/execution/binary/af_addition.bin": "1043cbb2", + "webgpu/shader/execution/binary/af_addition.bin": "f79f0374", "webgpu/shader/execution/binary/af_logical.bin": "9ab41597", - "webgpu/shader/execution/binary/af_division.bin": "9ec22a4e", - "webgpu/shader/execution/binary/af_matrix_addition.bin": "1da2ca22", - "webgpu/shader/execution/binary/af_matrix_subtraction.bin": "25303b8e", - "webgpu/shader/execution/binary/af_multiplication.bin": "70d8f01a", - "webgpu/shader/execution/binary/af_remainder.bin": "101c7835", - "webgpu/shader/execution/binary/af_subtraction.bin": "26791651", - "webgpu/shader/execution/binary/f16_addition.bin": "2d67db8f", + "webgpu/shader/execution/binary/af_division.bin": "770fc018", + "webgpu/shader/execution/binary/af_matrix_addition.bin": "a401d81a", + "webgpu/shader/execution/binary/af_matrix_subtraction.bin": "a9e51912", + "webgpu/shader/execution/binary/af_multiplication.bin": "8f7b5f84", + "webgpu/shader/execution/binary/af_remainder.bin": "133a1dd7", + "webgpu/shader/execution/binary/af_subtraction.bin": "9148f3ce", + "webgpu/shader/execution/binary/f16_addition.bin": "d58a9371", "webgpu/shader/execution/binary/f16_logical.bin": "80f9e754", - "webgpu/shader/execution/binary/f16_division.bin": "53e3bdaa", - "webgpu/shader/execution/binary/f16_matrix_addition.bin": "911d18f7", - "webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "a306da0a", - "webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "be77024a", - "webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "ea813df5", - "webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "1692bec1", - "webgpu/shader/execution/binary/f16_multiplication.bin": "7c618e51", - "webgpu/shader/execution/binary/f16_remainder.bin": "9de2be15", - "webgpu/shader/execution/binary/f16_subtraction.bin": "c77bff8a", - "webgpu/shader/execution/binary/f32_addition.bin": "d4282b93", + "webgpu/shader/execution/binary/f16_division.bin": "5d2bf113", + "webgpu/shader/execution/binary/f16_matrix_addition.bin": "531954a6", + "webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "b871cd18", + "webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "3603d1db", + "webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "c97537aa", + "webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "273b76c6", + "webgpu/shader/execution/binary/f16_multiplication.bin": "d98cd937", + "webgpu/shader/execution/binary/f16_remainder.bin": "6e5227f4", + "webgpu/shader/execution/binary/f16_subtraction.bin": "d243bbad", + "webgpu/shader/execution/binary/f32_addition.bin": "c288aef6", "webgpu/shader/execution/binary/f32_logical.bin": "47467130", - "webgpu/shader/execution/binary/f32_division.bin": "4d79a5f6", - "webgpu/shader/execution/binary/f32_matrix_addition.bin": "5972ccf0", - "webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "8bc3f04a", - "webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "7376da03", - "webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "c4785f3a", - "webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "20d4b1", - "webgpu/shader/execution/binary/f32_multiplication.bin": "7586ed6d", - "webgpu/shader/execution/binary/f32_remainder.bin": "59f46306", - "webgpu/shader/execution/binary/f32_subtraction.bin": "4311ba10", + "webgpu/shader/execution/binary/f32_division.bin": "c9c76117", + "webgpu/shader/execution/binary/f32_matrix_addition.bin": "88eedbfa", + "webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "9f76f2ac", + "webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "1d667df9", + "webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "aa253cf1", + "webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "98a63b3a", + "webgpu/shader/execution/binary/f32_multiplication.bin": "dce8dd5b", + "webgpu/shader/execution/binary/f32_remainder.bin": "d3bdb9e3", + "webgpu/shader/execution/binary/f32_subtraction.bin": "8a48e67a", "webgpu/shader/execution/binary/i32_arithmetic.bin": "d345f9c7", "webgpu/shader/execution/binary/i32_comparison.bin": "6d4ae7e0", "webgpu/shader/execution/binary/u32_arithmetic.bin": "163f8a38", "webgpu/shader/execution/binary/u32_comparison.bin": "f6c1497b", - "webgpu/shader/execution/abs.bin": "63fa988e", - "webgpu/shader/execution/acos.bin": "47521b3e", - "webgpu/shader/execution/acosh.bin": "59762b6f", - "webgpu/shader/execution/asin.bin": "db0c6641", - "webgpu/shader/execution/asinh.bin": "f0329d7f", - "webgpu/shader/execution/atan.bin": "f6fea79e", - "webgpu/shader/execution/atan2.bin": "1c390d0f", - "webgpu/shader/execution/atanh.bin": "4c430905", - "webgpu/shader/execution/bitcast.bin": "2dfc8f9", - "webgpu/shader/execution/ceil.bin": "3319384e", - "webgpu/shader/execution/clamp.bin": "4873dd79", - "webgpu/shader/execution/cos.bin": "c16d181a", - "webgpu/shader/execution/cosh.bin": "137f4997", - "webgpu/shader/execution/cross.bin": "aebda306", - "webgpu/shader/execution/degrees.bin": "5001b340", - "webgpu/shader/execution/determinant.bin": "c461c715", - "webgpu/shader/execution/distance.bin": "d05e2f8d", - "webgpu/shader/execution/dot.bin": "7f8b7e13", - "webgpu/shader/execution/exp.bin": "d448dc91", - "webgpu/shader/execution/exp2.bin": "1d232c0e", - "webgpu/shader/execution/faceForward.bin": "87c0576c", - "webgpu/shader/execution/floor.bin": "c3a60f36", - "webgpu/shader/execution/fma.bin": "6b94384d", - "webgpu/shader/execution/fract.bin": "d49c3d50", - "webgpu/shader/execution/frexp.bin": "252e0615", - "webgpu/shader/execution/inverseSqrt.bin": "1deb1185", - "webgpu/shader/execution/ldexp.bin": "617e4cc4", - "webgpu/shader/execution/length.bin": "f7b51c96", - "webgpu/shader/execution/log.bin": "ae124706", - "webgpu/shader/execution/log2.bin": "c428e9f2", - "webgpu/shader/execution/max.bin": "a45914cd", - "webgpu/shader/execution/min.bin": "1017e86d", - "webgpu/shader/execution/mix.bin": "3f5ebb6e", - "webgpu/shader/execution/modf.bin": "fedc0c50", - "webgpu/shader/execution/normalize.bin": "60173a1e", + "webgpu/shader/execution/abs.bin": "e21a06df", + "webgpu/shader/execution/acos.bin": "2a92d3d5", + "webgpu/shader/execution/acosh.bin": "c2cc2e23", + "webgpu/shader/execution/asin.bin": "2027460e", + "webgpu/shader/execution/asinh.bin": "21bac67b", + "webgpu/shader/execution/atan.bin": "6422056c", + "webgpu/shader/execution/atan2.bin": "d8ade832", + "webgpu/shader/execution/atanh.bin": "de1dd54c", + "webgpu/shader/execution/bitcast.bin": "fdd0874", + "webgpu/shader/execution/ceil.bin": "6596b2e2", + "webgpu/shader/execution/clamp.bin": "9a92d1b7", + "webgpu/shader/execution/cos.bin": "647f5fda", + "webgpu/shader/execution/cosh.bin": "5f847611", + "webgpu/shader/execution/cross.bin": "117f2e0f", + "webgpu/shader/execution/degrees.bin": "cadaa756", + "webgpu/shader/execution/determinant.bin": "f2df9222", + "webgpu/shader/execution/distance.bin": "d6a161d1", + "webgpu/shader/execution/dot.bin": "c788d592", + "webgpu/shader/execution/exp.bin": "a76c67ca", + "webgpu/shader/execution/exp2.bin": "a5b443c5", + "webgpu/shader/execution/faceForward.bin": "75f1f377", + "webgpu/shader/execution/floor.bin": "8aea5f9c", + "webgpu/shader/execution/fma.bin": "8682909f", + "webgpu/shader/execution/fract.bin": "ff3283f0", + "webgpu/shader/execution/frexp.bin": "9639418e", + "webgpu/shader/execution/inverseSqrt.bin": "9de3fa15", + "webgpu/shader/execution/ldexp.bin": "43fde30e", + "webgpu/shader/execution/length.bin": "24b87c1a", + "webgpu/shader/execution/log.bin": "c8447a16", + "webgpu/shader/execution/log2.bin": "bcefcef6", + "webgpu/shader/execution/max.bin": "bbd522ab", + "webgpu/shader/execution/min.bin": "4687f034", + "webgpu/shader/execution/mix.bin": "e79fc2e8", + "webgpu/shader/execution/modf.bin": "feedecc3", + "webgpu/shader/execution/normalize.bin": "78e7c0", "webgpu/shader/execution/pack2x16float.bin": "e472a927", - "webgpu/shader/execution/pow.bin": "c5a2a9c1", - "webgpu/shader/execution/quantizeToF16.bin": "8d1cb7a6", - "webgpu/shader/execution/radians.bin": "94cbdf6c", - "webgpu/shader/execution/reflect.bin": "39a479a0", - "webgpu/shader/execution/refract.bin": "63e5b11a", - "webgpu/shader/execution/round.bin": "13bf324", - "webgpu/shader/execution/saturate.bin": "c368b1a7", - "webgpu/shader/execution/sign.bin": "5cd05b5c", - "webgpu/shader/execution/sin.bin": "85679e", - "webgpu/shader/execution/sinh.bin": "eaa61750", - "webgpu/shader/execution/smoothstep.bin": "bd06d7cc", - "webgpu/shader/execution/sqrt.bin": "997f5572", - "webgpu/shader/execution/step.bin": "87505049", - "webgpu/shader/execution/tan.bin": "9d7ca121", - "webgpu/shader/execution/tanh.bin": "8bfa913c", - "webgpu/shader/execution/transpose.bin": "7f8fa4c6", - "webgpu/shader/execution/trunc.bin": "9a054523", - "webgpu/shader/execution/unpack2x16float.bin": "ed71c71d", - "webgpu/shader/execution/unpack2x16snorm.bin": "89b4cd2d", - "webgpu/shader/execution/unpack2x16unorm.bin": "df3b3851", - "webgpu/shader/execution/unpack4x8snorm.bin": "aa10073", - "webgpu/shader/execution/unpack4x8unorm.bin": "2fe14b98", - "webgpu/shader/execution/unary/af_arithmetic.bin": "accfc1bd", - "webgpu/shader/execution/unary/af_assignment.bin": "cb3e120e", + "webgpu/shader/execution/pow.bin": "38d0ff7", + "webgpu/shader/execution/quantizeToF16.bin": "5496ab3", + "webgpu/shader/execution/radians.bin": "db736290", + "webgpu/shader/execution/reflect.bin": "b08379ba", + "webgpu/shader/execution/refract.bin": "d360cf82", + "webgpu/shader/execution/round.bin": "3d2c318e", + "webgpu/shader/execution/saturate.bin": "33892d9c", + "webgpu/shader/execution/sign.bin": "8a54e6ec", + "webgpu/shader/execution/sin.bin": "f0cd3a32", + "webgpu/shader/execution/sinh.bin": "4d1b0134", + "webgpu/shader/execution/smoothstep.bin": "a3b004be", + "webgpu/shader/execution/sqrt.bin": "dd8a5970", + "webgpu/shader/execution/step.bin": "eec1579d", + "webgpu/shader/execution/tan.bin": "612d43b", + "webgpu/shader/execution/tanh.bin": "6f95242c", + "webgpu/shader/execution/transpose.bin": "b1a9a7f7", + "webgpu/shader/execution/trunc.bin": "cdf5939e", + "webgpu/shader/execution/unpack2x16float.bin": "b992957a", + "webgpu/shader/execution/unpack2x16snorm.bin": "394e0942", + "webgpu/shader/execution/unpack2x16unorm.bin": "78f0ef3c", + "webgpu/shader/execution/unpack4x8snorm.bin": "926f3f3e", + "webgpu/shader/execution/unpack4x8unorm.bin": "3640a996", + "webgpu/shader/execution/unary/af_arithmetic.bin": "bf05a1b1", + "webgpu/shader/execution/unary/af_assignment.bin": "d711e244", "webgpu/shader/execution/unary/bool_conversion.bin": "d0c1e5a3", - "webgpu/shader/execution/unary/f16_arithmetic.bin": "310a05dd", - "webgpu/shader/execution/unary/f16_conversion.bin": "9d94aa72", - "webgpu/shader/execution/unary/f32_arithmetic.bin": "fe955d67", - "webgpu/shader/execution/unary/f32_conversion.bin": "918f6cb3", + "webgpu/shader/execution/unary/f16_arithmetic.bin": "6095e89f", + "webgpu/shader/execution/unary/f16_conversion.bin": "76546200", + "webgpu/shader/execution/unary/f32_arithmetic.bin": "a16e7cf4", + "webgpu/shader/execution/unary/f32_conversion.bin": "62604b96", "webgpu/shader/execution/unary/i32_arithmetic.bin": "a8649cbb", "webgpu/shader/execution/unary/i32_conversion.bin": "e5157a69", "webgpu/shader/execution/unary/u32_conversion.bin": "d07d0c20", "webgpu/shader/execution/unary/ai_assignment.bin": "f62c765c", "webgpu/shader/execution/binary/ai_arithmetic.bin": "43501242", "webgpu/shader/execution/unary/ai_arithmetic.bin": "8e448c53", - "webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "7ea0df71", - "webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "4919c460", - "webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "33c10dad" + "webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "c57c159e", + "webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "d21017f3", + "webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "ddd2f83a" } \ No newline at end of file diff --git a/src/resources/cache/webgpu/shader/execution/determinant.bin b/src/resources/cache/webgpu/shader/execution/determinant.bin index cef09cd67bd1..d09c7df7e8aa 100644 Binary files a/src/resources/cache/webgpu/shader/execution/determinant.bin and b/src/resources/cache/webgpu/shader/execution/determinant.bin differ diff --git a/src/unittests/floating_point.spec.ts b/src/unittests/floating_point.spec.ts index 64f3bec47d08..472207d185a1 100644 --- a/src/unittests/floating_point.spec.ts +++ b/src/unittests/floating_point.spec.ts @@ -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([ // Extreme values, i.e. subnormals, very large magnitudes, and those lead to diff --git a/src/webgpu/shader/execution/expression/call/builtin/determinant.cache.ts b/src/webgpu/shader/execution/expression/call/builtin/determinant.cache.ts index 379b42b3e63c..4eab44009abe 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/determinant.cache.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/determinant.cache.ts @@ -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, }); diff --git a/src/webgpu/shader/execution/expression/call/builtin/determinant.spec.ts b/src/webgpu/shader/execution/expression/call/builtin/determinant.spec.ts index 8b259eedb33e..638af80acaf5 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/determinant.spec.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/determinant.spec.ts @@ -9,9 +9,9 @@ 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); @@ -19,8 +19,19 @@ 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') diff --git a/src/webgpu/util/floating_point.ts b/src/webgpu/util/floating_point.ts index 9b6fbeac39bd..36900e6da994 100644 --- a/src/webgpu/util/floating_point.ts +++ b/src/webgpu/util/floating_point.ts @@ -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,