Skip to content

Commit

Permalink
Simplify some type constants (#3461)
Browse files Browse the repository at this point in the history
This CL adds `kAllScalarsAndVec` and a
`kConvertableToFloatScalarsAndVec` helper types which allow removing a
couple of the combined type helpers.
  • Loading branch information
dj2 authored Mar 7, 2024
1 parent ee19c8b commit adaa479
Show file tree
Hide file tree
Showing 31 changed files with 214 additions and 322 deletions.
216 changes: 108 additions & 108 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": "4440d4b4",
"webgpu/shader/execution/binary/af_logical.bin": "c54d7fff",
"webgpu/shader/execution/binary/af_division.bin": "d17fa436",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "7a788e99",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "f84dd903",
"webgpu/shader/execution/binary/af_multiplication.bin": "5334f9e1",
"webgpu/shader/execution/binary/af_remainder.bin": "470a66d7",
"webgpu/shader/execution/binary/af_subtraction.bin": "2c78e197",
"webgpu/shader/execution/binary/f16_addition.bin": "a579fc47",
"webgpu/shader/execution/binary/f16_logical.bin": "1f3267c4",
"webgpu/shader/execution/binary/f16_division.bin": "dfb9f322",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "ca9128f5",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "88155047",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "15278661",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "aaa23b6",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "7d9e4d5c",
"webgpu/shader/execution/binary/f16_multiplication.bin": "f9d4994",
"webgpu/shader/execution/binary/f16_remainder.bin": "244c4ad6",
"webgpu/shader/execution/binary/f16_subtraction.bin": "ed388083",
"webgpu/shader/execution/binary/f32_addition.bin": "22c323e7",
"webgpu/shader/execution/binary/f32_logical.bin": "b5a1fcd6",
"webgpu/shader/execution/binary/f32_division.bin": "af0c6a91",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "cea1c11f",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "4ca215e2",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "e0ecc16f",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "cd1f8542",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "d4d592a1",
"webgpu/shader/execution/binary/f32_multiplication.bin": "bad73246",
"webgpu/shader/execution/binary/f32_remainder.bin": "fd8b81ca",
"webgpu/shader/execution/binary/f32_subtraction.bin": "ab7a62cd",
"webgpu/shader/execution/binary/i32_arithmetic.bin": "390c929d",
"webgpu/shader/execution/binary/i32_comparison.bin": "21a872e9",
"webgpu/shader/execution/binary/u32_arithmetic.bin": "b6785d3e",
"webgpu/shader/execution/binary/u32_comparison.bin": "20e75aaf",
"webgpu/shader/execution/abs.bin": "7a1a8101",
"webgpu/shader/execution/acos.bin": "4f35a566",
"webgpu/shader/execution/acosh.bin": "1ddcdd7f",
"webgpu/shader/execution/asin.bin": "8c73cd",
"webgpu/shader/execution/asinh.bin": "9737e4c9",
"webgpu/shader/execution/atan.bin": "1274adbb",
"webgpu/shader/execution/atan2.bin": "6d414c8c",
"webgpu/shader/execution/atanh.bin": "ae463ca8",
"webgpu/shader/execution/bitcast.bin": "6acaafbe",
"webgpu/shader/execution/ceil.bin": "891015dc",
"webgpu/shader/execution/clamp.bin": "b1a757bd",
"webgpu/shader/execution/cos.bin": "1754b8bf",
"webgpu/shader/execution/cosh.bin": "db77b7bb",
"webgpu/shader/execution/cross.bin": "b4242751",
"webgpu/shader/execution/degrees.bin": "c19fa30",
"webgpu/shader/execution/determinant.bin": "28eea1a1",
"webgpu/shader/execution/distance.bin": "286532ef",
"webgpu/shader/execution/dot.bin": "68354d0d",
"webgpu/shader/execution/exp.bin": "8df9e76d",
"webgpu/shader/execution/exp2.bin": "494e5007",
"webgpu/shader/execution/faceForward.bin": "944e22",
"webgpu/shader/execution/floor.bin": "24434e6e",
"webgpu/shader/execution/fma.bin": "14d92aba",
"webgpu/shader/execution/fract.bin": "7bc1425a",
"webgpu/shader/execution/frexp.bin": "f6631fec",
"webgpu/shader/execution/inverseSqrt.bin": "511e859",
"webgpu/shader/execution/ldexp.bin": "f5d530d6",
"webgpu/shader/execution/length.bin": "b3dac96e",
"webgpu/shader/execution/log.bin": "34156eea",
"webgpu/shader/execution/log2.bin": "877d274b",
"webgpu/shader/execution/max.bin": "42174209",
"webgpu/shader/execution/min.bin": "e3ebfbb8",
"webgpu/shader/execution/mix.bin": "fd942c9a",
"webgpu/shader/execution/modf.bin": "1679c273",
"webgpu/shader/execution/normalize.bin": "be31d825",
"webgpu/shader/execution/pack2x16float.bin": "7e3e86c3",
"webgpu/shader/execution/pow.bin": "bf4ec2d7",
"webgpu/shader/execution/quantizeToF16.bin": "5d067d96",
"webgpu/shader/execution/radians.bin": "ebe086b6",
"webgpu/shader/execution/reflect.bin": "700f38a0",
"webgpu/shader/execution/refract.bin": "c859267f",
"webgpu/shader/execution/round.bin": "88045cd4",
"webgpu/shader/execution/saturate.bin": "dae68a14",
"webgpu/shader/execution/sign.bin": "91b4c481",
"webgpu/shader/execution/sin.bin": "1300bbbf",
"webgpu/shader/execution/sinh.bin": "27ab484c",
"webgpu/shader/execution/smoothstep.bin": "cfcaa136",
"webgpu/shader/execution/sqrt.bin": "4ae8ec04",
"webgpu/shader/execution/step.bin": "a83d7ab5",
"webgpu/shader/execution/tan.bin": "68b7a197",
"webgpu/shader/execution/tanh.bin": "32474b6e",
"webgpu/shader/execution/transpose.bin": "84e5ec15",
"webgpu/shader/execution/trunc.bin": "2fb9f2b",
"webgpu/shader/execution/unpack2x16float.bin": "4eef83ca",
"webgpu/shader/execution/unpack2x16snorm.bin": "5a8de9dc",
"webgpu/shader/execution/unpack2x16unorm.bin": "24b228cc",
"webgpu/shader/execution/unpack4x8snorm.bin": "7d98eec7",
"webgpu/shader/execution/unpack4x8unorm.bin": "546459f9",
"webgpu/shader/execution/unary/af_arithmetic.bin": "e31cea5d",
"webgpu/shader/execution/unary/af_assignment.bin": "ce59880f",
"webgpu/shader/execution/unary/bool_conversion.bin": "1bae513f",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "9276efd8",
"webgpu/shader/execution/unary/f16_conversion.bin": "254f60da",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "ed5d236e",
"webgpu/shader/execution/unary/f32_conversion.bin": "c570be4c",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "cc46fe",
"webgpu/shader/execution/unary/i32_conversion.bin": "457ade75",
"webgpu/shader/execution/unary/u32_conversion.bin": "4900fd1c",
"webgpu/shader/execution/unary/ai_assignment.bin": "1bdfc2f",
"webgpu/shader/execution/binary/ai_arithmetic.bin": "80388ed7",
"webgpu/shader/execution/unary/ai_arithmetic.bin": "fb7c8c8b",
"webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "64af08ac",
"webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "58e9a3ca",
"webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "77ca543f"
"webgpu/shader/execution/binary/af_addition.bin": "1a138e40",
"webgpu/shader/execution/binary/af_logical.bin": "2a334d4b",
"webgpu/shader/execution/binary/af_division.bin": "801a63d2",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "d392437a",
"webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin": "8a56ca30",
"webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin": "3b36edc4",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "c2a167d1",
"webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin": "3bdd724b",
"webgpu/shader/execution/binary/af_multiplication.bin": "af6472be",
"webgpu/shader/execution/binary/af_remainder.bin": "582570bc",
"webgpu/shader/execution/binary/af_subtraction.bin": "65e85cff",
"webgpu/shader/execution/binary/ai_arithmetic.bin": "3876accd",
"webgpu/shader/execution/binary/f16_addition.bin": "12057229",
"webgpu/shader/execution/binary/f16_logical.bin": "b6ee9faf",
"webgpu/shader/execution/binary/f16_division.bin": "9f3479f0",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "a19f6dc5",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "be7786cc",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "afbc3dd2",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "84f6917",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "9036e4da",
"webgpu/shader/execution/binary/f16_multiplication.bin": "946528a5",
"webgpu/shader/execution/binary/f16_remainder.bin": "6e7cb89",
"webgpu/shader/execution/binary/f16_subtraction.bin": "55fe509d",
"webgpu/shader/execution/binary/f32_addition.bin": "3d2058bb",
"webgpu/shader/execution/binary/f32_logical.bin": "390ba598",
"webgpu/shader/execution/binary/f32_division.bin": "73fa9316",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "afb0e609",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "745cb3d9",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "1fa39b30",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "a0b386f7",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "89c1eca2",
"webgpu/shader/execution/binary/f32_multiplication.bin": "712f02a6",
"webgpu/shader/execution/binary/f32_remainder.bin": "8304c08d",
"webgpu/shader/execution/binary/f32_subtraction.bin": "ccdf094f",
"webgpu/shader/execution/binary/i32_arithmetic.bin": "8a775ab8",
"webgpu/shader/execution/binary/i32_comparison.bin": "dd37b753",
"webgpu/shader/execution/binary/u32_arithmetic.bin": "c3781404",
"webgpu/shader/execution/binary/u32_comparison.bin": "bed8f168",
"webgpu/shader/execution/abs.bin": "61e06f54",
"webgpu/shader/execution/acos.bin": "1402a723",
"webgpu/shader/execution/acosh.bin": "828c987f",
"webgpu/shader/execution/asin.bin": "557d3d3f",
"webgpu/shader/execution/asinh.bin": "be348f39",
"webgpu/shader/execution/atan.bin": "963520fc",
"webgpu/shader/execution/atan2.bin": "a912218b",
"webgpu/shader/execution/atanh.bin": "f46f32cc",
"webgpu/shader/execution/bitcast.bin": "44bd25ea",
"webgpu/shader/execution/ceil.bin": "7debbc4c",
"webgpu/shader/execution/clamp.bin": "26d3bfb",
"webgpu/shader/execution/cos.bin": "a64fea9a",
"webgpu/shader/execution/cosh.bin": "dfd5945e",
"webgpu/shader/execution/cross.bin": "4835bc3a",
"webgpu/shader/execution/degrees.bin": "528e631e",
"webgpu/shader/execution/determinant.bin": "e3866c2b",
"webgpu/shader/execution/distance.bin": "4d015170",
"webgpu/shader/execution/dot.bin": "c67a6363",
"webgpu/shader/execution/exp.bin": "c483696",
"webgpu/shader/execution/exp2.bin": "b248fa4b",
"webgpu/shader/execution/faceForward.bin": "429078d0",
"webgpu/shader/execution/floor.bin": "2f4fb64b",
"webgpu/shader/execution/fma.bin": "8cf2c018",
"webgpu/shader/execution/fract.bin": "4fe1141d",
"webgpu/shader/execution/frexp.bin": "38dd5724",
"webgpu/shader/execution/inverseSqrt.bin": "b010463d",
"webgpu/shader/execution/ldexp.bin": "94762c6c",
"webgpu/shader/execution/length.bin": "9007cea7",
"webgpu/shader/execution/log.bin": "8918d035",
"webgpu/shader/execution/log2.bin": "55ab0d73",
"webgpu/shader/execution/max.bin": "ea6871eb",
"webgpu/shader/execution/min.bin": "da3976b4",
"webgpu/shader/execution/mix.bin": "716aa87b",
"webgpu/shader/execution/modf.bin": "97fb95d0",
"webgpu/shader/execution/normalize.bin": "b4b3d66d",
"webgpu/shader/execution/pack2x16float.bin": "65dca45b",
"webgpu/shader/execution/pow.bin": "9c93c51e",
"webgpu/shader/execution/quantizeToF16.bin": "9bba3a59",
"webgpu/shader/execution/radians.bin": "31835823",
"webgpu/shader/execution/reflect.bin": "cef377fe",
"webgpu/shader/execution/refract.bin": "6a72b15f",
"webgpu/shader/execution/round.bin": "eb65ff2d",
"webgpu/shader/execution/saturate.bin": "6be2db42",
"webgpu/shader/execution/sign.bin": "6c0ac68f",
"webgpu/shader/execution/sin.bin": "6548201",
"webgpu/shader/execution/sinh.bin": "df389ed",
"webgpu/shader/execution/smoothstep.bin": "90af9360",
"webgpu/shader/execution/sqrt.bin": "37f1d81b",
"webgpu/shader/execution/step.bin": "a2a1103e",
"webgpu/shader/execution/tan.bin": "db82969",
"webgpu/shader/execution/tanh.bin": "9469a1c6",
"webgpu/shader/execution/transpose.bin": "51d503cb",
"webgpu/shader/execution/trunc.bin": "c5e6ed27",
"webgpu/shader/execution/unpack2x16float.bin": "a4812794",
"webgpu/shader/execution/unpack2x16snorm.bin": "48982cdb",
"webgpu/shader/execution/unpack2x16unorm.bin": "8a52d694",
"webgpu/shader/execution/unpack4x8snorm.bin": "de64f4f",
"webgpu/shader/execution/unpack4x8unorm.bin": "42074fbd",
"webgpu/shader/execution/unary/af_arithmetic.bin": "677d6662",
"webgpu/shader/execution/unary/af_assignment.bin": "9035f5c0",
"webgpu/shader/execution/unary/ai_arithmetic.bin": "62304038",
"webgpu/shader/execution/unary/ai_assignment.bin": "d0ecdfb1",
"webgpu/shader/execution/unary/bool_conversion.bin": "9df31641",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "55060b95",
"webgpu/shader/execution/unary/f16_conversion.bin": "2a471445",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "de075203",
"webgpu/shader/execution/unary/f32_conversion.bin": "8c96deed",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "11e8bb3",
"webgpu/shader/execution/unary/i32_conversion.bin": "a3062e7d",
"webgpu/shader/execution/unary/u32_conversion.bin": "c1c5240c"
}
Binary file modified src/resources/cache/webgpu/shader/execution/bitcast.bin
Binary file not shown.
12 changes: 2 additions & 10 deletions src/webgpu/shader/validation/expression/call/builtin/abs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@ Validation tests for the ${builtin}() builtin.

