Skip to content

Commit

Permalink
wgsl: Implement AbstractFloat ceil execution tests
Browse files Browse the repository at this point in the history
Issue #1297
  • Loading branch information
zoddicus committed Feb 29, 2024
1 parent 69b12ab commit e34294c
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 104 deletions.
180 changes: 90 additions & 90 deletions src/resources/cache/hashes.json
Original file line number Diff line number Diff line change
@@ -1,103 +1,103 @@
{
"webgpu/shader/execution/binary/af_addition.bin": "8d0f30f7",
"webgpu/shader/execution/binary/af_addition.bin": "ea80d56",
"webgpu/shader/execution/binary/af_logical.bin": "6f90d890",
"webgpu/shader/execution/binary/af_division.bin": "62bb30ee",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "ffcf0ff6",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "93e789f4",
"webgpu/shader/execution/binary/af_multiplication.bin": "fb0289ae",
"webgpu/shader/execution/binary/af_remainder.bin": "d6498bff",
"webgpu/shader/execution/binary/af_subtraction.bin": "f5a08d60",
"webgpu/shader/execution/binary/f16_addition.bin": "a6b5ed00",
"webgpu/shader/execution/binary/af_division.bin": "c7d76829",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "84bcd350",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "731bf6c7",
"webgpu/shader/execution/binary/af_multiplication.bin": "5da4f18c",
"webgpu/shader/execution/binary/af_remainder.bin": "53344fdb",
"webgpu/shader/execution/binary/af_subtraction.bin": "b08d523d",
"webgpu/shader/execution/binary/f16_addition.bin": "8791a6a4",
"webgpu/shader/execution/binary/f16_logical.bin": "d4267b82",
"webgpu/shader/execution/binary/f16_division.bin": "b2a99359",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "c283fb3e",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "62c8af83",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "7b1745df",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "81aaa2af",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "effb48b4",
"webgpu/shader/execution/binary/f16_multiplication.bin": "514e3fd6",
"webgpu/shader/execution/binary/f16_remainder.bin": "3b28785e",
"webgpu/shader/execution/binary/f16_subtraction.bin": "bcd36671",
"webgpu/shader/execution/binary/f32_addition.bin": "f0bba966",
"webgpu/shader/execution/binary/f16_division.bin": "2dff0f8d",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "aee82596",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "a8c764bb",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "721565e6",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "c34efc86",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "2dfe0475",
"webgpu/shader/execution/binary/f16_multiplication.bin": "3c8abb35",
"webgpu/shader/execution/binary/f16_remainder.bin": "7b2b3e2c",
"webgpu/shader/execution/binary/f16_subtraction.bin": "b371ebf0",
"webgpu/shader/execution/binary/f32_addition.bin": "8876cd61",
"webgpu/shader/execution/binary/f32_logical.bin": "673ceb6f",
"webgpu/shader/execution/binary/f32_division.bin": "3be818fd",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "9959f181",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "40e03a0b",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "9e3271b4",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "3391a792",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "b06af5df",
"webgpu/shader/execution/binary/f32_multiplication.bin": "e417c2ad",
"webgpu/shader/execution/binary/f32_remainder.bin": "c81d1149",
"webgpu/shader/execution/binary/f32_subtraction.bin": "e24bccfb",
"webgpu/shader/execution/binary/f32_division.bin": "2e8a2452",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "1d20ddc8",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "6f38c905",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "c8be4144",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "17cf51ec",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "409071a7",
"webgpu/shader/execution/binary/f32_multiplication.bin": "408674e2",
"webgpu/shader/execution/binary/f32_remainder.bin": "b57f2f24",
"webgpu/shader/execution/binary/f32_subtraction.bin": "d880f72f",
"webgpu/shader/execution/binary/i32_arithmetic.bin": "77c30f31",
"webgpu/shader/execution/binary/i32_comparison.bin": "acb55d71",
"webgpu/shader/execution/binary/u32_arithmetic.bin": "8c21844",
"webgpu/shader/execution/binary/u32_comparison.bin": "47006c1e",
"webgpu/shader/execution/abs.bin": "609c82f5",
"webgpu/shader/execution/acos.bin": "5a5119aa",
"webgpu/shader/execution/acosh.bin": "b8678003",
"webgpu/shader/execution/asin.bin": "a3699bc",
"webgpu/shader/execution/asinh.bin": "d4e7d221",
"webgpu/shader/execution/atan.bin": "89581e73",
"webgpu/shader/execution/atan2.bin": "60de18cf",
"webgpu/shader/execution/atanh.bin": "25f3bf40",
"webgpu/shader/execution/bitcast.bin": "55637893",
"webgpu/shader/execution/ceil.bin": "7387e75d",
"webgpu/shader/execution/clamp.bin": "ec485cef",
"webgpu/shader/execution/cos.bin": "5936a955",
"webgpu/shader/execution/cosh.bin": "c34185a7",
"webgpu/shader/execution/cross.bin": "47741063",
"webgpu/shader/execution/degrees.bin": "4732b47",
"webgpu/shader/execution/determinant.bin": "fa978d0c",
"webgpu/shader/execution/distance.bin": "5729aae8",
"webgpu/shader/execution/dot.bin": "ba6b9056",
"webgpu/shader/execution/exp.bin": "f35017fd",
"webgpu/shader/execution/exp2.bin": "49d0add6",
"webgpu/shader/execution/faceForward.bin": "aa5ad639",
"webgpu/shader/execution/floor.bin": "f6918e48",
"webgpu/shader/execution/fma.bin": "58287b5a",
"webgpu/shader/execution/fract.bin": "e4575525",
"webgpu/shader/execution/frexp.bin": "279c7c5c",
"webgpu/shader/execution/inverseSqrt.bin": "748c6766",
"webgpu/shader/execution/ldexp.bin": "a7fb97ac",
"webgpu/shader/execution/length.bin": "93dcf7f8",
"webgpu/shader/execution/log.bin": "112fbabe",
"webgpu/shader/execution/log2.bin": "2da3da02",
"webgpu/shader/execution/max.bin": "51bdd68f",
"webgpu/shader/execution/min.bin": "7b207776",
"webgpu/shader/execution/mix.bin": "9b7c2c7c",
"webgpu/shader/execution/modf.bin": "7219e40e",
"webgpu/shader/execution/normalize.bin": "14a04a26",
"webgpu/shader/execution/abs.bin": "1bfab115",
"webgpu/shader/execution/acos.bin": "b3259b79",
"webgpu/shader/execution/acosh.bin": "466f581c",
"webgpu/shader/execution/asin.bin": "fb406d56",
"webgpu/shader/execution/asinh.bin": "691f037",
"webgpu/shader/execution/atan.bin": "862f82d6",
"webgpu/shader/execution/atan2.bin": "db0bc309",
"webgpu/shader/execution/atanh.bin": "75faea7b",
"webgpu/shader/execution/bitcast.bin": "8de38799",
"webgpu/shader/execution/ceil.bin": "604deee6",
"webgpu/shader/execution/clamp.bin": "17877293",
"webgpu/shader/execution/cos.bin": "545712d1",
"webgpu/shader/execution/cosh.bin": "c18b0dcd",
"webgpu/shader/execution/cross.bin": "64fa57a3",
"webgpu/shader/execution/degrees.bin": "a77b56b4",
"webgpu/shader/execution/determinant.bin": "94d6ddd2",
"webgpu/shader/execution/distance.bin": "44bc254f",
"webgpu/shader/execution/dot.bin": "5173ee71",
"webgpu/shader/execution/exp.bin": "d072dc9a",
"webgpu/shader/execution/exp2.bin": "302a2f67",
"webgpu/shader/execution/faceForward.bin": "7ea474df",
"webgpu/shader/execution/floor.bin": "c9a82828",
"webgpu/shader/execution/fma.bin": "937aba99",
"webgpu/shader/execution/fract.bin": "d0998b42",
"webgpu/shader/execution/frexp.bin": "b605b329",
"webgpu/shader/execution/inverseSqrt.bin": "71ddb922",
"webgpu/shader/execution/ldexp.bin": "8997d2c7",
"webgpu/shader/execution/length.bin": "6abba166",
"webgpu/shader/execution/log.bin": "1d5bead8",
"webgpu/shader/execution/log2.bin": "f34860a8",
"webgpu/shader/execution/max.bin": "faf2c56e",
"webgpu/shader/execution/min.bin": "963aabcd",
"webgpu/shader/execution/mix.bin": "8a3c9ccd",
"webgpu/shader/execution/modf.bin": "67ac3457",
"webgpu/shader/execution/normalize.bin": "4406090c",
"webgpu/shader/execution/pack2x16float.bin": "37c8eb38",
"webgpu/shader/execution/pow.bin": "ac8520ee",
"webgpu/shader/execution/quantizeToF16.bin": "9252e236",
"webgpu/shader/execution/radians.bin": "5b50053b",
"webgpu/shader/execution/reflect.bin": "5699ed6b",
"webgpu/shader/execution/refract.bin": "3f78b15b",
"webgpu/shader/execution/round.bin": "94c7bef5",
"webgpu/shader/execution/saturate.bin": "90c116dd",
"webgpu/shader/execution/sign.bin": "520aeb67",
"webgpu/shader/execution/sin.bin": "8ea07595",
"webgpu/shader/execution/sinh.bin": "d1def282",
"webgpu/shader/execution/smoothstep.bin": "639ea26f",
"webgpu/shader/execution/sqrt.bin": "78bf8dac",
"webgpu/shader/execution/step.bin": "8187b37a",
"webgpu/shader/execution/tan.bin": "2fb1b66f",
"webgpu/shader/execution/tanh.bin": "76b7e183",
"webgpu/shader/execution/transpose.bin": "c8906ac0",
"webgpu/shader/execution/trunc.bin": "22fda1bd",
"webgpu/shader/execution/unpack2x16float.bin": "980ea3a8",
"webgpu/shader/execution/unpack2x16snorm.bin": "6a181f0b",
"webgpu/shader/execution/unpack2x16unorm.bin": "aeabbab9",
"webgpu/shader/execution/unpack4x8snorm.bin": "c8460176",
"webgpu/shader/execution/unpack4x8unorm.bin": "30b9abb3",
"webgpu/shader/execution/unary/af_arithmetic.bin": "3119c00e",
"webgpu/shader/execution/unary/af_assignment.bin": "bbdefb2",
"webgpu/shader/execution/pow.bin": "6320884f",
"webgpu/shader/execution/quantizeToF16.bin": "e771bd0e",
"webgpu/shader/execution/radians.bin": "819ea63a",
"webgpu/shader/execution/reflect.bin": "9c73af2f",
"webgpu/shader/execution/refract.bin": "21a1342e",
"webgpu/shader/execution/round.bin": "c14cc321",
"webgpu/shader/execution/saturate.bin": "dc9896d5",
"webgpu/shader/execution/sign.bin": "2f523875",
"webgpu/shader/execution/sin.bin": "466147ea",
"webgpu/shader/execution/sinh.bin": "d7e1aad5",
"webgpu/shader/execution/smoothstep.bin": "6a13fca1",
"webgpu/shader/execution/sqrt.bin": "564e38ed",
"webgpu/shader/execution/step.bin": "59ecf995",
"webgpu/shader/execution/tan.bin": "474e722a",
"webgpu/shader/execution/tanh.bin": "e0a949cc",
"webgpu/shader/execution/transpose.bin": "bed2d80d",
"webgpu/shader/execution/trunc.bin": "c202335d",
"webgpu/shader/execution/unpack2x16float.bin": "da503b5b",
"webgpu/shader/execution/unpack2x16snorm.bin": "3ff18b37",
"webgpu/shader/execution/unpack2x16unorm.bin": "7d699752",
"webgpu/shader/execution/unpack4x8snorm.bin": "b694868a",
"webgpu/shader/execution/unpack4x8unorm.bin": "2306c922",
"webgpu/shader/execution/unary/af_arithmetic.bin": "9172dad6",
"webgpu/shader/execution/unary/af_assignment.bin": "9682e382",
"webgpu/shader/execution/unary/bool_conversion.bin": "70c51822",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "8d1065e0",
"webgpu/shader/execution/unary/f16_conversion.bin": "944968d0",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "efb7b8b9",
"webgpu/shader/execution/unary/f32_conversion.bin": "ee857943",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "b678d45a",
"webgpu/shader/execution/unary/f16_conversion.bin": "72647cd4",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "d90dca0c",
"webgpu/shader/execution/unary/f32_conversion.bin": "74bb74c9",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "cc125c13",
"webgpu/shader/execution/unary/i32_conversion.bin": "fb4402f9",
"webgpu/shader/execution/unary/u32_conversion.bin": "579a043f",
Expand Down
Binary file modified src/resources/cache/webgpu/shader/execution/bitcast.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/ceil.bin
Binary file not shown.
9 changes: 7 additions & 2 deletions src/unittests/floating_point.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2657,12 +2657,17 @@ const kCeilIntervalCases = {
{ input: -(2 ** 14), expected: -(2 ** 14) },
{ input: 0x8000, expected: 0x8000 }, // https://github.com/gpuweb/cts/issues/2766
],
abstract: [
{ input: 2 ** 52, expected: 2 ** 52 },
{ input: -(2 ** 52), expected: -(2 ** 52) },
{ input: 0x8000000000000000, expected: 0x8000000000000000 }, // https://github.com/gpuweb/cts/issues/2766
],
} as const;

