Commit Graph

2917 Commits

Author SHA1 Message Date
James Price 5ffae32177 validation: Improve continue-bypasses-decl message
Attach the error to the continue statement, and add notes to show
where the variable is both declared and used.

Change-Id: Ie9939a5ca674e7216069bbb1d8dc82ab6949367c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65521
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-30 17:29:50 +00:00
James Price 7166f6ba93 validation: Fix continue-bypasses-decl check
An expression that is inside an if-statement condition does not have a
"current block", which is what we were using to see if the usage was
inside a continuing block. Use the current statement to find the
containing block instead.

Fixed: chromium:1251664
Change-Id: Icc808ca1cf6a1b51757da8303901fa5ecb693e83
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65520
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-30 17:29:50 +00:00
James Price 1ca6fbad8f msl: Use a struct for threadgroup memory arguments
MSL has a limit on the number of threadgroup memory arguments, so use
a struct to support an arbitrary number of workgroup variables.

This commit introduces a `State` object to this transform, which is
used to track which structs have been cloned eagerly, in order to
avoid duplicating them.

Bug: tint:938
Change-Id: Ia467db186e176a08f160455eab5fd3b3662f56b8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65360
Auto-Submit: James Price <jrprice@google.com>
Kokoro: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-29 18:56:17 +00:00
Ryan Harrison efe1f14685 Roll third_party/spirv-tools/ c3adcb034..ba4b390c3 (1 commit)
c3adcb034f..ba4b390c36