import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
import { keysOf, objectsToRecord } from '../../../../../../common/util/data_tables.js';
import {
TypeF16,
elementType,
kAllFloatAndConcreteIntegerScalarsAndVectors,
kAllAbstractIntegerScalarAndVectors,
} from '../../../../../util/conversion.js';
import { TypeF16, elementType, kAllScalarsAndVectors } from '../../../../../util/conversion.js';
import { ShaderValidationTest } from '../../../shader_validation_test.js';

import {
Expand All @@ -22,10 +17,7 @@ import {

export const g = makeTestGroup(ShaderValidationTest);

const kValuesTypes = objectsToRecord([
...kAllAbstractIntegerScalarAndVectors,
...kAllFloatAndConcreteIntegerScalarsAndVectors,
]);
const kValuesTypes = objectsToRecord(kAllScalarsAndVectors);

g.test('values')
.desc(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import {
TypeF16,
TypeF32,
elementType,
kAllFloatScalarsAndVectors,
kAllConcreteIntegerScalarsAndVectors,
kAllAbstractIntegerScalarAndVectors,
kConvertableToFloatScalarsAndVectors,
} from '../../../../../util/conversion.js';
import { absBigInt } from '../../../../../util/math.js';
import { ShaderValidationTest } from '../../../shader_validation_test.js';
Expand All @@ -27,10 +26,7 @@ import {

export const g = makeTestGroup(ShaderValidationTest);

const kValuesTypes = objectsToRecord([
...kAllAbstractIntegerScalarAndVectors,
...kAllFloatScalarsAndVectors,
]);
const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors);

g.test('values')
.desc(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import {
TypeF16,
TypeF32,
elementType,
kAllFloatScalarsAndVectors,
kAllConcreteIntegerScalarsAndVectors,
TypeAbstractInt,
kAllAbstractIntegerScalarAndVectors,
kConvertableToFloatScalarsAndVectors,
TypeAbstractFloat,
} from '../../../../../util/conversion.js';
import { isRepresentable } from '../../../../../util/floating_point.js';
Expand All @@ -29,10 +28,7 @@ import {

export const g = makeTestGroup(ShaderValidationTest);

const kValuesTypes = objectsToRecord([
...kAllAbstractIntegerScalarAndVectors,
...kAllFloatScalarsAndVectors,
]);
const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors);

g.test('values')
.desc(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import {
TypeF16,
TypeF32,
elementType,
kAllFloatScalarsAndVectors,
kAllConcreteIntegerScalarsAndVectors,
kAllAbstractIntegerScalarAndVectors,
kConvertableToFloatScalarsAndVectors,
} from '../../../../../util/conversion.js';
import { absBigInt } from '../../../../../util/math.js';
import { ShaderValidationTest } from '../../../shader_validation_test.js';
Expand All @@ -27,10 +26,7 @@ import {

export const g = makeTestGroup(ShaderValidationTest);

const kValuesTypes = objectsToRecord([
...kAllAbstractIntegerScalarAndVectors,
...kAllFloatScalarsAndVectors,
]);
const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors);

g.test('values')
.desc(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import {
TypeF16,
TypeF32,
elementType,
kAllFloatScalarsAndVectors,
kAllConcreteIntegerScalarsAndVectors,
kAllAbstractIntegerScalarAndVectors,
kConvertableToFloatScalarsAndVectors,
TypeAbstractFloat,
} from '../../../../../util/conversion.js';
import { isRepresentable } from '../../../../../util/floating_point.js';
Expand All @@ -29,10 +28,7 @@ import {

export const g = makeTestGroup(ShaderValidationTest);

const kValuesTypes = objectsToRecord([
...kAllAbstractIntegerScalarAndVectors,
...kAllFloatScalarsAndVectors,
]);
const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors);

const additionalRangeForType = rangeForType(
linearRange(-2000, 2000, 10),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import {
TypeF16,
TypeF32,
elementType,
kAllFloatScalarsAndVectors,
kAllConcreteIntegerScalarsAndVectors,
kAllAbstractIntegerScalarAndVectors,
kConvertableToFloatScalarsAndVectors,
} from '../../../../../util/conversion.js';
import { ShaderValidationTest } from '../../../shader_validation_test.js';

Expand All @@ -26,10 +25,7 @@ import {

export const g = makeTestGroup(ShaderValidationTest);

const kValuesTypes = objectsToRecord([
...kAllAbstractIntegerScalarAndVectors,
...kAllFloatScalarsAndVectors,
]);
const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors);

g.test('values')
.desc(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import {
TypeF16,
TypeF32,
elementType,
kAllFloatScalarsAndVectors,
kAllConcreteIntegerScalarsAndVectors,
kAllAbstractIntegerScalarAndVectors,
kConvertableToFloatScalarsAndVectors,
} from '../../../../../util/conversion.js';
import { absBigInt } from '../../../../../util/math.js';
import { ShaderValidationTest } from '../../../shader_validation_test.js';
Expand All @@ -27,10 +26,7 @@ import {

export const g = makeTestGroup(ShaderValidationTest);

const kValuesTypes = objectsToRecord([
...kAllAbstractIntegerScalarAndVectors,
...kAllFloatScalarsAndVectors,
]);
const kValuesTypes = objectsToRecord(kConvertableToFloatScalarsAndVectors);

g.test('values')
.desc(
Expand Down
Loading

0 comments on commit adaa479

Please sign in to comment.