Skip to content

Commit

Permalink
wgsl: Cleanup duplicate description text (#1396)
Browse files Browse the repository at this point in the history
The description for each builtin was placed in the specific test `desc` field
when it would be better in the testsuite `description`. This PR moves the
descriptions up to the `description` block.
  • Loading branch information
dj2 authored May 11, 2022
1 parent aafa50d commit 6822b93
Show file tree
Hide file tree
Showing 71 changed files with 687 additions and 1,554 deletions.
73 changes: 19 additions & 54 deletions src/webgpu/shader/execution/expression/call/builtin/abs.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
export const description = `
Execution tests for the 'abs' builtin function
S is AbstractInt, i32, or u32
T is S or vecN<S>
@const fn abs(e: T ) -> T
The absolute value of e. Component-wise when T is a vector. If e is a signed
integral scalar type and evaluates to the largest negative value, then the
result is e. If e is an unsigned integral type, then the result is e.
S is AbstractFloat, f32, f16
T is S or vecN<S>
@const fn abs(e: T ) -> T
Returns the absolute value of e (e.g. e with a positive sign bit).
Component-wise when T is a vector.
`;

import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
Expand All @@ -23,16 +36,7 @@ export const g = makeTestGroup(GPUTest);

g.test('abstract_int')
.specURL('https://www.w3.org/TR/WGSL/#integer-builtin-functions')
.desc(
`
S is AbstractInt, i32, or u32
T is S or vecN<S>
@const fn abs(e: T ) -> T
The absolute value of e. Component-wise when T is a vector. If e is a signed
integral scalar type and evaluates to the largest negative value, then the
result is e. If e is an unsigned integral type, then the result is e.
`
)
.desc(`abstract int tests`)
.params(u =>
u
.combine('storageClass', ['uniform', 'storage_r', 'storage_rw'] as const)
Expand All @@ -42,16 +46,7 @@ result is e. If e is an unsigned integral type, then the result is e.

g.test('u32')
.specURL('https://www.w3.org/TR/WGSL/#integer-builtin-functions')
.desc(
`
S is AbstractInt, i32, or u32
T is S or vecN<S>
@const fn abs(e: T ) -> T
The absolute value of e. Component-wise when T is a vector. If e is a signed
integral scalar type and evaluates to the largest negative value, then the
result is e. If e is an unsigned integral type, then the result is e.
`
)
.desc(`unsigned int tests`)
.params(u =>
u
.combine('storageClass', ['uniform', 'storage_r', 'storage_rw'] as const)
Expand Down Expand Up @@ -100,16 +95,7 @@ result is e. If e is an unsigned integral type, then the result is e.

g.test('i32')
.specURL('https://www.w3.org/TR/WGSL/#integer-builtin-functions')
.desc(
`
S is AbstractInt, i32, or u32
T is S or vecN<S>
@const fn abs(e: T ) -> T
The absolute value of e. Component-wise when T is a vector. If e is a signed
integral scalar type and evaluates to the largest negative value, then the
result is e. If e is an unsigned integral type, then the result is e.
`
)
.desc(`signed int tests`)
.params(u =>
u
.combine('storageClass', ['uniform', 'storage_r', 'storage_rw'] as const)
Expand Down Expand Up @@ -164,14 +150,7 @@ result is e. If e is an unsigned integral type, then the result is e.

g.test('abstract_float')
.specURL('https://www.w3.org/TR/WGSL/#float-builtin-functions')
.desc(
`
T is AbstractFloat, f32, f16, vecN<AbstractFloat>, vecN<f32>, or vecN<f16>
@const fn abs(e: T ) -> T
Returns the absolute value of e (e.g. e with a positive sign bit).
Component-wise when T is a vector.
`
)
.desc(`abstract float tests`)
.params(u =>
u
.combine('storageClass', ['uniform', 'storage_r', 'storage_rw'] as const)
Expand All @@ -181,14 +160,7 @@ Component-wise when T is a vector.

g.test('f32')
.specURL('https://www.w3.org/TR/WGSL/#float-builtin-functions')
.desc(
`
T is AbstractFloat, f32, f16, vecN<AbstractFloat>, vecN<f32>, or vecN<f16>
@const fn abs(e: T ) -> T
Returns the absolute value of e (e.g. e with a positive sign bit).
Component-wise when T is a vector.
`
)
.desc(`float 32 tests`)
.params(u =>
u
.combine('storageClass', ['uniform', 'storage_r', 'storage_rw'] as const)
Expand All @@ -213,14 +185,7 @@ Component-wise when T is a vector.

g.test('f16')
.specURL('https://www.w3.org/TR/WGSL/#float-builtin-functions')
.desc(
`
T is AbstractFloat, f32, f16, vecN<AbstractFloat>, vecN<f32>, or vecN<f16>
@const fn abs(e: T ) -> T
Returns the absolute value of e (e.g. e with a positive sign bit).
Component-wise when T is a vector.
`
)
.desc(`f16 tests`)
.params(u =>
u
.combine('storageClass', ['uniform', 'storage_r', 'storage_rw'] as const)
Expand Down
29 changes: 8 additions & 21 deletions src/webgpu/shader/execution/expression/call/builtin/acos.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
export const description = `
Execution tests for the 'acos' builtin function
S is AbstractFloat, f32, f16
T is S or vecN<S>
@const fn acos(e: T ) -> T
Returns the arc cosine of e. Component-wise when T is a vector.
`;

import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
Expand All @@ -9,13 +14,7 @@ export const g = makeTestGroup(GPUTest);

g.test('abstract_float')
.specURL('https://www.w3.org/TR/WGSL/#float-builtin-functions')
.desc(
`
T is AbstractFloat, f32, f16, vecN<AbstractFloat>, vecN<f32>, or vecN<f16>
@const fn acos(e: T ) -> T
Returns the arc cosine of e. Component-wise when T is a vector.
`
)
.desc(`abstract float tests`)
.params(u =>
u
.combine('storageClass', ['uniform', 'storage_r', 'storage_rw'] as const)
Expand All @@ -25,13 +24,7 @@ Returns the arc cosine of e. Component-wise when T is a vector.

g.test('f32')
.specURL('https://www.w3.org/TR/WGSL/#float-builtin-functions')
.desc(
`
T is AbstractFloat, f32, f16, vecN<AbstractFloat>, vecN<f32>, or vecN<f16>
@const fn acos(e: T ) -> T
Returns the arc cosine of e. Component-wise when T is a vector.
`
)
.desc(`f32 tests`)
.params(u =>
u
.combine('storageClass', ['uniform', 'storage_r', 'storage_rw'] as const)
Expand All @@ -41,13 +34,7 @@ Returns the arc cosine of e. Component-wise when T is a vector.

g.test('f16')
.specURL('https://www.w3.org/TR/WGSL/#float-builtin-functions')
.desc(
`
T is AbstractFloat, f32, f16, vecN<AbstractFloat>, vecN<f32>, or vecN<f16>
@const fn acos(e: T ) -> T
Returns the arc cosine of e. Component-wise when T is a vector.
`
)
.desc(`f16 tests`)
.params(u =>
u
.combine('storageClass', ['uniform', 'storage_r', 'storage_rw'] as const)
Expand Down
42 changes: 12 additions & 30 deletions src/webgpu/shader/execution/expression/call/builtin/acosh.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
export const description = `
Execution tests for the 'acosh' builtin function
S is AbstractFloat, f32, f16
T is S or vecN<S>
@const fn acosh(e: T ) -> T
Returns the hyperbolic arc cosine of e. The result is 0 when e < 1.
Computes the non-negative functional inverse of cosh.
Component-wise when T is a vector.
Note: The result is not mathematically meaningful when e < 1.
`;

import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
Expand All @@ -9,16 +18,7 @@ export const g = makeTestGroup(GPUTest);

g.test('abstract_float')
.specURL('https://www.w3.org/TR/WGSL/#float-builtin-functions')
.desc(
`
T is AbstractFloat, f32, f16, vecN<AbstractFloat>, vecN<f32>, or vecN<f16>
@const fn acosh(e: T ) -> T
Returns the hyperbolic arc cosine of e. The result is 0 when e < 1.
Computes the non-negative functional inverse of cosh.
Component-wise when T is a vector.
Note: The result is not mathematically meaningful when e < 1.
`
)
.desc(`abstract float tests`)
.params(u =>
u
.combine('storageClass', ['uniform', 'storage_r', 'storage_rw'] as const)
Expand All @@ -28,16 +28,7 @@ Note: The result is not mathematically meaningful when e < 1.

g.test('f32')
.specURL('https://www.w3.org/TR/WGSL/#float-builtin-functions')
.desc(
`
T is AbstractFloat, f32, f16, vecN<AbstractFloat>, vecN<f32>, or vecN<f16>
@const fn acosh(e: T ) -> T
Returns the hyperbolic arc cosine of e. The result is 0 when e < 1.
Computes the non-negative functional inverse of cosh.
Component-wise when T is a vector.
Note: The result is not mathematically meaningful when e < 1.
`
)
.desc(`f32 tests`)
.params(u =>
u
.combine('storageClass', ['uniform', 'storage_r', 'storage_rw'] as const)
Expand All @@ -47,16 +38,7 @@ Note: The result is not mathematically meaningful when e < 1.

g.test('f16')
.specURL('https://www.w3.org/TR/WGSL/#float-builtin-functions')
.desc(
`
T is AbstractFloat, f32, f16, vecN<AbstractFloat>, vecN<f32>, or vecN<f16>
@const fn acosh(e: T ) -> T
Returns the hyperbolic arc cosine of e. The result is 0 when e < 1.
Computes the non-negative functional inverse of cosh.
Component-wise when T is a vector.
Note: The result is not mathematically meaningful when e < 1.
`
)
.desc(`f16 tests`)
.params(u =>
u
.combine('storageClass', ['uniform', 'storage_r', 'storage_rw'] as const)
Expand Down
19 changes: 7 additions & 12 deletions src/webgpu/shader/execution/expression/call/builtin/all.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
export const description = `
Execution tests for the 'all' builtin function
S is a bool
T is S or vecN<S>
@const fn all(e: T) -> bool
Returns e if e is scalar.
Returns true if each component of e is true if e is a vector.
`;

import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
Expand All @@ -21,18 +27,7 @@ export const g = makeTestGroup(GPUTest);

g.test('bool')
.specURL('https://www.w3.org/TR/WGSL/#logical-builtin-functions')
.desc(
`
# scalar
e: bool
@const fn all(e) -> bool
Returns e.
# vector
@const fn all(e: vecN<bool>) -> bool
Returns true if each component of e is true.
`
)
.desc(`bool tests`)
.params(u =>
u
.combine('storageClass', ['uniform', 'storage_r', 'storage_rw'] as const)
Expand Down
19 changes: 7 additions & 12 deletions src/webgpu/shader/execution/expression/call/builtin/any.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
export const description = `
Execution tests for the 'any' builtin function
S is a bool
T is S or vecN<S>
@const fn all(e) -> bool
Returns e if e is scalar.
Returns true if any component of e is true if e is a vector.
`;

import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
Expand All @@ -21,18 +27,7 @@ export const g = makeTestGroup(GPUTest);

g.test('bool')
.specURL('https://www.w3.org/TR/WGSL/#logical-builtin-functions')
.desc(
`
# scalar
e: bool
@const fn all(e) -> bool
Returns e.
# vector
@const fn any(e: vecN<bool>) -> bool
Returns true if any component of e is true.
`
)
.desc(`bool tests`)
.params(u =>
u
.combine('storageClass', ['uniform', 'storage_r', 'storage_rw'] as const)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export const description = `
Execution tests for the 'arrayLength' builtin function
fn arrayLength(e: ptr<storage,array<T>> ) -> u32
Returns the number of elements in the runtime-sized array.
`;

import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
Expand All @@ -9,10 +12,5 @@ export const g = makeTestGroup(GPUTest);

g.test('array')
.specURL('https://www.w3.org/TR/WGSL/#array-builtin-functions')
.desc(
`
fn arrayLength(e: ptr<storage,array<T>> ) -> u32
Returns the number of elements in the runtime-sized array.
`
)
.desc(`array length tests`)
.unimplemented();
29 changes: 8 additions & 21 deletions src/webgpu/shader/execution/expression/call/builtin/asin.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
export const description = `
Execution tests for the 'asin' builtin function
S is AbstractFloat, f32, f16
T is S or vecN<S>
@const fn asin(e: T ) -> T
Returns the arc sine of e. Component-wise when T is a vector.
`;

import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
Expand All @@ -9,13 +14,7 @@ export const g = makeTestGroup(GPUTest);

g.test('abstract_float')
.specURL('https://www.w3.org/TR/WGSL/#float-builtin-functions')
.desc(
`
T is AbstractFloat, f32, f16, vecN<AbstractFloat>, vecN<f32>, or vecN<f16>
@const fn asin(e: T ) -> T
Returns the arc sine of e. Component-wise when T is a vector.
`
)
.desc(`abstract float tests`)
.params(u =>
u
.combine('storageClass', ['uniform', 'storage_r', 'storage_rw'] as const)
Expand All @@ -25,13 +24,7 @@ Returns the arc sine of e. Component-wise when T is a vector.

g.test('f32')
.specURL('https://www.w3.org/TR/WGSL/#float-builtin-functions')
.desc(
`
T is AbstractFloat, f32, f16, vecN<AbstractFloat>, vecN<f32>, or vecN<f16>
@const fn asin(e: T ) -> T
Returns the arc sine of e. Component-wise when T is a vector.
`
)
.desc(`f32 tests`)
.params(u =>
u
.combine('storageClass', ['uniform', 'storage_r', 'storage_rw'] as const)
Expand All @@ -41,13 +34,7 @@ Returns the arc sine of e. Component-wise when T is a vector.

g.test('f16')
.specURL('https://www.w3.org/TR/WGSL/#float-builtin-functions')
.desc(
`
T is AbstractFloat, f32, f16, vecN<AbstractFloat>, vecN<f32>, or vecN<f16>
@const fn asin(e: T ) -> T
Returns the arc sine of e. Component-wise when T is a vector.
`
)
.desc(`f16 tests`)
.params(u =>
u
.combine('storageClass', ['uniform', 'storage_r', 'storage_rw'] as const)
Expand Down
Loading

0 comments on commit 6822b93

Please sign in to comment.