Skip to content

Commit

Permalink
Convert AF radians to using f32 intervals
Browse files Browse the repository at this point in the history
  • Loading branch information
zoddicus committed Mar 13, 2024
1 parent 2fb2952 commit 3f116c9
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 111 deletions.
186 changes: 93 additions & 93 deletions src/resources/cache/hashes.json
Original file line number Diff line number Diff line change
@@ -1,110 +1,110 @@
{
"webgpu/shader/execution/binary/af_addition.bin": "f1dbf950",
"webgpu/shader/execution/binary/af_addition.bin": "9eb45421",
"webgpu/shader/execution/binary/af_logical.bin": "ffb5a83f",
"webgpu/shader/execution/binary/af_division.bin": "fca51cf6",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "e20df8ed",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "4a32fbd2",
"webgpu/shader/execution/binary/af_multiplication.bin": "bb98ad97",
"webgpu/shader/execution/binary/af_remainder.bin": "cdd12652",
"webgpu/shader/execution/binary/af_subtraction.bin": "4199fa14",
"webgpu/shader/execution/binary/f16_addition.bin": "e43a63bb",
"webgpu/shader/execution/binary/af_division.bin": "de076f1e",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "c4983e0e",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "9feb059b",
"webgpu/shader/execution/binary/af_multiplication.bin": "9e6ebec4",
"webgpu/shader/execution/binary/af_remainder.bin": "a32e769d",
"webgpu/shader/execution/binary/af_subtraction.bin": "61177380",
"webgpu/shader/execution/binary/f16_addition.bin": "9e9d90eb",
"webgpu/shader/execution/binary/f16_logical.bin": "65cdc6f",
"webgpu/shader/execution/binary/f16_division.bin": "5b57c0b",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "69c14caa",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "af9d0798",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "471dc059",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "67de8ee0",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "a0e5e120",
"webgpu/shader/execution/binary/f16_multiplication.bin": "96edf4f0",
"webgpu/shader/execution/binary/f16_remainder.bin": "bdf0fbbe",
"webgpu/shader/execution/binary/f16_subtraction.bin": "c9ddbdf7",
"webgpu/shader/execution/binary/f32_addition.bin": "6608d145",
"webgpu/shader/execution/binary/f16_division.bin": "666415f0",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "4320d411",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "e6b3d7c2",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "5cbb8071",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "faa611c7",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "dc3c41eb",
"webgpu/shader/execution/binary/f16_multiplication.bin": "a5fc0a92",
"webgpu/shader/execution/binary/f16_remainder.bin": "3af0f88d",
"webgpu/shader/execution/binary/f16_subtraction.bin": "8b998e2d",
"webgpu/shader/execution/binary/f32_addition.bin": "ef32f694",
"webgpu/shader/execution/binary/f32_logical.bin": "d40c1c0",
"webgpu/shader/execution/binary/f32_division.bin": "bd48ab03",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "3b073a66",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "3ccda0e1",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "7bd26720",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "ed158720",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "d031556",
"webgpu/shader/execution/binary/f32_multiplication.bin": "d8b1b339",
"webgpu/shader/execution/binary/f32_remainder.bin": "fd94b071",
"webgpu/shader/execution/binary/f32_subtraction.bin": "7b428ae0",
"webgpu/shader/execution/binary/f32_division.bin": "48e4ba24",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "c79b34d",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "325026ad",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "933a189d",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "6e535e50",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "2869473d",
"webgpu/shader/execution/binary/f32_multiplication.bin": "fc1186ab",
"webgpu/shader/execution/binary/f32_remainder.bin": "32d657b",
"webgpu/shader/execution/binary/f32_subtraction.bin": "ef9473ce",
"webgpu/shader/execution/binary/i32_arithmetic.bin": "90a3514a",
"webgpu/shader/execution/binary/i32_comparison.bin": "840b09e6",
"webgpu/shader/execution/binary/u32_arithmetic.bin": "e3f04e97",
"webgpu/shader/execution/binary/u32_comparison.bin": "dc1398d3",
"webgpu/shader/execution/abs.bin": "a505cfef",
"webgpu/shader/execution/acos.bin": "404a8f72",
"webgpu/shader/execution/acosh.bin": "b760cd22",
"webgpu/shader/execution/asin.bin": "dbdba994",
"webgpu/shader/execution/asinh.bin": "b1cc0f79",
"webgpu/shader/execution/atan.bin": "7848635b",
"webgpu/shader/execution/atan2.bin": "763fc00b",
"webgpu/shader/execution/atanh.bin": "e68c6755",
"webgpu/shader/execution/bitcast.bin": "ae7eeb7f",
"webgpu/shader/execution/ceil.bin": "c2caf77b",
"webgpu/shader/execution/clamp.bin": "5c898bc4",
"webgpu/shader/execution/cos.bin": "5cf59cde",
"webgpu/shader/execution/cosh.bin": "a90b92b3",
"webgpu/shader/execution/cross.bin": "7a13659f",
"webgpu/shader/execution/degrees.bin": "ae1d5c7",
"webgpu/shader/execution/determinant.bin": "451c9564",
"webgpu/shader/execution/distance.bin": "e960e6b0",
"webgpu/shader/execution/dot.bin": "f84a2a1c",
"webgpu/shader/execution/exp.bin": "413a7679",
"webgpu/shader/execution/exp2.bin": "68484513",
"webgpu/shader/execution/faceForward.bin": "70ec208d",
"webgpu/shader/execution/floor.bin": "91e8b401",
"webgpu/shader/execution/fma.bin": "dca65c44",
"webgpu/shader/execution/fract.bin": "1e817bc4",
"webgpu/shader/execution/frexp.bin": "ccf37407",
"webgpu/shader/execution/inverseSqrt.bin": "8ad74fd0",
"webgpu/shader/execution/ldexp.bin": "3a7558f7",
"webgpu/shader/execution/length.bin": "f5cd2fae",
"webgpu/shader/execution/log.bin": "ed5f5e1e",
"webgpu/shader/execution/log2.bin": "9cbeb01",
"webgpu/shader/execution/max.bin": "7a2513bd",
"webgpu/shader/execution/min.bin": "c214f9e1",
"webgpu/shader/execution/mix.bin": "4161f354",
"webgpu/shader/execution/modf.bin": "57203181",
"webgpu/shader/execution/normalize.bin": "c304a746",
"webgpu/shader/execution/abs.bin": "bca87b8c",
"webgpu/shader/execution/acos.bin": "3f5603a5",
"webgpu/shader/execution/acosh.bin": "a8875a25",
"webgpu/shader/execution/asin.bin": "bab6f342",
"webgpu/shader/execution/asinh.bin": "bde88a89",
"webgpu/shader/execution/atan.bin": "af7df4af",
"webgpu/shader/execution/atan2.bin": "5cf86da4",
"webgpu/shader/execution/atanh.bin": "e458d558",
"webgpu/shader/execution/bitcast.bin": "dfb626b7",
"webgpu/shader/execution/ceil.bin": "64101beb",
"webgpu/shader/execution/clamp.bin": "3a9658bb",
"webgpu/shader/execution/cos.bin": "d9e2fdc1",
"webgpu/shader/execution/cosh.bin": "a801c990",
"webgpu/shader/execution/cross.bin": "257f0e59",
"webgpu/shader/execution/degrees.bin": "6fe31435",
"webgpu/shader/execution/determinant.bin": "db8d4a91",
"webgpu/shader/execution/distance.bin": "4fe9d05a",
"webgpu/shader/execution/dot.bin": "e6c73702",
"webgpu/shader/execution/exp.bin": "d3439761",
"webgpu/shader/execution/exp2.bin": "9478db4a",
"webgpu/shader/execution/faceForward.bin": "f89fb733",
"webgpu/shader/execution/floor.bin": "cb2425fb",
"webgpu/shader/execution/fma.bin": "3861679a",
"webgpu/shader/execution/fract.bin": "47b65795",
"webgpu/shader/execution/frexp.bin": "4060828c",
"webgpu/shader/execution/inverseSqrt.bin": "1c83865",
"webgpu/shader/execution/ldexp.bin": "8a1be293",
"webgpu/shader/execution/length.bin": "8faddca1",
"webgpu/shader/execution/log.bin": "752f08a4",
"webgpu/shader/execution/log2.bin": "28cef00f",
"webgpu/shader/execution/max.bin": "fb314c29",
"webgpu/shader/execution/min.bin": "be180118",
"webgpu/shader/execution/mix.bin": "7a4b8bf5",
"webgpu/shader/execution/modf.bin": "c2c24951",
"webgpu/shader/execution/normalize.bin": "d2216ef4",
"webgpu/shader/execution/pack2x16float.bin": "d7ef3cf5",
"webgpu/shader/execution/pow.bin": "9ca01c97",
"webgpu/shader/execution/quantizeToF16.bin": "56c0f38c",
"webgpu/shader/execution/radians.bin": "2abe8f76",
"webgpu/shader/execution/reflect.bin": "3599e4f8",
"webgpu/shader/execution/refract.bin": "8ed6249a",
"webgpu/shader/execution/round.bin": "10ce2133",
"webgpu/shader/execution/saturate.bin": "109f6a25",
"webgpu/shader/execution/sign.bin": "e25dbf84",
"webgpu/shader/execution/sin.bin": "a43050b3",
"webgpu/shader/execution/sinh.bin": "dbff27bd",
"webgpu/shader/execution/smoothstep.bin": "a209dacd",
"webgpu/shader/execution/sqrt.bin": "4175f45e",
"webgpu/shader/execution/step.bin": "e093290d",
"webgpu/shader/execution/tan.bin": "5b2265d6",
"webgpu/shader/execution/tanh.bin": "5ebe5251",
"webgpu/shader/execution/transpose.bin": "1d2e4229",
"webgpu/shader/execution/trunc.bin": "74839ece",
"webgpu/shader/execution/unpack2x16float.bin": "c2b8a8ef",
"webgpu/shader/execution/unpack2x16snorm.bin": "705e3037",
"webgpu/shader/execution/unpack2x16unorm.bin": "304f4695",
"webgpu/shader/execution/unpack4x8snorm.bin": "54b7cfe2",
"webgpu/shader/execution/unpack4x8unorm.bin": "eac1bb31",
"webgpu/shader/execution/unary/af_arithmetic.bin": "e235624d",
"webgpu/shader/execution/unary/af_assignment.bin": "761fc0b2",
"webgpu/shader/execution/pow.bin": "f647a4e9",
"webgpu/shader/execution/quantizeToF16.bin": "33500681",
"webgpu/shader/execution/radians.bin": "76886ba3",
"webgpu/shader/execution/reflect.bin": "fcdb2c63",
"webgpu/shader/execution/refract.bin": "2d76960c",
"webgpu/shader/execution/round.bin": "eb65ebe1",
"webgpu/shader/execution/saturate.bin": "b08d9136",
"webgpu/shader/execution/sign.bin": "30c2965f",
"webgpu/shader/execution/sin.bin": "c78bab36",
"webgpu/shader/execution/sinh.bin": "3481832c",
"webgpu/shader/execution/smoothstep.bin": "ef2a23d",
"webgpu/shader/execution/sqrt.bin": "f91009cd",
"webgpu/shader/execution/step.bin": "11f45a43",
"webgpu/shader/execution/tan.bin": "f1995462",
"webgpu/shader/execution/tanh.bin": "dff61f36",
"webgpu/shader/execution/transpose.bin": "35fe674b",
"webgpu/shader/execution/trunc.bin": "7031163e",
"webgpu/shader/execution/unpack2x16float.bin": "a70b2830",
"webgpu/shader/execution/unpack2x16snorm.bin": "bd07bdcd",
"webgpu/shader/execution/unpack2x16unorm.bin": "43581190",
"webgpu/shader/execution/unpack4x8snorm.bin": "1efe3747",
"webgpu/shader/execution/unpack4x8unorm.bin": "c5d9e041",
"webgpu/shader/execution/unary/af_arithmetic.bin": "4e096cb9",
"webgpu/shader/execution/unary/af_assignment.bin": "6abf59c7",
"webgpu/shader/execution/unary/bool_conversion.bin": "f37ea003",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "ea443c43",
"webgpu/shader/execution/unary/f16_conversion.bin": "787418e7",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "28b06725",
"webgpu/shader/execution/unary/f32_conversion.bin": "e18e0b6d",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "17e0e747",
"webgpu/shader/execution/unary/f16_conversion.bin": "1d2a78dc",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "8f795ec1",
"webgpu/shader/execution/unary/f32_conversion.bin": "9fe8bcdb",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "25cf27d1",
"webgpu/shader/execution/unary/i32_conversion.bin": "276dcf69",
"webgpu/shader/execution/unary/u32_conversion.bin": "acac2172",
"webgpu/shader/execution/unary/ai_assignment.bin": "c876d431",
"webgpu/shader/execution/binary/ai_arithmetic.bin": "36a1d65b",
"webgpu/shader/execution/unary/ai_arithmetic.bin": "89e34dcf",
"webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "8ed7503d",
"webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "c0d4a6b1",
"webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "971ba0f4"
"webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "95570520",
"webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "5eb914a0",
"webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "c054f041"
}
Binary file modified src/resources/cache/webgpu/shader/execution/radians.bin
Binary file not shown.
16 changes: 1 addition & 15 deletions src/unittests/floating_point.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3487,26 +3487,12 @@ const kRadiansIntervalCases = {
{ input: 135, expected: [kMinusOneULPFunctions['f16'](kValue.f16.positive.pi.three_quarters), kPlusOneULPFunctions['f16'](kValue.f16.positive.pi.three_quarters)] },
{ input: 180, expected: [kMinusOneULPFunctions['f16'](kValue.f16.positive.pi.whole), kPlusOneULPFunctions['f16'](kValue.f16.positive.pi.whole)] },
] as ScalarToIntervalCase[],
abstract: [
{ input: -180, expected: kValue.f64.negative.pi.whole },
{ input: -135, expected: kValue.f64.negative.pi.three_quarters },
{ input: -90, expected: kValue.f64.negative.pi.half },
{ input: -60, expected: kValue.f64.negative.pi.third },
{ input: -45, expected: kValue.f64.negative.pi.quarter },
{ input: -30, expected: kValue.f64.negative.pi.sixth },
{ input: 30, expected: kValue.f64.positive.pi.sixth },
{ input: 45, expected: kValue.f64.positive.pi.quarter },
{ input: 60, expected: kValue.f64.positive.pi.third },
{ input: 90, expected: kValue.f64.positive.pi.half },
{ input: 135, expected: kValue.f64.positive.pi.three_quarters },
{ input: 180, expected: kValue.f64.positive.pi.whole },
] as ScalarToIntervalCase[],
} as const;