$ git log c3adcb034..ba4b390c3 --date=short --no-merges --format='%ad %ae %s'
2021-09-28 afdx Suppress protobuf warning (#4551)

Created with:
  roll-dep third_party/spirv-tools

Change-Id: I18d47adbb1f076514917ce188cf127de9c2961b4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65440
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-09-29 15:30:16 +00:00
Alastair Donaldson ac958bd1dd Injected failure in fuzzer target
To test whether black-box fuzzing is working, this change injects an
assertion failure into tint_black_box_fuzzer_target. Once it has been
established that this failure is found by the black box fuzzers, it
should be removed.

Bug: https://crbug.com/1246587
Change-Id: I408bdb116e817879edcec025f644e6f0f6f8bb73
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65340
Auto-Submit: Alastair Donaldson <afdx@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Alastair Donaldson <afdx@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-09-28 17:31:44 +00:00
Corentin Wallez 0f1eb1ea3c Roll third_party/gpuweb-cts/ 177a4faf0..b0291fd96 (252 commits)
177a4faf0a..b0291fd966

$ git log 177a4faf0..b0291fd96 --date=short --no-merges --format='%ad %ae %s'
2021-09-24 hao.x.li Implement api,validation,state,device_mismatched: Part Ⅰ (#741)
2021-09-22 kainino empty commit
2021-09-23 jiawei.shao Use vertex-only pipelines when initializing depth aspects (#754)
2021-09-21 rockot require indirect-first-instance for indirect draws with firstInstance > 0 (#752)
2021-09-20 kainino Add a NumberRepr class that represents f/i/u 64/32/16/8 (#747)
2021-09-17 yunchao.he Fix a bug about max color attachment (#749)
2021-09-14 yunchao.he Test buffer related validations for texture copies (#690)
2021-09-14 jiawei.shao Add operation tests on T2T copy with multisampled color textures (#739)
2021-09-13 enga Test compute shader variables are zero initialized (#743)
2021-09-13 enga Update default limits to match the spec (#745)
2021-09-14 hao.x.li Update destinationOffset alignment to 256 in resolveQuerySet tests (#742)
2021-09-10 enga Add an option to automatically batch large lists of subcases (#733)
2021-09-10 9856269+sarahM0 wgsl abs() built-in function execution test (#730)
2021-09-10 shaobo.yan Remove CopyImageBitmapToTexture (#738)
2021-09-09 9856269+sarahM0 wgsl type parameter generator (#731)
2021-09-10 hello Fix tools/deno (#734)
2021-09-09 kvarkus Include tools in the deploy (#735)
2021-09-09 bajones Update all uses of 'gpupresent' to 'webgpu' (#740)
2021-09-01 9856269+sarahM0 add noop unique id (#729)
2021-08-31 hao.x.li Implement api,validation,state,device_mismatched: helper functions (#717)
2021-08-27 kainino Test postMessage on ArrayBuffer from getMappedRange (#728)
2021-08-27 rockot Introduce expectGPUBufferRepeatsSingleValue (#723)
2021-08-27 rockot some stress tests for shaders and render passes (#722)
2021-08-27 kainino fix async race condition in expectCompileResult (#726)
2021-08-26 sarahmashay remove accidently added file
2021-08-25 84498356+jzm-intel Implement veretx_access validation test: Part 1 (#698)
2021-08-21 sarahmashay wgsl cts for builtin fucntions
2021-08-20 yunchao.he Revise validation tests for depth/stencil formats for copies (#719)
2021-08-19 yunchao.he Validate texture format for copies (#691)
2021-08-19 shrekshao Reftests expand with formats, write canvas methods, and compositingAlphaMode (#696)
2021-08-19 tojiro Remove template that wasn't really helping anyone
2021-08-18 tojiro Addressing more feedback
2021-08-18 tojiro Refactored as suggested by Kai
2021-08-12 tojiro Expanded tests to render passes and render bundles
2021-08-11 tojiro More tests and working on other pipeline types.
2021-08-11 tojiro Added three more tests and fixed issues
2021-07-01 tojiro Implementing preliminary api,operation,command_buffer,programmable,state_tracking:* tests
2021-08-18 shaobo.yan Pipeline_layout_compat: Add buffer and sampler binding equivalent checks (#701)
2021-08-17 kainino Constrain type to guard against future bugs like #716 (#718)
2021-08-17 yunchao.he Fix a bug in api/validation/image_copy/image_copy.ts (#716)
2021-08-17 hao.x.li api,validation,encoding,programmable,pipeline_bind_group_compat plan (#697)
2021-08-17 jiawei.shao Add operation tests on copyTextureToTexture with depth/stencil - Part II (#706)
2021-08-13 tojiro Change depth/stencil sample type to 'depth'
2021-08-14 mehmetoguzderin Fix project name (#714)
2021-08-14 mehmetoguzderin Use split account for previews (#712)
2021-08-13 rockot Implement some initial stress tests (#709)
2021-08-12 bajones Updating deprecated TextureUsage flags (#710)
2021-08-12 shrekshao Remove some alpha blending factor validation (#708)
2021-08-12 kainino re-hide extra stacks from different subcases, fix bug
2021-08-12 kainino Undo hiding of extra lines of message, and don't hide extra logs from different cases
(...)
2021-05-12 tojiro Style fix suggested by Kai
2021-05-12 kainino Use more subcases (#561)
2021-05-12 kainino Document cases/subcases and ParamsBuilder better (#562)
2021-05-12 bajones Review createBindGroupLayout spec (#559)
2021-05-12 shrekshao Add DrawIndirect test (#558)
2021-05-11 kainino Fix sampledTextureBindingTypeInfo (#560)
2021-05-11 shaobo.yan Expand operation tests for copyToTexture,ImageBitmap (#545)
2021-05-06 kainino api,operation,buffers,map: describe, clean notes, add cases (#552)
2021-05-05 bajones Reviewed createBindGroup spec (#554)
2021-05-05 bajones Added some CompilationInfo tests. (#548)
2021-05-04 kainino gen_wpt_cts_html: always split down to individual tests (#544)
2021-05-04 kbrussel Add compute,basic,large_dispatch test. (#555)
2021-05-04 enga Update/cleanup map_oom.spec.ts (#551)
2021-05-04 kainino docs: nits, add pointer to a good reference test (#550)
2021-05-04 rharrison Update variable_and_const.spec.ts shader to match current WGSL spec (#553)
2021-04-29 kainino doc: make heading clearer
2021-04-29 kainino small docs updates
2021-04-29 mehmetoguzderin Reduce expire field to 10 days (#547)
2021-04-28 enga Fix WGSL storage_buffer->storage in by_sampling.ts (#546)
2021-04-28 kainino operation,vertex_state: add todo (#541)
2021-04-26 hao.x.li Add validation tests for occlusion query (#539)
2021-04-16 kainino attachment -> view
2021-04-16 kainino blending renames, remove wrong test plan
2021-04-16 kainino storeOp: required
2021-04-16 kainino computeStage -> compute
2021-04-22 jrprice Use new WGSL entry point IO syntax (#543)
2021-04-21 kainino Replace fence tests with new onSubmittedWorkDone tests (#536)
2021-04-21 corentin Add tests for GCing GPUBuffer before their mappings. (#542)
2021-04-20 kainino Update bindings API usage (#538)
2021-04-19 jrprice Replace builtin(position) with builtin(frag_coord) (#540)
2021-04-16 shrekshao Update WGSL const -> let and remove '-> void' (#537)
2021-04-16 alanbaker Fix some storage buffers (#534)
2021-04-14 kainino add deprecation linter, but disabled for now
2021-04-14 kainino Suppress deprecation warnings
2021-04-14 kainino replace incidental usages of fence with onSubmittedWorkDone
2021-04-14 kainino TODOs for new binding structure
2021-04-14 kainino update DefaultLimits
2021-04-14 kainino rename extension->feature in capability_info
2021-04-14 kainino extensions->features pt 1
2021-04-14 kainino fix easy deprecations
2021-04-14 kainino roll types, fixes for Iterable color/extent/origin (#532)
2021-04-13 kainino roll types (#531)
2021-04-13 kainino Try again to get space at the top of the PR template
2021-04-13 corentin Update README.md (#530)
2021-04-14 hao.x.li Add selectDeviceForQueryTypeOrSkipTestCase to gpu_test.ts (#529)
2021-04-12 yunchao.he Add tests for mipmap with various formats (#528)
2021-04-09 yunchao.he Fix bugs for texture creation validation (#527)
2021-04-08 enga Add tests for GPUBlendComponent (#526)
2021-04-08 kainino Use <hr> because github won't keep the extra blank lines above the ---
2021-04-08 kainino Much more verbose checklists (#525)

Created with:
  roll-dep third_party/gpuweb-cts

Change-Id: I8d82c7299f74140b1ada627c5b1161f8e12c96b1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65280
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-09-28 15:40:54 +00:00
Corentin Wallez f490798fe6 Roll spirv-headers and spirv-tools
Roll third_party/spirv-headers/ 1d4e3a7e3..ae217c178 (13 commits)

1d4e3a7e3a..ae217c1780

$ git log 1d4e3a7e3..ae217c178 --date=short --no-merges --format='%ad %ae %s'
2021-09-16 gleese Remove 'Kernel' capability from fast-math flags
2021-09-09 74654571+BedrockDotPng Update CMakeLists.txt
2021-08-27 greg Add nonsemantic.shader.debuginfo to Bazel
2021-07-28 marijn spirv.core.grammar: Remove duplicate OpArbitraryFloatPowNINTEL declaration
2021-08-10 alele Add support for SPV_NV_ray_tracing_motion_blur.
2021-07-28 nikita.rudenko Fix minor details in SPV_INTEL_optnone extension
2021-07-28 nikita.rudenko Implement SPV_INTEL_optnone extension (#230)
2021-07-20 gleese Correct grammar for LocalSizeHintId
2021-06-28 frustumo Clay is an internal framework of Tellusim Technologies Inc.
2021-05-20 kloczek Rename spirv-headers.pc to SPIRV-Headers.pc
2021-05-19 kloczek removed excesive space in configure_file() line
2021-05-19 kloczek Fixed substituted string with paths and version
2021-05-18 kloczek Add spirv-headers pkgconfig file

Roll third_party/spirv-tools/ 640b17b5f..c3adcb034 (86 commits)

640b17b5fb..c3adcb034f

$ git log 640b17b5f..c3adcb034 --date=short --no-merges --format='%ad %ae %s'
2021-09-24 stevenperron Adce refactor (NFC) (#4547)
2021-09-24 greg Handle NonSemantic.Shader Debug[No]Line (#4530)
2021-09-23 greg Fix inst_buff_addr_check to handle struct loads (#4489)
2021-09-23 jmadill GN: Fix build for debuginfo codegen. (#4536)
2021-09-22 alanbaker Update SPIRV-Headers (#4543)
2021-09-21 alanbaker Fix checks for offset in nested structs (#4531)
2021-09-21 afdx Fix UBSan error in spirv-dis fuzzer (#4517)
2021-09-20 stevenperron Fix extract with out-of-bounds index (#4529)
2021-09-15 greg spirv-opt: Switch from Vulkan.DebugInfo to Shader.DebugInfo (#4493)
2021-09-15 greg Add preserve_interface mode to aggressive_dead_code_elim (#4520)
2021-09-14 afdx spirv-fuzz: Account for differing signedness in WrapVectorSynonym (#4414)
2021-09-14 afdx spirv-opt: Avoid integer overflow during constant folding (#4511)
2021-09-14 stevenperron Roll external/googletest/ b7d472f12..955c7f837 (111 commits) (#4521)
2021-09-13 alanbaker Fix infinite loop in validation (#4523)
2021-09-13 afdx Fix UBSan kokoro config (#4522)
2021-09-13 alanbaker Fix bad order of checks in atomic validation (#4524)
2021-09-13 stevenperron Handle out-of-bounds accesses in VDCE (#4518)
2021-09-12 alanbaker Change validator boolean tests to avoid asserts (#4503)
2021-09-10 alanbaker Fix infinite loop in GetBlockDepth (#4519)
2021-09-10 dneto Fix validation message for cooperative matrix column type (#4502)
2021-09-10 afdx Add UBSan kokoro configuration (#4512)
2021-09-08 alanbaker Add some missing switch validation (#4507)
2021-09-07 afdx spirv-val: Fix ubsan error (#4505)
2021-09-07 gleese Remove environment features that are never used (#4491)
2021-09-03 dneto fix parsing of bad binary exponents in hex floats (#4501)
2021-09-02 afdx Adjust build for fuzzer targets to support OSS-Fuzz (#4498)
2021-09-02 jaebaek Set threshold for reduce-load-size pass (#4499)
2021-08-31 stevenperron Handle exported functions in ADCE (#4495)
2021-08-30 antiagainst Only add `-DSPIRV_CHECK_CONTEXT` for Debug builds (#4496)
2021-08-27 kubak spirv-lint: Add lint based on divergence analysis (#4488)
2021-08-26 gleese Add a feature for allowing LocalSizeId (#4492)
2021-08-25 jaebaek Start SPIRV-Tools v2021.4
2021-08-25 jaebaek Finalize SPIRV-Tools v2021.3
2021-08-24 jaebaek Update CHANGES
2021-08-23 greg spirv-val: Validate vulkan debug info similarly to opencl debug info (#4466)
2021-08-23 52670911+dong-ja Add divergence analysis to linter (#4465)
2021-08-19 46493288+sfricke-samsung spirv-val: Fix WorkgroupSize VUID 04425 (#4482)
2021-08-18 52670911+dong-ja spirv-lint: add basic CLI argument handling (#4478)
2021-08-18 alanbaker Fix matrix stride validation (#4468)
2021-08-18 alanbaker Don't double count variables for location validation (#4474)
2021-08-18 jmadill GN: Suppress unreachable code warnings. (#4476)
2021-08-18 jaebaek Add spirv-opt convert-to-sampled-image pass (#4340)
2021-08-16 alanbaker Disallow loading a runtime-sized array (#4473)
2021-08-16 nicolas.capens Fix early-out for Clamp constant folding (#4461)
2021-08-16 nicolas.capens Don't fold unsigned divides of an constant and a negation (#4457)
2021-08-16 61918637+5265644D61736F6E fix SIGSEGV when reading from a non-existant file (#4453)
2021-08-13 alanbaker Limit location validation (#4467)
2021-08-12 alanbaker Update SPIRV-Headers (#4463)
2021-08-10 greg spirv-opt: Add handling of vulkan debug info to DebugInfoManager (#4423)
2021-08-09 52670911+dong-ja spirv-opt: Add dataflow analysis framework (#4402)
2021-08-09 52670911+dong-ja Remove PCH from source/lint/CMakeLists.txt (#4459)
2021-08-06 52670911+dong-ja Add new target for spirv-lint (#4446)
2021-08-06 alanbaker Add a section releases to the README (#4444)
2021-08-05 alanbaker Fix array layout validation slowdown (#4449)
2021-08-05 mostaphaashraf1996 spirv-fuzz: Support AtomicStore (#4440)
2021-08-05 bclayton fuzzers: Disable suggest-destructor-override warning (#4439)
2021-08-05 afdx Add CMake rules for libFuzzer targets (#4445)
2021-08-03 mostaphaashraf1996 spirv-fuzz: support AtomicLoad (#4330)
2021-08-03 alastair.donaldson Add GraphicsFuzz shaders to fuzzer corpus (#4429)
2021-08-02 bclayton Fuzzer: Default the new constructor parameter (#4438)
2021-07-29 alanbaker Fix validator crash (#4418)
2021-07-29 alastair.donaldson spirv-fuzz: Add minimal SPIR-V example to test shaders (#4415)
2021-07-29 52670911+dong-ja spirv-opt: Rename ControlDependenceAnalysis::DoesBlockExist to HasBlock (#4412)
2021-07-28 greg spirv-opt: Add specific handling of vulkan debug info differences (#4398)
2021-07-28 alastair.donaldson spirv-fuzz: Allow inapplicable transformations to be ignored (#4407)
2021-07-28 alastair.donaldson spirv-fuzz: Quit fuzzer pass when no types are available (#4409)
2021-07-28 52670911+dong-ja spirv-opt: Add more tests to control dependence  (#4410)
2021-07-28 52670911+dong-ja Add control dependence analysis to opt (#4380)
2021-07-27 alastair.donaldson spirv-fuzz: Use reference in CanMakeSynonymOf (#4401)
2021-07-26 kqenro Fix public deps on generated headers (#4386)
2021-07-25 cwallez BUILD.gn: introduce finer grained internal targets for Tint (#4399)
2021-07-23 vasniktel Initialize context in `opt::Instruction`'s move constructor (#4397)
2021-07-22 alastair.donaldson spirv-fuzz: Fix problem with instruction context (#4394)
2021-07-22 alastair.donaldson spirv-fuzz: Avoid out-of-bounds access (#4395)
2021-07-22 alastair.donaldson spirv-fuzz: Fix vector wrapping fuzzer pass (#4392)
2021-07-22 afdx spirv-fuzz: Tighten checks on null and undef pointers (#4367)
2021-07-22 alanbaker Fix local size hint id tests (#4400)
2021-07-21 greg spirv-opt: Where possible make code agnostic of opencl/vulkan debuginfo (#4385)
2021-07-20 jamessliu2020 spirv-fuzz: TransformationWrapVectorSynonym that rewrites scalar operations using vectors (#4376)
2021-07-20 mostaphaashraf1996 spirv-fuzz: Support atomic operations opcode (#4348)
2021-07-16 olvaffe CMake: add ENABLE_RTTI option (#4382)
2021-07-16 greg Add common enum for debug info instructions from either opencl or vulkan (#4377)
2021-07-16 kubak Don't mention VS2013 in PR review instructions (#4384)
2021-07-16 kubak Explain how to run tests with CMake and Bazel (#4383)
2021-07-15 mostaphaashraf1996 spirv-fuzz: Don't replace memory semantics / scope operands (#4349)
2021-07-15 jmadill Add missing fuzzer header dependency. (#4381)

Created with:
  roll-dep third_party/spirv-tools
Created with:
  roll-dep third_party/spirv-headers

Change-Id: I0983f72c8fa3fe7a4c844b43402b3c02fc40ebdf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65264
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-09-28 15:40:27 +00:00
egj 2228ad19af Regex fuzzer: Add return statement inside a randomly-chosen function
Adds a return statement in the body of a randomly-chosen function.
The return value is a randomly-chosen identifier or literal from
the WGSL shader.

Fixes: tint:1115.

Change-Id: Icdc4ff669cda343244e158ce791b4085fd52f7b9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/61781
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Alastair Donaldson <afdx@google.com>
Commit-Queue: Alastair Donaldson <afdx@google.com>
2021-09-28 14:57:54 +00:00
Ben Clayton 9c7cd9e9c3 transform: Avoid symbol collision in Canonicalize IO
Correctly rename fields when combining two or more input structures together into a single input structure.

Bug: chromium:1251009
Change-Id: I0c7ab5ed3116b97035e100d1ef96e772e819f640
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64545
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-27 21:40:33 +00:00
David Neto 231b50baab Add more SPIR-V reader unit test samples
Catch up to include all tests emitted by tint_unittests --dump-spirv

Change-Id: Ia4d5f75782bcc62f8cfeb0615a942e95e563289d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65041
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-09-27 20:55:53 +00:00
David Neto e6f5730aef Add OpImageSampeProj* unit tests to end-to-end list
Fixed: tint:1143
Change-Id: Ib812b9c1c55e48ee78280c32b465afca1b707b82
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65040
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-27 19:21:43 +00:00
Corentin Wallez 40ef4a8269 Revert "msl: Use a struct for threadgroup memory arguments"
This reverts commit af8cd3b7f5.

Reason for revert: breaking roll into Dawn.

Original change's description:
> msl: Use a struct for threadgroup memory arguments
>
> MSL has a limit on the number of threadgroup memory arguments, so use
> a struct to support an arbitrary number of workgroup variables.
>
> Bug: tint:938
> Change-Id: I40e4a8d99bc4ae074010479a56e13e2e0acdded3
> Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64380
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Auto-Submit: James Price <jrprice@google.com>
> Reviewed-by: Ben Clayton <bclayton@google.com>
> Commit-Queue: James Price <jrprice@google.com>

TBR=bclayton@google.com,jrprice@google.com,noreply+kokoro@google.com,tint-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I58a07c4ab7e92bda205e2bbbab41e0b347aeb1e8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: tint:938
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65162
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Corentin Wallez <cwallez@chromium.org>
2021-09-27 19:00:15 +00:00
James Price af8cd3b7f5 msl: Use a struct for threadgroup memory arguments
MSL has a limit on the number of threadgroup memory arguments, so use
a struct to support an arbitrary number of workgroup variables.

Bug: tint:938
Change-Id: I40e4a8d99bc4ae074010479a56e13e2e0acdded3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64380
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
2021-09-27 15:06:13 +00:00
Austin Eng b9a2f5946e spirv-reader: Implement OpImageSampleProj* instructions
Bug: tint:1143
Change-Id: Ic07245a2c5afdb2400f3a9777b6fd42f70dab3c8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64700
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-09-24 18:00:04 +00:00
Ryan Harrison 594e010cfb Fix seed data range calculations
Also removes assert if size == 0, since that case is now gracefully
handled.

BUG=chromium:1252351

Change-Id: I2c5d52a9373f34f377fda9f1689cca6096bc5e63
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64920
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-09-23 17:16:33 +00:00
Ryan Harrison 5e6d4577fd Remove excess copy from fuzzer random number generation code
Adds limited ability to hash C-style buffers, so that the seed can be
directly calculated on the provided input, instead of converting it to
a vector.

BUG=tint:1161

Change-Id: I1b9b0805665436a3242d5918fb563242b91b0f09
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63420
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-22 17:43:06 +00:00
Ryan Harrison a617d0f0fc Convert fuzzer to generating configuration data
This is instead of consuming a portion of the input, so that the seed
corpus of valid shaders can be more effective.

BUG=tint:1098

Change-Id: If3696527c82c23b09edeea6ddd2a0f935e5e1ac7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63301
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-22 14:37:46 +00:00
shrekshao 28d6763ef8 Add type to OverridableConstant
The overridable constants type can only be deducted from shader, those
passed into `record<USVString, GPUPipelineConstantValue> constants;`
are all double. In dawn pipeline (vulkan backend for exmaple) we need to
do type cast for these double values and passed in to native API

Bug: tint:1155, dawn:1041
Change-Id: I3abb43e61d63f054402ca8d3280b44a833a5f67e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64601
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2021-09-21 18:12:59 +00:00
David Neto 92265504fe spirv-reader: don't dedup composite constants
The SPIR-V optimizer's representation deduplicates constants
by structural equality.  We don't want that for WGSL.

Fixed: tint:1173
Change-Id: I7a3936fcd4803a1cda02e71cbaa7c4be89eba433
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64701
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-09-21 18:07:28 +00:00
David Neto 0ed87c8182 spirv-reader: Don't deduplicate SPIR-V array types
Bug: tint:1173
Change-Id: I2adefadf4b79c70f58ed32acda3ea50cd84c8550
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64681
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-09-21 17:14:58 +00:00
Alastair Donaldson 4d18c6b7c5 spirv-tools fuzzers: Avoid passing target backend
Changes the spirv-tools fuzzer targets so that the target back-end
language (HLSL, MSL, SPIR-V or WGSL) is no longer passed as a command
line argument, but instead baked into the fuzzer's binary. This avoids
a problem whereby an OSS-Fuzz bug reproducer does not use the required
back-end command line argument.

Change-Id: I69970dfa7f133f8e310ec063c9b6869bd774e7d3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63343
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Alastair Donaldson <afdx@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2021-09-21 16:41:58 +00:00
Alastair Donaldson 0118b964f3 Fix generation of random indices in regex fuzzer
Random indices were being generated in a manner that assumed the upper
bound to a Random::GetUInt call was inclusive. Also, GetUInt64 was
being used needlessly when GetUInt32 would suffice. This change
addresses both issues.

Fixes https://crbug.com/1250904

Change-Id: I9ad8e5beb3b52bcb867aeb745dec520c251cba60
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64744
Auto-Submit: Alastair Donaldson <afdx@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Alastair Donaldson <afdx@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-09-21 16:16:58 +00:00
David Neto 1d81f83704 spirv-reader: only generate aliases for array types
Refactoring only.

Change-Id: Ia931870a337cf93a54c5f2154754ef549c8559d7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64680
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
2021-09-21 15:05:13 +00:00
Ben Clayton d1c6f83341 CMake: Massage CMakeLists for use by NodeJS bindings
Allow the third_party directory to be controlled by the outer sub-project.

Change-Id: I11030c75254c264c1955150bdf1983771b33b614
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64500
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-20 19:47:05 +00:00
Ben Clayton 17720fdec7 Kokoro: Move the clean checkout to tmpfs
tmpfs is where the real disk space lives.
Fixes spurious out-of-disk errors.

Change-Id: Icd82b58888f5ffa26680c9f68cd65e7b53874bf5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64541
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-20 19:30:35 +00:00
David Neto ddc9eb2b85 wgsl-reader: reject identifiers starting with underscrore
Update one test to avoid this error.

Fixed: tint:1179
Change-Id: Id41b0eb0f404648de4e86a835fe43f1729cb4696
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64464
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-20 14:38:45 +00:00
Alastair Donaldson 871570bc7b Tolerate some errors while building SPIR-V corpus
When preparing a corpus of SPIR-V shaders for fuzzing, spirv-as is
invoked repeatedly. It could be that a bug in spirv-as leads to
conversion failing for some of the shaders. This should not prevent the
overall corpus from being generated, as long as the number of overall
failures is reasonably small. This change adds some tolerance for such
failures.

Change-Id: I77750fdeab15a252201bff33e952e1bd44c42331
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64543
Auto-Submit: Alastair Donaldson <afdx@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Alastair Donaldson <afdx@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-09-17 14:32:20 +00:00
Antonio Maiorano dad26395d8 spirv backend: do not generate a load for ignored expressions
Fixes spirv-val failing on loads of dynamic arrays.

Bug: chromium:1249602
Change-Id: Ic15af9f9ef2beb45bc732e4e45f023651544a1c7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64400
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-09-16 13:32:57 +00:00
Ben Clayton d1d99bc7de Resolver: Validate that type sizes fit in uint32_t
Bug: chromium:1249708
Bug: tint:1177
Change-Id: I31c52f160e4952475e977453206ab4224fd20df7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64320
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-15 17:37:00 +00:00
Alastair Donaldson 6556ba0e94 Move black-box fuzz target into fuzzers group
This makes it possible to build the fuzzer in Chromium's asan builder
group by having it depend on the tint fuzzers group, and means that the
logic for when particular fuzz targets are built remains encapsulated in
the tint fuzzer build rules.

Change-Id: Ic8d6131ccf1759a25fc3d736ae507cd173931616
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64181
Auto-Submit: Alastair Donaldson <afdx@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-15 05:26:14 +00:00
Sarah 7f4d02c7ab cts: fix generated test names in get-test-plan tool
testnames: sectionX_ruleY
fix init value

Bug: tint:1159 tint:1158
Change-Id: Icc92668ee141b2631d9705f41a5155d6483f9713
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64041
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2021-09-13 23:26:00 +00:00
James Price acaecab29d msl: Handle workgroup matrix allocations
Use a threadgroup memory argument for any workgroup variable that
contains a matrix.

The generator now provides a list of threadgroup memory arguments for
each entry point, so that the runtime knows how many bytes to allocate
for each argument.

Bug: tint:938
Change-Id: Ia4af33cd6a44c4f74258793443eb737c2931f5eb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64042
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
2021-09-13 19:56:01 +00:00
Sarah de767b1842 validation: fix arrayAcceor/memberAccessor error msg and add unit-tests
Bug: tint:1172
Change-Id: Icbc920dbc6adc9a5c78b8ae7d700b527a4fa48f7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64100
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2021-09-13 19:30:19 +00:00
James Price c306cda4db inspector: reflect num_workgroups builtin usage
Dawn needs to know if a given entry point uses this builtin, so that
it can pass this information via a root constant for HLSL.

Bug: tint:752
Change-Id: I8bcd3a343db16774ffedd9db9813451f97f10aba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64040
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-13 17:11:58 +00:00
James Price 922fce7295 Implement and test num_workgroups for all backends
For HLSL, use the new NumWorkgroupsFromUniform transform, and expose
the binding point to use for the generated uniform as a backend
option.

The MSL mapping is trivial, and it was already implemented for WGSL
and SPIR-V.

Bug: tint:752
Change-Id: I4bd37b5d26181629d72b152fe064a60caf8ecdc5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63962
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-13 17:11:58 +00:00
James Price 77a25c060f transform: Add NumWorkgroupsFromUniform transform
This transform scans entry points for struct parameters that contain
the num_workgroups builtin, and replace accesses to these members with
a value loaded from a uniform buffer.

This will be used by the HLSL backend to implement the num_workgroups
builtin.

Bug: tint:752
Change-Id: Iefab3b14af8a08a6135348fded368a06d932e915
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63961
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-13 17:11:58 +00:00
James Price 1bb637195b resolver: Enable the num_workgroups builtin
The subsequent commits will implement this for all remaining backends.

Bug: tint:752
Change-Id: Id26f920fea93b5678466705612dcbfc229dc878a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63921
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: James Price <jrprice@google.com>
2021-09-13 17:11:58 +00:00
David Neto d705a13599 Fix typo in a comment
Change-Id: I85aa498e6f593567b361f01734af1e8eb586ceba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64080
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-09-13 15:18:59 +00:00
James Price f66f651374 transform/BindingRemapper: Validate access mode
Ensure that remapped access modes are valid enum values.

NB: This is hard to test, as UBSan flags an out-of-range enum value as
a hard error.

Fixed: chromium:1248754, chromium:1248755
Change-Id: I2e686843134e6a285fb8316a1960fc4eadff2a93
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64120
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-13 14:58:39 +00:00
Ben Clayton 2ebcb93cb3 reader/spiv: Fix typo in entry-point IO sorting
We were sorting the inputs twice.
Also make use the UniqueVector::operator std::vector() to simplify the code a little.

Doesn't appear to change any tests.
Just spotted while looking through code.

Change-Id: Iddb433b9c8c429f32b40a10cf466c712fde7a317
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63701
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-09-10 15:25:13 +00:00
James Price ebab7d2f7a spirv: Remove the sanitizer transform
Invoke the required transforms directly in the SPIR-V backend.

Change-Id: I78dc667d5c4c9c1d4da13ef5a99ece831c103982
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63801
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-09 14:40:07 +00:00
James Price 5b3be6a64a hlsl: Remove the sanitizer transform
Invoke the required transforms directly in the HLSL backend.

Change-Id: I9465fef375dd4dad6a91c1e7e16ede6401b9bfc0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63800
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-09 14:40:07 +00:00
Ben Clayton 25517e9ce8 resolver: Validate unreachable stmts when terminator is in block(s)
Will requires updating the WGSL spec, which currently has rules looser than SPIR-V.

Fixed: tint:1167
Bug: chromium:1246163
Change-Id: Ie8fcfabc0bb89c7fb69c345475ff99c07fa04172
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63560
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2021-09-09 12:38:19 +00:00
James Price 733addc20f msl: Remove the sanitizer transform
Invoke the required transforms directly in the MSL backend.

Change-Id: Id8026b1a64415fbe363f8f8a5790e8216cd12c68
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63620
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
2021-09-08 19:57:47 +00:00
James Price 5910ec1e8a Output WGSL instead of SPIR-V in transform fuzzers
Generating SPIR-V can cause validation failures when out-of-bounds
accesses are performed, since we are not running the robustness
transform.

Bug: chromium:1246061
Change-Id: Ied58d77d90079d10d5579d2d55854c3cfbc18db5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63640
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
2021-09-08 18:08:36 +00:00
Ben Clayton b7bcbf0d20 Resolver: Traverse expressions without recursion
This CL changes the way that the resolver traverses expressions to avoid stack overflows for deeply nested expressions.

Instead of having the expression resolver methods call back into
Expression(), add a TraverseExpressions() method that collects all the
expression nodes with a simple DFS.

This currently only changes the way that Expressions are traversed. We
may need to do the same for statements.

Bug: chromium:1246375
Change-Id: Ie81905da1b790b6dd1df9f1ac42e06593d397c21
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63700
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-09-08 15:18:36 +00:00
David Neto be514a1efb wgsl-reader: hex float: zero mantissa results in zero result
When the magnitude is zero, then we don't care about the magnitude
of the exponent. The result value is always zero, without emitting
an error.

Fixed: tint:1166
Change-Id: I303d7c336e7ea42719571854f0a22cbfd19da32c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63520
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-09-08 13:46:51 +00:00
James Price 676ec7cf99 spirv: Handle sample_mask in shader IO transform
This is easy to do while we are processing builtins in the main
transform now that we use wrapper functions.

This is step towards removing the sanitizers completely.

Change-Id: If5472ce552e3cce1e5905916eeffa8fef90461c9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63585
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-07 18:59:21 +00:00
James Price 1b9ed7de4a msl/module-scope-var: Add unit test for folding &*
As noted in the CL that folded &* during this transform, we were
missing a unit test for this:
https://dawn-review.googlesource.com/c/tint/+/60520

Bug: tint:1086
Change-Id: I61941d40dbcc478e8cc2672144186e5c0f10e587
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63584
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-07 18:59:21 +00:00
James Price 3646400342 transform: Add ModuleScopeVarToEntryPointParam
This is the HandleModuleScopeVars() part of the MSL sanitizer moved
verbatim to a standalone transform. The transform code is unchanged,
but some expected test outputs are different as this is now tested in
isolation instead of along with the rest of the sanitizer transforms.

This is step towards removing the sanitizers completely.

Change-Id: I7be826e2119451fc2ce2891740cc94f978e7d5a1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/63583
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-09-07 18:59:21 +00:00