g.test('ceilInterval')
.params(u =>
u
.combine('trait', ['f32', 'f16'] as const)
.combine('trait', ['f32', 'f16', 'abstract'] as const)
.beginSubcases()
.expandWithParams<ScalarToIntervalCase>(p => {
const constants = FP[p.trait].constants();
Expand All @@ -2689,7 +2694,7 @@ g.test('ceilInterval')
{ input: constants.negative.max, expected: 0 },
...kCeilIntervalCases[p.trait],

// 32-bit subnormals
// Subnormals
{ input: constants.positive.subnormal.max, expected: [0, 1] },
{ input: constants.positive.subnormal.min, expected: [0, 1] },
{ input: constants.negative.subnormal.min, expected: 0 },
Expand Down
8 changes: 3 additions & 5 deletions src/webgpu/listing_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -1678,9 +1678,9 @@
"webgpu:shader,execution,flow_control,switch:switch:*": { "subcaseMS": 12.750 },
"webgpu:shader,execution,flow_control,switch:switch_default:*": { "subcaseMS": 5.400 },
"webgpu:shader,execution,flow_control,switch:switch_default_only:*": { "subcaseMS": 12.550 },
"webgpu:shader,execution,flow_control,switch:switch_inside_loop_with_continue:*": { "subcaseMS": 0.000 },
"webgpu:shader,execution,flow_control,switch:switch_multiple_case:*": { "subcaseMS": 5.550 },
"webgpu:shader,execution,flow_control,switch:switch_multiple_case_default:*": { "subcaseMS": 12.000 },
"webgpu:shader,execution,flow_control,switch:switch_inside_loop_with_continue:*": { "subcaseMS": 0 },
"webgpu:shader,execution,flow_control,while:while_basic:*": { "subcaseMS": 5.951 },
"webgpu:shader,execution,flow_control,while:while_break:*": { "subcaseMS": 12.450 },
"webgpu:shader,execution,flow_control,while:while_continue:*": { "subcaseMS": 5.650 },
Expand Down Expand Up @@ -1833,8 +1833,8 @@
"webgpu:shader,validation,expression,call,builtin,cosh:values:*": { "subcaseMS": 0.272 },
"webgpu:shader,validation,expression,call,builtin,degrees:integer_argument:*": { "subcaseMS": 1.311 },
"webgpu:shader,validation,expression,call,builtin,degrees:values:*": { "subcaseMS": 0.303 },
"webgpu:shader,validation,expression,call,builtin,derivatives:only_in_fragment:*": { "subcaseMS": 1.000 },
"webgpu:shader,validation,expression,call,builtin,derivatives:invalid_argument_types:*": { "subcaseMS": 1.000 },
"webgpu:shader,validation,expression,call,builtin,derivatives:only_in_fragment:*": { "subcaseMS": 1.000 },
"webgpu:shader,validation,expression,call,builtin,dot4I8Packed:bad_args:*": { "subcaseMS": 0.302 },
"webgpu:shader,validation,expression,call,builtin,dot4I8Packed:must_use:*": { "subcaseMS": 0.300 },
"webgpu:shader,validation,expression,call,builtin,dot4I8Packed:supported:*": { "subcaseMS": 1.100 },
Expand Down Expand Up @@ -1902,10 +1902,8 @@
"webgpu:shader,validation,expression,call,builtin,unpack4xU8:must_use:*": { "subcaseMS": 32.800 },
"webgpu:shader,validation,expression,call,builtin,unpack4xU8:supported:*": { "subcaseMS": 98.501 },
"webgpu:shader,validation,expression,call,builtin,unpack4xU8:unsupported:*": { "subcaseMS": 346.801 },
"webgpu:shader,validation,expression,call,builtin,workgroupUniformLoad:only_in_compute:*": { "subcaseMS": 1.000 },
"webgpu:shader,validation,expression,call,builtin,workgroupUniformLoad:no_atomics:*": { "subcaseMS": 1.000 },
"webgpu:shader,validation,extension,pointer_composite_access:deref:*": { "subcaseMS": 0.0 },
"webgpu:shader,validation,extension,pointer_composite_access:pointer:*": { "subcaseMS": 0.0 },
"webgpu:shader,validation,expression,call,builtin,workgroupUniformLoad:only_in_compute:*": { "subcaseMS": 1.000 },
"webgpu:shader,validation,expression,unary,address_of_and_indirection:basic:*": { "subcaseMS": 0.000 },
"webgpu:shader,validation,expression,unary,address_of_and_indirection:composite:*": { "subcaseMS": 0.000 },
"webgpu:shader,validation,expression,unary,address_of_and_indirection:invalid:*": { "subcaseMS": 0.000 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ const kSmallMagnitudeTestValues = [0.1, 0.9, 1.0, 1.1, 1.9, -0.1, -0.9, -1.0, -1
const kIssue2766Value = {
f32: 0x8000_0000,
f16: 0x8000,
abstract: 0x8000_0000_0000_0000,
};

// Cases: [f32|f16]
const cases = (['f32', 'f16'] as const)
const cases = (['f32', 'f16', 'abstract'] as const)
.map(trait => ({
[`${trait}`]: () => {
return FP[trait].generateScalarToIntervalCases(
Expand Down
22 changes: 17 additions & 5 deletions src/webgpu/shader/execution/expression/call/builtin/ceil.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Returns the ceiling of e. Component-wise when T is a vector.

import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
import { GPUTest } from '../../../../../gpu_test.js';
import { TypeF16, TypeF32 } from '../../../../../util/conversion.js';
import { allInputSources, run } from '../../expression.js';
import { TypeAbstractFloat, TypeF16, TypeF32 } from '../../../../../util/conversion.js';
import { allInputSources, onlyConstInputSource, run } from '../../expression.js';

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

export const g = makeTestGroup(GPUTest);
Expand All @@ -22,9 +22,21 @@ g.test('abstract_float')
.specURL('https://www.w3.org/TR/WGSL/#float-builtin-functions')
.desc(`abstract float tests`)
.params(u =>
u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const)
u
.combine('inputSource', onlyConstInputSource)
.combine('vectorize', [undefined, 2, 3, 4] as const)
)
.unimplemented();
.fn(async t => {
const cases = await d.get('abstract');
await run(
t,
abstractFloatBuiltin('ceil'),
[TypeAbstractFloat],
TypeAbstractFloat,
t.params,
cases
);
});

g.test('f32')
.specURL('https://www.w3.org/TR/WGSL/#float-builtin-functions')
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 @@ -5120,7 +5120,7 @@ class FPAbstractTraits extends FPTraits {
'atan2Interval'
);
public readonly atanhInterval = this.unimplementedScalarToInterval.bind(this, 'atanhInterval');
public readonly ceilInterval = this.unimplementedScalarToInterval.bind(this, 'ceilInterval');
public readonly ceilInterval = this.ceilIntervalImpl.bind(this);
public readonly clampMedianInterval = this.clampMedianIntervalImpl.bind(this);
public readonly clampMinMaxInterval = this.clampMinMaxIntervalImpl.bind(this);
public readonly clampIntervals = [this.clampMedianInterval, this.clampMinMaxInterval];
Expand Down

0 comments on commit e34294c

Please sign in to comment.