g.test('radiansInterval')
.params(u =>
u
.combine('trait', ['f32', 'f16', 'abstract'] as const)
.combine('trait', ['f32', 'f16'] as const)
.beginSubcases()
.expandWithParams<ScalarToIntervalCase>(p => {
const trait = p.trait;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ const cases = (['f32', 'f16', 'abstract'] as const)
[`${trait}`]: () => {
return FP[trait].generateScalarToIntervalCases(
FP[trait].scalarRange(),
'unfiltered',
FP[trait].radiansInterval
trait !== 'abstract' ? 'unfiltered' : 'finite',
// radians has an inherited accuracy, so abstract is only expected to be as accurate as f32
FP[trait !== 'abstract' ? trait : 'f32'].radiansInterval
);
},
}))
Expand Down
2 changes: 1 addition & 1 deletion src/webgpu/util/floating_point.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5196,7 +5196,7 @@ class FPAbstractTraits extends FPTraits {
'normalizeInterval'
);
public readonly powInterval = this.unimplementedScalarPairToInterval.bind(this, 'powInterval');
public readonly radiansInterval = this.radiansIntervalImpl.bind(this);
public readonly radiansInterval = this.unimplementedScalarToInterval.bind(this, 'radiansImpl');
public readonly reflectInterval = this.unimplementedVectorPairToVector.bind(
this,
'reflectInterval'
Expand Down

0 comments on commit 3f116c9

Please sign in to comment.