-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate functions from packed_4x8_integer_dot_product (#3188)
Validates builtin functions: dot4I8Packed dot4U8Packed pack4xI8 pack4xI8Clamp pack4xU8 pack4xU8Clamp unpack4xI8 unpack4xU8 Issue: #3180
- Loading branch information
Showing
9 changed files
with
494 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/webgpu/shader/validation/expression/call/builtin/dot4I8Packed.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
export const description = `Validate dot4I8Packed`; | ||
|
||
import { makeTestGroup } from '../../../../../../common/framework/test_group.js'; | ||
import { keysOf } from '../../../../../../common/util/data_tables.js'; | ||
import { ShaderValidationTest } from '../../../shader_validation_test.js'; | ||
|
||
const kFeature = 'packed_4x8_integer_dot_product'; | ||
const kFn = 'dot4I8Packed'; | ||
const kGoodArgs = '(1u,2u)'; | ||
const kBadArgs = { | ||
'0args': '()', | ||
'1args': '(1u)', | ||
'3args': '(1u,2u,3u)', | ||
'0i32': '(1i,2u)', | ||
'0f32': '(1f,2u)', | ||
'0bool': '(false,2u)', | ||
'0vec2u': '(vec2u(),2u)', | ||
'1i32': '(1u,2i)', | ||
'1f32': '(1u,2f)', | ||
'1bool': '(1u,true)', | ||
'1vec2u': '(1u,vec2u())', | ||
}; | ||
|
||
export const g = makeTestGroup(ShaderValidationTest); | ||
|
||
g.test('unsupported') | ||
.desc(`Test absence of ${kFn} when ${kFeature} is not supported.`) | ||
.params(u => u.combine('requires', [false, true])) | ||
.fn(t => { | ||
t.skipIfLanguageFeatureSupported(kFeature); | ||
const preamble = t.params.requires ? `requires ${kFeature}; ` : ''; | ||
const code = `${preamble}const c = ${kFn}${kGoodArgs};`; | ||
t.expectCompileResult(false, code); | ||
}); | ||
|
||
g.test('supported') | ||
.desc(`Test presence of ${kFn} when ${kFeature} is supported.`) | ||
.params(u => u.combine('requires', [false, true])) | ||
.fn(t => { | ||
t.requireLanguageFeatureOrSkipTestCase(kFeature); | ||
const preamble = t.params.requires ? `requires ${kFeature}; ` : ''; | ||
const code = `${preamble}const c = ${kFn}${kGoodArgs};`; | ||
t.expectCompileResult(true, code); | ||
}); | ||
|
||
g.test('bad_args') | ||
.desc(`Test compilation failure of ${kFn} with bad arguments`) | ||
.params(u => u.combine('arg', keysOf(kBadArgs))) | ||
.fn(t => { | ||
t.requireLanguageFeatureOrSkipTestCase(kFeature); | ||
t.expectCompileResult(false, `const c = ${kFn}${kBadArgs[t.params.arg]};`); | ||
}); | ||
|
||
g.test('must_use') | ||
.desc(`Result of ${kFn} must be used`) | ||
.fn(t => { | ||
t.requireLanguageFeatureOrSkipTestCase(kFeature); | ||
t.expectCompileResult(false, `fn f() { ${kFn}${kGoodArgs}; }`); | ||
}); |
59 changes: 59 additions & 0 deletions
59
src/webgpu/shader/validation/expression/call/builtin/dot4U8Packed.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
export const description = `Validate dot4U8Packed`; | ||
|
||
import { makeTestGroup } from '../../../../../../common/framework/test_group.js'; | ||
import { keysOf } from '../../../../../../common/util/data_tables.js'; | ||
import { ShaderValidationTest } from '../../../shader_validation_test.js'; | ||
|
||
const kFeature = 'packed_4x8_integer_dot_product'; | ||
const kFn = 'dot4U8Packed'; | ||
const kGoodArgs = '(1u,2u)'; | ||
const kBadArgs = { | ||
'0args': '()', | ||
'1args': '(1u)', | ||
'3args': '(1u,2u,3u)', | ||
'0i32': '(1i,2u)', | ||
'0f32': '(1f,2u)', | ||
'0bool': '(false,2u)', | ||
'0vec2u': '(vec2u(),2u)', | ||
'1i32': '(1u,2i)', | ||
'1f32': '(1u,2f)', | ||
'1bool': '(1u,true)', | ||
'1vec2u': '(1u,vec2u())', | ||
}; | ||
|
||
export const g = makeTestGroup(ShaderValidationTest); | ||
|
||
g.test('unsupported') | ||
.desc(`Test absence of ${kFn} when ${kFeature} is not supported.`) | ||
.params(u => u.combine('requires', [false, true])) | ||
.fn(t => { | ||
t.skipIfLanguageFeatureSupported(kFeature); | ||
const preamble = t.params.requires ? `requires ${kFeature}; ` : ''; | ||
const code = `${preamble}const c = ${kFn}${kGoodArgs};`; | ||
t.expectCompileResult(false, code); | ||
}); | ||
|
||
g.test('supported') | ||
.desc(`Test presence of ${kFn} when ${kFeature} is supported.`) | ||
.params(u => u.combine('requires', [false, true])) | ||
.fn(t => { | ||
t.requireLanguageFeatureOrSkipTestCase(kFeature); | ||
const preamble = t.params.requires ? `requires ${kFeature}; ` : ''; | ||
const code = `${preamble}const c = ${kFn}${kGoodArgs};`; | ||
t.expectCompileResult(true, code); | ||
}); | ||
|
||
g.test('bad_args') | ||
.desc(`Test compilation failure of ${kFn} with bad arguments`) | ||
.params(u => u.combine('arg', keysOf(kBadArgs))) | ||
.fn(t => { | ||
t.requireLanguageFeatureOrSkipTestCase(kFeature); | ||
t.expectCompileResult(false, `const c = ${kFn}${kBadArgs[t.params.arg]};`); | ||
}); | ||
|
||
g.test('must_use') | ||
.desc(`Result of ${kFn} must be used`) | ||
.fn(t => { | ||
t.requireLanguageFeatureOrSkipTestCase(kFeature); | ||
t.expectCompileResult(false, `fn f() { ${kFn}${kGoodArgs}; }`); | ||
}); |
58 changes: 58 additions & 0 deletions
58
src/webgpu/shader/validation/expression/call/builtin/pack4xI8.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
export const description = `Validate pack4xI8`; | ||
|
||
import { makeTestGroup } from '../../../../../../common/framework/test_group.js'; | ||
import { keysOf } from '../../../../../../common/util/data_tables.js'; | ||
import { ShaderValidationTest } from '../../../shader_validation_test.js'; | ||
|
||
const kFeature = 'packed_4x8_integer_dot_product'; | ||
const kFn = 'pack4xI8'; | ||
const kGoodArgs = '(vec4i())'; | ||
const kBadArgs = { | ||
'0args': '()', | ||
'2args': '(vec4i(),vec4i())', | ||
'0i32': '(1i)', | ||
'0f32': '(1f)', | ||
'0bool': '(false)', | ||
'0vec4u': '(vec4u())', | ||
'0vec4f': '(vec4f())', | ||
'0vec4b': '(vec4<bool>())', | ||
'0vec2i': '(vec2i())', | ||
'0vec3i': '(vec3i())', | ||
}; | ||
|
||
export const g = makeTestGroup(ShaderValidationTest); | ||
|
||
g.test('unsupported') | ||
.desc(`Test absence of ${kFn} when ${kFeature} is not supported.`) | ||
.params(u => u.combine('requires', [false, true])) | ||
.fn(t => { | ||
t.skipIfLanguageFeatureSupported(kFeature); | ||
const preamble = t.params.requires ? `requires ${kFeature}; ` : ''; | ||
const code = `${preamble}const c = ${kFn}${kGoodArgs};`; | ||
t.expectCompileResult(false, code); | ||
}); | ||
|
||
g.test('supported') | ||
.desc(`Test presence of ${kFn} when ${kFeature} is supported.`) | ||
.params(u => u.combine('requires', [false, true])) | ||
.fn(t => { | ||
t.requireLanguageFeatureOrSkipTestCase(kFeature); | ||
const preamble = t.params.requires ? `requires ${kFeature}; ` : ''; | ||
const code = `${preamble}const c = ${kFn}${kGoodArgs};`; | ||
t.expectCompileResult(true, code); | ||
}); | ||
|
||
g.test('bad_args') | ||
.desc(`Test compilation failure of ${kFn} with bad arguments`) | ||
.params(u => u.combine('arg', keysOf(kBadArgs))) | ||
.fn(t => { | ||
t.requireLanguageFeatureOrSkipTestCase(kFeature); | ||
t.expectCompileResult(false, `const c = ${kFn}${kBadArgs[t.params.arg]};`); | ||
}); | ||
|
||
g.test('must_use') | ||
.desc(`Result of ${kFn} must be used`) | ||
.fn(t => { | ||
t.requireLanguageFeatureOrSkipTestCase(kFeature); | ||
t.expectCompileResult(false, `fn f() { ${kFn}${kGoodArgs}; }`); | ||
}); |
58 changes: 58 additions & 0 deletions
58
src/webgpu/shader/validation/expression/call/builtin/pack4xI8Clamp.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
export const description = `Validate pack4xI8Clamp`; | ||
|
||
import { makeTestGroup } from '../../../../../../common/framework/test_group.js'; | ||
import { keysOf } from '../../../../../../common/util/data_tables.js'; | ||
import { ShaderValidationTest } from '../../../shader_validation_test.js'; | ||
|
||
const kFeature = 'packed_4x8_integer_dot_product'; | ||
const kFn = 'pack4xI8Clamp'; | ||
const kGoodArgs = '(vec4i())'; | ||
const kBadArgs = { | ||
'0args': '()', | ||
'2args': '(vec4i(),vec4i())', | ||
'0i32': '(1i)', | ||
'0f32': '(1f)', | ||
'0bool': '(false)', | ||
'0vec4u': '(vec4u())', | ||
'0vec4f': '(vec4f())', | ||
'0vec4b': '(vec4<bool>())', | ||
'0vec2i': '(vec2i())', | ||
'0vec3i': '(vec3i())', | ||
}; | ||
|
||
export const g = makeTestGroup(ShaderValidationTest); | ||
|
||
g.test('unsupported') | ||
.desc(`Test absence of ${kFn} when ${kFeature} is not supported.`) | ||
.params(u => u.combine('requires', [false, true])) | ||
.fn(t => { | ||
t.skipIfLanguageFeatureSupported(kFeature); | ||
const preamble = t.params.requires ? `requires ${kFeature}; ` : ''; | ||
const code = `${preamble}const c = ${kFn}${kGoodArgs};`; | ||
t.expectCompileResult(false, code); | ||
}); | ||
|
||
g.test('supported') | ||
.desc(`Test presence of ${kFn} when ${kFeature} is supported.`) | ||
.params(u => u.combine('requires', [false, true])) | ||
.fn(t => { | ||
t.requireLanguageFeatureOrSkipTestCase(kFeature); | ||
const preamble = t.params.requires ? `requires ${kFeature}; ` : ''; | ||
const code = `${preamble}const c = ${kFn}${kGoodArgs};`; | ||
t.expectCompileResult(true, code); | ||
}); | ||
|
||
g.test('bad_args') | ||
.desc(`Test compilation failure of ${kFn} with bad arguments`) | ||
.params(u => u.combine('arg', keysOf(kBadArgs))) | ||
.fn(t => { | ||
t.requireLanguageFeatureOrSkipTestCase(kFeature); | ||
t.expectCompileResult(false, `const c = ${kFn}${kBadArgs[t.params.arg]};`); | ||
}); | ||
|
||
g.test('must_use') | ||
.desc(`Result of ${kFn} must be used`) | ||
.fn(t => { | ||
t.requireLanguageFeatureOrSkipTestCase(kFeature); | ||
t.expectCompileResult(false, `fn f() { ${kFn}${kGoodArgs}; }`); | ||
}); |
58 changes: 58 additions & 0 deletions
58
src/webgpu/shader/validation/expression/call/builtin/pack4xU8.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
export const description = `Validate pack4xU8`; | ||
|
||
import { makeTestGroup } from '../../../../../../common/framework/test_group.js'; | ||
import { keysOf } from '../../../../../../common/util/data_tables.js'; | ||
import { ShaderValidationTest } from '../../../shader_validation_test.js'; | ||
|
||
const kFeature = 'packed_4x8_integer_dot_product'; | ||
const kFn = 'pack4xU8'; | ||
const kGoodArgs = '(vec4u())'; | ||
const kBadArgs = { | ||
'0args': '()', | ||
'2args': '(vec4u(),vec4u())', | ||
'0i32': '(1i)', | ||
'0f32': '(1f)', | ||
'0bool': '(false)', | ||
'0vec4i': '(vec4i())', | ||
'0vec4f': '(vec4f())', | ||
'0vec4b': '(vec4<bool>())', | ||
'0vec2u': '(vec2u())', | ||
'0vec3u': '(vec3u())', | ||
}; | ||
|
||
export const g = makeTestGroup(ShaderValidationTest); | ||
|
||
g.test('unsupported') | ||
.desc(`Test absence of ${kFn} when ${kFeature} is not supported.`) | ||
.params(u => u.combine('requires', [false, true])) | ||
.fn(t => { | ||
t.skipIfLanguageFeatureSupported(kFeature); | ||
const preamble = t.params.requires ? `requires ${kFeature}; ` : ''; | ||
const code = `${preamble}const c = ${kFn}${kGoodArgs};`; | ||
t.expectCompileResult(false, code); | ||
}); | ||
|
||
g.test('supported') | ||
.desc(`Test presence of ${kFn} when ${kFeature} is supported.`) | ||
.params(u => u.combine('requires', [false, true])) | ||
.fn(t => { | ||
t.requireLanguageFeatureOrSkipTestCase(kFeature); | ||
const preamble = t.params.requires ? `requires ${kFeature}; ` : ''; | ||
const code = `${preamble}const c = ${kFn}${kGoodArgs};`; | ||
t.expectCompileResult(true, code); | ||
}); | ||
|
||
g.test('bad_args') | ||
.desc(`Test compilation failure of ${kFn} with bad arguments`) | ||
.params(u => u.combine('arg', keysOf(kBadArgs))) | ||
.fn(t => { | ||
t.requireLanguageFeatureOrSkipTestCase(kFeature); | ||
t.expectCompileResult(false, `const c = ${kFn}${kBadArgs[t.params.arg]};`); | ||
}); | ||
|
||
g.test('must_use') | ||
.desc(`Result of ${kFn} must be used`) | ||
.fn(t => { | ||
t.requireLanguageFeatureOrSkipTestCase(kFeature); | ||
t.expectCompileResult(false, `fn f() { ${kFn}${kGoodArgs}; }`); | ||
}); |
Oops, something went wrong.