diff --git a/src/resources/cache/hashes.json b/src/resources/cache/hashes.json index 2602b6a27686..91b6df380707 100644 --- a/src/resources/cache/hashes.json +++ b/src/resources/cache/hashes.json @@ -1,110 +1,110 @@ { - "webgpu/shader/execution/binary/af_addition.bin": "f50d0054", + "webgpu/shader/execution/binary/af_addition.bin": "bf3ae06", "webgpu/shader/execution/binary/af_logical.bin": "ef38f267", - "webgpu/shader/execution/binary/af_division.bin": "dabbb1d1", - "webgpu/shader/execution/binary/af_matrix_addition.bin": "8d41501a", - "webgpu/shader/execution/binary/af_matrix_subtraction.bin": "2b5eb822", - "webgpu/shader/execution/binary/af_multiplication.bin": "6fb45595", - "webgpu/shader/execution/binary/af_remainder.bin": "25e662b1", - "webgpu/shader/execution/binary/af_subtraction.bin": "37703233", - "webgpu/shader/execution/binary/f16_addition.bin": "a712df38", + "webgpu/shader/execution/binary/af_division.bin": "fafc77c8", + "webgpu/shader/execution/binary/af_matrix_addition.bin": "fa177b5b", + "webgpu/shader/execution/binary/af_matrix_subtraction.bin": "9cf34b2", + "webgpu/shader/execution/binary/af_multiplication.bin": "686e5e21", + "webgpu/shader/execution/binary/af_remainder.bin": "94ccecc", + "webgpu/shader/execution/binary/af_subtraction.bin": "4d8686fd", + "webgpu/shader/execution/binary/f16_addition.bin": "d0d530ac", "webgpu/shader/execution/binary/f16_logical.bin": "e4f7d8", - "webgpu/shader/execution/binary/f16_division.bin": "4793560a", - "webgpu/shader/execution/binary/f16_matrix_addition.bin": "a079337b", - "webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "65fe996", - "webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "3f97acdd", - "webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "1fc983d8", - "webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "7e97d699", - "webgpu/shader/execution/binary/f16_multiplication.bin": "c77e8821", - "webgpu/shader/execution/binary/f16_remainder.bin": "e57bdbd7", - "webgpu/shader/execution/binary/f16_subtraction.bin": "85420ccf", - "webgpu/shader/execution/binary/f32_addition.bin": "d2790380", + "webgpu/shader/execution/binary/f16_division.bin": "898593ab", + "webgpu/shader/execution/binary/f16_matrix_addition.bin": "637db92b", + "webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "c8f1a925", + "webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "e91e6c5b", + "webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "50873c75", + "webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "52a070e5", + "webgpu/shader/execution/binary/f16_multiplication.bin": "44bc464a", + "webgpu/shader/execution/binary/f16_remainder.bin": "ac57c535", + "webgpu/shader/execution/binary/f16_subtraction.bin": "2b8aac48", + "webgpu/shader/execution/binary/f32_addition.bin": "577b7a76", "webgpu/shader/execution/binary/f32_logical.bin": "d8a1e4a4", - "webgpu/shader/execution/binary/f32_division.bin": "a75642db", - "webgpu/shader/execution/binary/f32_matrix_addition.bin": "5b0b0511", - "webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "671efb98", - "webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "bea0478c", - "webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "e6fc9dfb", - "webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "b6b1b664", - "webgpu/shader/execution/binary/f32_multiplication.bin": "8c8cf117", - "webgpu/shader/execution/binary/f32_remainder.bin": "43e749be", - "webgpu/shader/execution/binary/f32_subtraction.bin": "50da2154", + "webgpu/shader/execution/binary/f32_division.bin": "e6f60c9d", + "webgpu/shader/execution/binary/f32_matrix_addition.bin": "4fc9f17b", + "webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "156e72fe", + "webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "c4e91ad4", + "webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "5405cf5f", + "webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "4f66b507", + "webgpu/shader/execution/binary/f32_multiplication.bin": "715dc2f4", + "webgpu/shader/execution/binary/f32_remainder.bin": "8e4be37a", + "webgpu/shader/execution/binary/f32_subtraction.bin": "5abda25e", "webgpu/shader/execution/binary/i32_arithmetic.bin": "ecb16a4f", "webgpu/shader/execution/binary/i32_comparison.bin": "579cc94", "webgpu/shader/execution/binary/u32_arithmetic.bin": "e08964b4", "webgpu/shader/execution/binary/u32_comparison.bin": "8c8538e1", - "webgpu/shader/execution/abs.bin": "5c17e46c", - "webgpu/shader/execution/acos.bin": "120bfdf", - "webgpu/shader/execution/acosh.bin": "942cc2bb", - "webgpu/shader/execution/asin.bin": "fe636cf0", - "webgpu/shader/execution/asinh.bin": "61d55466", - "webgpu/shader/execution/atan.bin": "cac44506", - "webgpu/shader/execution/atan2.bin": "3403e5f", - "webgpu/shader/execution/atanh.bin": "6221541c", - "webgpu/shader/execution/bitcast.bin": "945e5c2a", - "webgpu/shader/execution/ceil.bin": "ad590261", - "webgpu/shader/execution/clamp.bin": "fb7095fa", - "webgpu/shader/execution/cos.bin": "f76f3cfc", - "webgpu/shader/execution/cosh.bin": "23274e7d", - "webgpu/shader/execution/cross.bin": "d81d20b", - "webgpu/shader/execution/degrees.bin": "ad65e311", - "webgpu/shader/execution/determinant.bin": "eb512a79", - "webgpu/shader/execution/distance.bin": "868585b7", - "webgpu/shader/execution/dot.bin": "db38aa67", - "webgpu/shader/execution/exp.bin": "62705ef9", - "webgpu/shader/execution/exp2.bin": "54d0df5e", - "webgpu/shader/execution/faceForward.bin": "f7e3a12b", - "webgpu/shader/execution/floor.bin": "6083291e", - "webgpu/shader/execution/fma.bin": "3cb81190", - "webgpu/shader/execution/fract.bin": "d000d278", - "webgpu/shader/execution/frexp.bin": "15d2eb99", - "webgpu/shader/execution/inverseSqrt.bin": "98598f6b", - "webgpu/shader/execution/ldexp.bin": "7cda090b", - "webgpu/shader/execution/length.bin": "a092226a", - "webgpu/shader/execution/log.bin": "4afb8069", - "webgpu/shader/execution/log2.bin": "5c10d479", - "webgpu/shader/execution/max.bin": "38cb6596", - "webgpu/shader/execution/min.bin": "715e13fc", - "webgpu/shader/execution/mix.bin": "67a69982", - "webgpu/shader/execution/modf.bin": "e9d534e0", - "webgpu/shader/execution/normalize.bin": "ec5df722", + "webgpu/shader/execution/abs.bin": "f8801ad2", + "webgpu/shader/execution/acos.bin": "673d5cf9", + "webgpu/shader/execution/acosh.bin": "f91a6ac", + "webgpu/shader/execution/asin.bin": "a59ddc71", + "webgpu/shader/execution/asinh.bin": "6c8a3fa2", + "webgpu/shader/execution/atan.bin": "2341951b", + "webgpu/shader/execution/atan2.bin": "707a6ee6", + "webgpu/shader/execution/atanh.bin": "a1096ca2", + "webgpu/shader/execution/bitcast.bin": "2ac72475", + "webgpu/shader/execution/ceil.bin": "2e67c5c4", + "webgpu/shader/execution/clamp.bin": "4a5836b9", + "webgpu/shader/execution/cos.bin": "443d655f", + "webgpu/shader/execution/cosh.bin": "fca4dd60", + "webgpu/shader/execution/cross.bin": "3e5471e7", + "webgpu/shader/execution/degrees.bin": "8d3e219a", + "webgpu/shader/execution/determinant.bin": "4a49329b", + "webgpu/shader/execution/distance.bin": "5cdd40f", + "webgpu/shader/execution/dot.bin": "a4d750a6", + "webgpu/shader/execution/exp.bin": "ad3e6a81", + "webgpu/shader/execution/exp2.bin": "9ba05ca6", + "webgpu/shader/execution/faceForward.bin": "7a466882", + "webgpu/shader/execution/floor.bin": "7d4586be", + "webgpu/shader/execution/fma.bin": "8d775005", + "webgpu/shader/execution/fract.bin": "e838086b", + "webgpu/shader/execution/frexp.bin": "9ad27d6c", + "webgpu/shader/execution/inverseSqrt.bin": "1c027186", + "webgpu/shader/execution/ldexp.bin": "cf2687", + "webgpu/shader/execution/length.bin": "a41ed029", + "webgpu/shader/execution/log.bin": "2486d6a4", + "webgpu/shader/execution/log2.bin": "48c2fbc6", + "webgpu/shader/execution/max.bin": "366dfedf", + "webgpu/shader/execution/min.bin": "62678a1c", + "webgpu/shader/execution/mix.bin": "da85e9ff", + "webgpu/shader/execution/modf.bin": "3dbf4565", + "webgpu/shader/execution/normalize.bin": "3e50626e", "webgpu/shader/execution/pack2x16float.bin": "e4852967", - "webgpu/shader/execution/pow.bin": "8b43d36d", - "webgpu/shader/execution/quantizeToF16.bin": "34152620", - "webgpu/shader/execution/radians.bin": "9953e412", - "webgpu/shader/execution/reflect.bin": "59fae21b", - "webgpu/shader/execution/refract.bin": "79650096", - "webgpu/shader/execution/round.bin": "b4533213", - "webgpu/shader/execution/saturate.bin": "37ca84d0", - "webgpu/shader/execution/sign.bin": "c2e029fd", - "webgpu/shader/execution/sin.bin": "14319b5", - "webgpu/shader/execution/sinh.bin": "bfa704c1", - "webgpu/shader/execution/smoothstep.bin": "6370f69a", - "webgpu/shader/execution/sqrt.bin": "98926bdc", - "webgpu/shader/execution/step.bin": "7375ba92", - "webgpu/shader/execution/tan.bin": "9bc439ef", - "webgpu/shader/execution/tanh.bin": "a3a298d2", - "webgpu/shader/execution/transpose.bin": "e9f7ab2e", - "webgpu/shader/execution/trunc.bin": "49dfcdee", - "webgpu/shader/execution/unpack2x16float.bin": "d93977ea", - "webgpu/shader/execution/unpack2x16snorm.bin": "764c0f13", - "webgpu/shader/execution/unpack2x16unorm.bin": "cf870fc1", - "webgpu/shader/execution/unpack4x8snorm.bin": "3ed6a27e", - "webgpu/shader/execution/unpack4x8unorm.bin": "8df9108c", - "webgpu/shader/execution/unary/af_arithmetic.bin": "80129d46", - "webgpu/shader/execution/unary/af_assignment.bin": "966a724a", + "webgpu/shader/execution/pow.bin": "21ba9907", + "webgpu/shader/execution/quantizeToF16.bin": "86ae5507", + "webgpu/shader/execution/radians.bin": "efe07b63", + "webgpu/shader/execution/reflect.bin": "ecca7f3", + "webgpu/shader/execution/refract.bin": "cbc6ee56", + "webgpu/shader/execution/round.bin": "fc63138c", + "webgpu/shader/execution/saturate.bin": "54962adf", + "webgpu/shader/execution/sign.bin": "f337e357", + "webgpu/shader/execution/sin.bin": "a85a62e4", + "webgpu/shader/execution/sinh.bin": "edff3e84", + "webgpu/shader/execution/smoothstep.bin": "78c0b9e3", + "webgpu/shader/execution/sqrt.bin": "e6250bfe", + "webgpu/shader/execution/step.bin": "6c2c5478", + "webgpu/shader/execution/tan.bin": "b781defb", + "webgpu/shader/execution/tanh.bin": "d24fd5a5", + "webgpu/shader/execution/transpose.bin": "f1837096", + "webgpu/shader/execution/trunc.bin": "a5d65b7a", + "webgpu/shader/execution/unpack2x16float.bin": "850398c1", + "webgpu/shader/execution/unpack2x16snorm.bin": "7638d3bc", + "webgpu/shader/execution/unpack2x16unorm.bin": "783f5118", + "webgpu/shader/execution/unpack4x8snorm.bin": "cd15f4f7", + "webgpu/shader/execution/unpack4x8unorm.bin": "4e624556", + "webgpu/shader/execution/unary/af_arithmetic.bin": "e1dda110", + "webgpu/shader/execution/unary/af_assignment.bin": "b597501", "webgpu/shader/execution/unary/bool_conversion.bin": "d0c1e5a3", - "webgpu/shader/execution/unary/f16_arithmetic.bin": "408620de", - "webgpu/shader/execution/unary/f16_conversion.bin": "46c02cf1", - "webgpu/shader/execution/unary/f32_arithmetic.bin": "378a4095", - "webgpu/shader/execution/unary/f32_conversion.bin": "4743152f", + "webgpu/shader/execution/unary/f16_arithmetic.bin": "758df9ab", + "webgpu/shader/execution/unary/f16_conversion.bin": "3c867dbe", + "webgpu/shader/execution/unary/f32_arithmetic.bin": "38095f11", + "webgpu/shader/execution/unary/f32_conversion.bin": "55c7c689", "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": "a82361ec", "webgpu/shader/execution/unary/ai_arithmetic.bin": "8e448c53", - "webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "d55eea17", - "webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "31afee59", - "webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "255e4937" + "webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "b7efe356", + "webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "6bbce64b", + "webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "3eee02c0" } \ No newline at end of file diff --git a/src/unittests/floating_point.spec.ts b/src/unittests/floating_point.spec.ts index 472207d185a1..0c5c32ecd2e3 100644 --- a/src/unittests/floating_point.spec.ts +++ b/src/unittests/floating_point.spec.ts @@ -1836,27 +1836,24 @@ interface AbsoluteErrorCase { const kSmallAbsoluteErrorValue = { f32: 2 ** -11, // Builtin cos and sin has a absolute error 2**-11 for f32 f16: 2 ** -7, // Builtin cos and sin has a absolute error 2**-7 for f16 - abstract: 2 ** -11, // Builtin cos and sin has a absolute error 2**-11 for AbstractFloat } as const; // A large absolute error value is a representable value x that much smaller than maximum // positive, but positive.max - x is still exactly representable. const kLargeAbsoluteErrorValue = { f32: 2 ** 110, // f32.positive.max - 2**110 = 3.4028104e+38 = 0x7f7fffbf in f32 f16: 2 ** 10, // f16.positive.max - 2**10 = 64480 = 0x7bdf in f16 - abstract: 2 ** 977, // f64.positive.man - 2**977 = 1.79769e+308 = 0x7fefffffffffffbf in f64 } as const; // A subnormal absolute error value is a subnormal representable value x of kind, which ensures // that positive.subnormal.min +/- x is still exactly representable. const kSubnormalAbsoluteErrorValue = { f32: 2 ** -140, // f32 0x00000200 f16: 2 ** -20, // f16 0x0010 - abstract: 2 ** -1065, // f64 0x0000_0000_0000_0200 } as const; g.test('absoluteErrorInterval') .params(u => u - .combine('trait', ['f32', 'f16', 'abstract'] as const) + .combine('trait', ['f32', 'f16'] as const) .beginSubcases() .expandWithParams(p => { const trait = FP[p.trait]; @@ -1865,26 +1862,6 @@ g.test('absoluteErrorInterval') const largeErr = kLargeAbsoluteErrorValue[p.trait]; const subnormalErr = kSubnormalAbsoluteErrorValue[p.trait]; - // Additional testing for non-f64 values, since JS number is f64 internally - // prettier-ignore - const additionalSubnormal64bit = p.trait !== 'abstract' ? - [ - // 64-bit subnormals, expected to be treated as 0.0 or smallest subnormal of kind. - { value: reinterpretU64AsF64(0x0000_0000_0000_0001n), error: 0, expected: [0, constants.positive.subnormal.min] }, - { value: reinterpretU64AsF64(0x0000_0000_0000_0001n), error: subnormalErr, expected: [-subnormalErr, constants.positive.subnormal.min + subnormalErr] }, - // Note that f32 minimum subnormal is so smaller than 1.0, adding them together may result in the f64 results 1.0. - { value: reinterpretU64AsF64(0x0000_0000_0000_0001n), error: 1, expected: [-1, constants.positive.subnormal.min + 1] }, - { value: reinterpretU64AsF64(0x0000_0000_0000_0002n), error: 0, expected: [0, constants.positive.subnormal.min] }, - { value: reinterpretU64AsF64(0x0000_0000_0000_0002n), error: subnormalErr, expected: [-subnormalErr, constants.positive.subnormal.min + subnormalErr] }, - { value: reinterpretU64AsF64(0x0000_0000_0000_0002n), error: 1, expected: [-1, constants.positive.subnormal.min + 1] }, - { value: reinterpretU64AsF64(0x800f_ffff_ffff_ffffn), error: 0, expected: [constants.negative.subnormal.max, 0] }, - { value: reinterpretU64AsF64(0x800f_ffff_ffff_ffffn), error: subnormalErr, expected: [constants.negative.subnormal.max - subnormalErr, subnormalErr] }, - { value: reinterpretU64AsF64(0x800f_ffff_ffff_ffffn), error: 1, expected: [constants.negative.subnormal.max - 1, 1] }, - { value: reinterpretU64AsF64(0x800f_ffff_ffff_fffen), error: 0, expected: [constants.negative.subnormal.max, 0] }, - { value: reinterpretU64AsF64(0x800f_ffff_ffff_fffen), error: subnormalErr, expected: [constants.negative.subnormal.max - subnormalErr, subnormalErr] }, - { value: reinterpretU64AsF64(0x800f_ffff_ffff_fffen), error: 1, expected: [constants.negative.subnormal.max - 1, 1] }, - ] as const : [] as const; - // prettier-ignore return [ // Edge Cases @@ -1940,7 +1917,20 @@ g.test('absoluteErrorInterval') { value: -2, error: smallErr, expected: [-2 - smallErr, -2 + smallErr] }, { value: -2, error: 1, expected: [-3, -1] }, - ...additionalSubnormal64bit, + // 64-bit subnormals, expected to be treated as 0.0 or smallest subnormal of kind. + { value: reinterpretU64AsF64(0x0000_0000_0000_0001n), error: 0, expected: [0, constants.positive.subnormal.min] }, + { value: reinterpretU64AsF64(0x0000_0000_0000_0001n), error: subnormalErr, expected: [-subnormalErr, constants.positive.subnormal.min + subnormalErr] }, + // Note that f32 minimum subnormal is so smaller than 1.0, adding them together may result in the f64 results 1.0. + { value: reinterpretU64AsF64(0x0000_0000_0000_0001n), error: 1, expected: [-1, constants.positive.subnormal.min + 1] }, + { value: reinterpretU64AsF64(0x0000_0000_0000_0002n), error: 0, expected: [0, constants.positive.subnormal.min] }, + { value: reinterpretU64AsF64(0x0000_0000_0000_0002n), error: subnormalErr, expected: [-subnormalErr, constants.positive.subnormal.min + subnormalErr] }, + { value: reinterpretU64AsF64(0x0000_0000_0000_0002n), error: 1, expected: [-1, constants.positive.subnormal.min + 1] }, + { value: reinterpretU64AsF64(0x800f_ffff_ffff_ffffn), error: 0, expected: [constants.negative.subnormal.max, 0] }, + { value: reinterpretU64AsF64(0x800f_ffff_ffff_ffffn), error: subnormalErr, expected: [constants.negative.subnormal.max - subnormalErr, subnormalErr] }, + { value: reinterpretU64AsF64(0x800f_ffff_ffff_ffffn), error: 1, expected: [constants.negative.subnormal.max - 1, 1] }, + { value: reinterpretU64AsF64(0x800f_ffff_ffff_fffen), error: 0, expected: [constants.negative.subnormal.max, 0] }, + { value: reinterpretU64AsF64(0x800f_ffff_ffff_fffen), error: subnormalErr, expected: [constants.negative.subnormal.max - subnormalErr, subnormalErr] }, + { value: reinterpretU64AsF64(0x800f_ffff_ffff_fffen), error: 1, expected: [constants.negative.subnormal.max - 1, 1] }, ]; }) ) @@ -2102,7 +2092,7 @@ const kULPErrorValue = { g.test('ulpInterval') .params(u => u - .combine('trait', ['abstract', 'f32', 'f16'] as const) + .combine('trait', ['f32', 'f16'] as const) .beginSubcases() .expandWithParams(p => { const trait = kFPTraitForULP[p.trait]; diff --git a/src/webgpu/util/floating_point.ts b/src/webgpu/util/floating_point.ts index 36900e6da994..7887d82aaf70 100644 --- a/src/webgpu/util/floating_point.ts +++ b/src/webgpu/util/floating_point.ts @@ -1047,14 +1047,14 @@ export abstract class FPTraits { unreachable(`'refract' is not yet implemented for '${this.kind}'`); } - /** Version of absoluteErrorInterval that always returns the unboundedInterval */ - protected unboundedAbsoluteErrorInterval(_n: number, _error_range: number): FPInterval { - return this.constants().unboundedInterval; + /** Stub for absolute errors */ + protected unimplementedAbsoluteErrorInterval(_n: number, _error_range: number): FPInterval { + unreachable(`Absolute Error is not implement for '${this.kind}'`); } - /** Version of ulpInterval that always returns the unboundedInterval */ - protected unboundedUlpInterval(_n: number, _numULP: number): FPInterval { - return this.constants().unboundedInterval; + /** Stub for ULP errors */ + protected unimplementedUlpInterval(_n: number, _numULP: number): FPInterval { + unreachable(`ULP Error is not implement for '${this.kind}'`); } // Utilities - Defined by subclass @@ -5091,12 +5091,10 @@ class FPAbstractTraits extends FPTraits { public readonly sparseMatrixRange = sparseMatrixF64Range; // Framework - Fundamental Error Intervals - Overrides - public readonly absoluteErrorInterval = this.absoluteErrorIntervalImpl.bind(this); + public readonly absoluteErrorInterval = this.unimplementedAbsoluteErrorInterval.bind(this); // Should use FP.f32 instead public readonly correctlyRoundedInterval = this.correctlyRoundedIntervalImpl.bind(this); public readonly correctlyRoundedMatrix = this.correctlyRoundedMatrixImpl.bind(this); - public readonly ulpInterval = (n: number, numULP: number): FPInterval => { - return this.toInterval(kF32Traits.ulpInterval(n, numULP)); - }; + public readonly ulpInterval = this.unimplementedUlpInterval.bind(this); // Should use FP.f32 instead // Framework - API - Overrides public readonly absInterval = this.absIntervalImpl.bind(this);