Commit Graph

2665 Commits

Author SHA1 Message Date
Ben Clayton 725159c17c resolver: Limit the number of parameters to 255
See: https://github.com/gpuweb/gpuweb/issues/1959

Fixed: chromium:1228642
Change-Id: Iadedd0a1396ebb6a006caa99e0931a92eb2c008e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58390
Commit-Queue: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-07-17 17:45:25 +00:00
Ben Clayton b85099ae73 test: Split binary_expressions into separate tests
Tests should be as fine-grained as possible.
Not all the permutations were covered.
Not all the backends were actually generating anything useful, as the
functions were not called by an entry point.

Change-Id: I76658533d3112d202f7482a19531079550e66f83
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58392
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-07-17 17:38:46 +00:00
Ben Clayton 8f144a09f6 fuzzers: Fix buffer overrun
Fixed: tint:1005
Change-Id: I3655ee7b54811b55736cbf0e05c63cb27de6cd72
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58391
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
2021-07-16 21:15:24 +00:00
Ben Clayton 50b6d024d6 fuzzers: Don't drop writter errors on the floor
A writer shouldn't error. If the input is invalid, then this should be caught by the parser or resolver.
Fail the test if the writer errors.

Change-Id: I89da602dc96fa7be2a8efa288a90310a61745124
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58389
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Vasyl Teliman <vasniktel@gmail.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-16 21:07:25 +00:00
Alastair Donaldson 86dc88725a Add gn build support for spirv-tools + AST fuzzers
Allows the new transformation-based fuzzers to be built using gn, so
that they can be deployed on ClusterFuzz.

Fixes: tint:1002
Fixes: tint:1006

Change-Id: Ib9624e507e40836541eb424e710705345a198db1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58387
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Vasyl Teliman <vasniktel@gmail.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2021-07-16 20:56:55 +00:00
Alastair Donaldson 5d71531abe Fix SPIR-V emptiness condition in fuzzer
Fixes a problem where the fuzzer was ignoring non-empty SPIR-V
binaries.

Fixes: tint:1004
Change-Id: I9fa98764b7408dbd53d5b56424805e2fa331a118
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58385
Auto-Submit: Alastair Donaldson <afdx@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-16 20:34:55 +00:00
Ben Clayton 883fb63e01 transform: Don't unroll arrays in DecomposeMemoryAccess
Arrays can be extremely large, and having the load and store functions unroll the elements can make the complier explode.

Fixed: chromium:1229233
Change-Id: Ieb5654254e16f5ce724a205d21d954ef9a0cd053
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58382
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2021-07-16 19:47:44 +00:00
Sarah c33503069c validation: location decoration is not valid for compute shaders
Bug: tint:981
Change-Id: I15024e0cf836af4f3ad7a14b8cd51c24fc3cd536
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58067
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: Sarah Mashayekhi <sarahmashay@google.com>
2021-07-16 19:11:54 +00:00
David Neto 5f994247a2 reader: fix ordering of select operands
Updates:
spirv-reader
hlsl-writer
spirv-writer

Bug: tint:1001
Change-Id: I7359d35c3384e164d149a6af03cbdc959a2eea76
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58400
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: David Neto <dneto@google.com>
2021-07-16 18:17:05 +00:00
Ben Clayton 29c70796d3 parser/wgsl: Fix stack overflow in postfix_expression()
Have postfix_expression() use a loop instead of recursively calling itself.

Fixed chromium:1229669

Change-Id: Ied7684d00ba453a8b89ab0251d42e2a72169421f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58381
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-07-16 17:55:14 +00:00
Vasyl Teliman fa4d4341f4 Fix AST fuzzer message serialization
Currently, AST fuzzer requires that all fuzzed binaries are serialized protobuf messages.
In principle, we don't need this when we don't record mutations (which is the case right
now). Hence, this CL removes that requirement.

Change-Id: Ibe677d1ac7d34d640d6e3a368af50df5b4fe474a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58225
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Vasyl Teliman <vasniktel@gmail.com>
Reviewed-by: Alastair Donaldson <afdx@google.com>
2021-07-16 17:50:04 +00:00
David Neto e087a95706 spirv-reader: support remaining interpolation decorations
NoPerspective interpolation maps to 'linear'

Centroid maps to 'centroid'
Sample maps to 'sample'
Otherwise, allow 'center' to be defaulted.

Fixed: tint:935
Change-Id: I0b040da0c57d2a363f9dc9474c1ac889e0fe2278
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56840
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: David Neto <dneto@google.com>
2021-07-16 16:20:25 +00:00
Sarah 71198438ac validation: textureSample*() offset argument must be literal or const_expr
Bug: tint:939
Change-Id: I4ba44902948e38aa9ce3e9ecae9b3b4b593bd93d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57660
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
2021-07-16 13:38:05 +00:00
Vasyl Teliman 979a0b4446 Fix CLI parameters in fuzzers
This CL changes the prefix of CLI parameters in AST and SPIRV-Tools
fuzzers from `--` to `-` to make these fuzzers compatible with ClusterFuzz.
Additionally, a `tint_` prefix was added to all CLI arguments to prevent their
name collisions with LibFuzzer arguments.

Change-Id: Id2e087e59f04b495d5a7edb3b62d55de652c1acd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58226
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Alastair Donaldson <afdx@google.com>
Commit-Queue: Alastair Donaldson <afdx@google.com>
2021-07-16 10:26:34 +00:00
Vasyl Teliman 365af046ca Fix SPIRV-Tools fuzzer
This CL fixes a regression in SPIRV-Tools fuzzer after the changes in https://dawn-review.googlesource.com/c/tint/+/57101. Additionally, a bunch of sanity fixes are added to the CommonFuzzer.

Change-Id: Ie6512ddca20572d23634c4b5265b39540a42b4bd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58224
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Vasyl Teliman <vasniktel@gmail.com>
2021-07-16 09:25:14 +00:00
Antonio Maiorano 4c9b440515 Fix FloatToString printing with not enough precision when using `fixed` floatfield format
Setting precision to `std::numeric_limits<float>::max_digits10` is valid
when using the `scientific` floatfield format when printing values.
However, we used `fixed` to make our floats more human-readable. This
change keeps the output in `fixed`, except if doing so loses precision,
in which case we fall back to `scientific`.

This fixes the rendering differences seen in the Babylon.js examples
(https://crbug.com/tint/944) between Dawn using Tint vs SPIRV-Cross, as
Tint's output was emitting values that had lost too much precision
(e.g. very small numbers being output as 0).

Bug: tint:944
Change-Id: I8deea23ad876825bbe390fc26907d4bbbd4b966e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58321
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-16 08:55:14 +00:00
Ben Clayton 1da4073870 test: Add case for tint:977
Bug: tint:977
Change-Id: I50778c6e1778717c0ad9b02b2ea25b13c4a3da97
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58065
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-15 22:36:44 +00:00
Ben Clayton 0bff3fb3b7 writer/wgsl: Fix printing of for-loops
Fix various issue with formatting for loop. Add tests.

Bug: tint:952
Change-Id: I704341a15f0050ebf82df219d0c7d068a3a63c26
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58064
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-07-15 22:20:29 +00:00
Ben Clayton 8e38fad091 transform/InlinePtrLets: Fix ICE for lets in for-loops
For loop initializers and continuing statements do not have a BlockStatement as their parent.
Handle removal of these statements with a new Transform::RemoveStatement() helper

Fixed: tint:990
Change-Id: I24e7b18dcf71d3ef0a4d3ee68b9f68518e0eb5e8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58063
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-07-15 22:20:29 +00:00
Ben Clayton 96a6e7e95d transform: Pass CloneContext by reference
Some methods passed by pointer, others by reference. Standarize to pass-by-reference.

Also remove CloneWithStatementsAtStart().
CloneContext::InsertFront() is a better replacement.

Change-Id: Ibbf7caaa7a1b42c2d0a0cddaa3d6e76ca0e12a17
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58062
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-07-15 22:20:29 +00:00
Ben Clayton b478f97975 IntrinsicTable: De-duplicate returned Intrinsics
Much like sem::Type, it greatly simplifies downstream logic if we can compare sem::Intrinsic pointers to know if they refer to the same intrinsic overload.

Change-Id: If236247cd3979bbde821d9294f304ab85ba4938e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58061
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-07-15 20:34:21 +00:00
Ben Clayton e54e26d7e8 writer/hlsl: Emit more helpers for intrinsic calls
And call these helpers instead of inlining complex statements.
Cleans up output, and helps prevent for-loops decaying to while loops.

Change-Id: I6ac31b18ce6c5fac0e54e982f7db3bb298f7edb2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58060
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
2021-07-15 20:34:21 +00:00
Ben Clayton f242fb9f7e test: Add test case for tint:998
Bug: tint:998
Change-Id: I6c8b8f7ec9a9b6d5a721fa01bab647641e33b3b2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58281
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-07-15 20:29:09 +00:00
Ben Clayton 8a96c78931 transform: Fixes for DecomposeMemoryAccess
CloneContext::Replace(T* what, T* with) is bug-prone, as complex transforms may want to clone `what` multiple times, or not at all. In both cases, this will likely result in an ICE as either the replacement will be reachable multiple times, or not at all.

The CTS test: webgpu:shader,execution,robust_access:linear_memory:storageClass="storage";storageMode="read_write";access="read";atomic=true;baseType="i32"
Was triggering this brokenness with DecomposeMemoryAccess's use of CloneContext::Replace(T*, T*).

Switch the usage of CloneContext::Replace(T*, T*) to the new function form.

As std::function is copyable, it cannot hold a captured std::unique_ptr.
This prevented the Replace() lambdas from capturing the necessary `BufferAccess` data, as this held a `std::unique_ptr<Offset>`.
To fix this, use a `BlockAllocator` for Offsets, and use raw pointers instead.

Because the function passed to Replace() is called just before the node is cloned, insertion of new functions will occur just before the currently evaluated module-scope entity.
This allows us to remove the "insert_after" arguments to LoadFunc(), StoreFunc(), and AtomicFunc().
We can also kill the icky InsertGlobal() and TypeDeclOf() helpers.

Bug: tint:993
Change-Id: I60972bc13a2fa819a163ee2671f61e82d0e68d2a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58222
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-07-15 20:29:09 +00:00
Ben Clayton 4511a2ebb6 transform: Add a debug flag to dump WGSL
Before and after each transform of a transform::Manager.

This change makes the transforms use the Castable system so we can get the transform name.

Change-Id: I2cf9335960f1aca56f1d32c5ba0d104db4cc46c1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54581
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-07-15 20:24:38 +00:00
David Neto aa5686acc3 Roll spirv-tools and spirv-headers
Roll third_party/spirv-tools/ ecdd9a3e6..640b17b5f (31 commits)

ecdd9a3e6b..640b17b5fb

$ git log ecdd9a3e6..640b17b5f --date=short --no-merges --format='%ad %ae %s'
2021-07-14 pkasting Fix -Wunreachable-code-aggressive. (#4358)
2021-07-14 jaebaek spirv-opt: support SPV_EXT_shader_image_int64 (#4379)
2021-07-14 afdx Fix BUILD.gn (#4378)
2021-07-13 afdx spirv-fuzz: support building using gn (#4365)
2021-07-13 greg Fix vendor table build in BUILD.gn for nonsemantic.vulkan.debuginfo.100 (#4375)
2021-07-12 greg Add non-semantic vulkan extended instruction set (#4362)
2021-07-07 ynovikov Update SPIRV-Headers deps (#4369)
2021-07-06 alastair.donaldson spirv-reduce: Eliminate skeletal structured control flow construct (#4360)
2021-07-05 alastair.donaldson spirv-fuzz: Check updated analyses in transformation tests (#4266)
2021-07-04 alastair.donaldson spirv-fuzz: Added tests for signedness analysis (#4361)
2021-07-02 stevenperron Add remove_unused_interface_variable_pass.* to BUILD.gn (#4363)
2021-07-02 ben.ashbaugh add tests for SPV_KHR_bit_instructions (#4350)
2021-07-01 alastair.donaldson spirv-fuzz: Avoid out of bounds access (#4355)
2021-06-29 61806567+TheMostDiligent Enabled tvOS platform (#4329)
2021-06-29 3.1416f spirv-opt: A pass to removed unused input on OpEntryPoint instructions. (#4275)
2021-06-29 stevenperron Bump glob-parent from 5.0.0 to 5.1.2. (#4353)
2021-06-29 johnzupin fix strncpy bound error (#4331)
2021-06-28 alastair.donaldson spirv-reduce: Allow merging unreachable blocks (#4303)
2021-06-28 alastair.donaldson Add IsReachable function to IRContext (#4323)
2021-06-28 alastair.donaldson spirv-reduce: Cleanup a few things (#4352)
2021-06-24 alastair.donaldson spirv-fuzz: Add illustrative tests for new issues (#4347)
2021-06-24 jason.ekstrand Add validation for SPV_EXT_shader_atomic_float16_add (#4325)
2021-06-23 kpet Initial support for SPV_KHR_integer_dot_product (#4327)
2021-06-23 dneto fix symbol exports check, for Android build cases (#4342)
2021-06-22 dnovillo Start SPIRV-Tools v2021.3
2021-06-22 dnovillo Finalize SPIRV-Tools v2021.2
2021-06-21 46493288+sfricke-samsung spirv-val: Label VUID 04780 (#4334)
2021-06-21 46493288+sfricke-samsung spirv-val: Add GLCompute to VUID 04644 message (#4333)
2021-06-18 dnovillo Update CHANGES file for upcoming release.
2021-06-17 alanbaker Update SPIRV-Headers deps (#4328)
2021-06-15 alanbaker Support SPV_KHR_subgroup_uniform_control_flow (#4318)

Created with:
  roll-dep third_party/spirv-tools

Change-Id: I5e6534f9118ff2f633552c1149c03f2e06cb721c

Roll third_party/spirv-headers/ f5417a4b6..1d4e3a7e3 (9 commits)

f5417a4b66..1d4e3a7e3a

$ git log f5417a4b6..1d4e3a7e3 --date=short --no-merges --format='%ad %ae %s'
2021-07-09 mariusz.merecki Add missing capabilities and '"version" : "None"' to QuantizationModes and OverflowModes enumerants
2021-07-07 kevin.petit Fix grammar for PackedVectorFormat
2021-06-25 mariya.podchishchaeva Upstream SPV_INTEL_debug_module
2021-06-24 13504385+WyvernWang reserve value range
2021-06-23 ben.ashbaugh add support for SPV_KHR_bit_instructions
2021-06-23 kevin.petit Add CI using Github actions and update README
2020-05-22 dneto Support SPV_KHR_integer_dot_product
2021-01-12 jason.ekstrand Add header changes for SPV_EXT_shader_atomic_float16_add
2021-06-16 john Fix two ordering problems.

Created with:
  roll-dep third_party/spirv-headers

Change-Id: Icfe131fd8bdf3b9fd8fa400ba804d2ea57d27562
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58301
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-15 20:03:06 +00:00
Ben Clayton f4e213cf2d CloneContext: Add an overload of Replace() that takes a function
Replace(T* what, T* with) is bug-prone, as more complex transforms may want to clone `what` multiple times, or not at all. In both cases, this will likely result in an ICE as either the replacement will be reachable multiple times, or not at all.

This is the cause of some of the CTS failures reported in crbug.com/tint/993.

Bug: tint:993
Change-Id: I880ece45faab0e7f07230a1b4436f4e9846edc84
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58221
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-07-15 19:10:15 +00:00
Antonio Maiorano 60dae2490d Reland "Validate storage class constraints"
This is a reland of fd5829e5ea

Original change's description:
> Validate storage class constraints
>
> As defined by https://gpuweb.github.io/gpuweb/wgsl/#storage-class-layout-constraints
>
> Bug: tint:643
> Change-Id: I9c78ba69a792a80c263a17b0a6e9b4810fdb7f30
> Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56780
> Kokoro: Kokoro <noreply+kokoro@google.com>
> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
> Reviewed-by: Ben Clayton <bclayton@google.com>

Bug: tint:643
Change-Id: I62036d615a062597339a9d130b7ccf49b5be26c7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58120
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-07-15 19:09:25 +00:00
Ben Clayton 1d10086d28 transform: More robustness for texture ops
Clamp the `level` and `array_index` arguments to `textureLoad()` and `textureStore()`.
Also fix the off-by-one error for the coordinates.

See: https://github.com/gpuweb/gpuweb/pull/1906

Fixed: tint:748
Change-Id: Id7505578b632dcaf75b2a3a020fc0190c612972c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57700
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-07-15 16:41:05 +00:00
Ben Clayton 487a913e31 CloneContext: Remove remnants of clone pointer de-duping
It appears that I didn't do a great job cleaning up the removal of ShareableCloneable in https://dawn-review.googlesource.com/c/tint/+/51484.

Cloning nodes shouldn't return the same pointer. Remove bad comments.
Clean up leftover logic from CloneWithoutTransform().

Change-Id: Ibbc5f625c5978e9c11da59e7aa6197f39b6f0363
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58220
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2021-07-15 16:37:24 +00:00
Ben Clayton ff3dbc361b tools: Add gerrit-stats
Gives you juicy stats for contributions to the project.

Change-Id: I4f3e7f03cc43947675e916a8036317af4a894d12
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57883
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
2021-07-15 16:29:16 +00:00
Ben Clayton 9e0b3cceaf [intrinsics]: Add texture_1d level overloads
Spec changes:
https://github.com/gpuweb/gpuweb/pull/1938
https://github.com/gpuweb/gpuweb/pull/1923

Change-Id: Ib738e15a146d73a75213a17a53e89f98c16b80a4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58040
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2021-07-15 16:14:34 +00:00
Sarah 58bbe32cf4 validation: Allow unsigned workgroup_size component
Bug: tint:923
Change-Id: I7bd7d22279d9c6ce4c3225bdfd8693261b9084f9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58121
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Auto-Submit: Sarah Mashayekhi <sarahmashay@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-07-14 23:33:24 +00:00
Ben Clayton 3242d3e8c9 writer/hlsl: Use vector write helper for dynamic indices
This uses FXC compilation failure mitigation for _any_ vector index assignment that has a non-constant index. FXC can still fall over if the loop calls a function that performs the dynamic index.

Use some vector swizzle logic to avoid branches in the helper.

Fixed: tint:980
Change-Id: I2a759d88a7d884bc61b4631cf57feb4acc8178de
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57882
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-07-14 18:43:51 +00:00
Ben Clayton 8a8ddcfbed debug: Include system in assert string
Change-Id: Id709cef0bfdb7cc1f849a5fb43e9d4f43c28272b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57706
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2021-07-14 18:42:02 +00:00
Ben Clayton d35975adf6 Add test case for tint:978
Bug: tint:978
Change-Id: I2b203e1eec53e70ab34d2063c3b49848bdacb780
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57708
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2021-07-14 18:01:36 +00:00
Antonio Maiorano de2b7db244 Make ArrayLengthFromUniform transform emit a valid UBO
The UBO must have a stride that is a multiple of 16 bytes.
Note that this change was part of https://dawn-review.googlesource.com/c/tint/+/56780
but the CL was reverted because it broke Dawn. This CL relands part of
the change, and adds the macro TINT_EXPECTS_UBOS_TO_BE_MULTIPLE_OF_16 so
that Dawn can conditionally compile against it.

Bug: tint:984
Bug: tint:643
Change-Id: I303b3fe81ff97c4933c489736d5d5432a59ce9b7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57921
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-14 17:28:01 +00:00
Andrii Shyshkalov 4d22c1dc2f [realms] Use LUCI realms on 100% of builds.
R=rharrison

Bug: chromium:1216166
Change-Id: I6bbe4795ad2435d9cb8a9cb929669c2791f649ae
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57467
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Kokoro: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-14 14:52:02 +00:00
James Price 3ad686e8d4 val: Remove source from validation result
This was just echoing back the source that was provided to the
validation routine, and is no longer uses by any callers.

Change-Id: I55aeb7c41405ebbe1b21b9654b94607b651ff118
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57281
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-14 13:23:45 +00:00
James Price 7f142c449f inspector: Remove legacy shader IO support
This is a reland of the CL:
https://dawn-review.googlesource.com/c/tint/+/55402

Now that sanitizers are no longer exposed externally, the Inspector no
longer needs to handle this post-sanitizer world.

Bug: tint:697
Change-Id: Ic02ebb9c529aa132a238285bdd0d0df8686e219b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57104
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-14 13:23:45 +00:00
James Price 4aed3150b5 writer: Remove legacy generator API
Make the sanitizer transforms internal, as the new generator API
automatically runs them.

Change-Id: Ia2674762328b5d91d8370b8c18c31693936e8566
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57102
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-14 13:23:45 +00:00
Alastair Donaldson bbda5723da Add explanatory comment to fuzzer build files
This change adds a comment related to the use of host_toolchain to
account for cross compilation, and removes a print statement that had
been accidentally left in a build script.

Bug: tint:966
Change-Id: I6334225864632d9983ab197bb28fcb972d5ba1d4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58000
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-07-14 13:04:31 +00:00
James Price 5db7d38c13 fuzzers: Switch AST fuzzers to new generator API
Change-Id: If9f843a318be6e9bbb44bc852814811a5e42baf0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57980
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-07-14 12:49:32 +00:00
Ben Clayton 6e459fecb7 sem: Add CompoundStatement
This change introduces sem::CompoundStatement, a new base class for
statements that can hold other statements.

sem::BlockStatements now derives from sem::CompoundStatement, and
this change introduces the following new CompoundStatements:
* `sem::IfStatement`
* `sem::ElseStatement`
* `sem::ForLoopStatement`
* `sem::LoopStatement`
* `sem::SwitchStatement`.
These new CompoundStatements are now inserted into the semantic
tree as now documented in `docs/compound_statements.md`.

The `sem::BlockStatement::FindFirstParent()` methods have been
moved down to `sem::Statement`.

The `Resolver::BlockScope()` method has been replaced with
`Resolver::Scope()` which now maintains the `current_statement_`,
`current_compound_statement_ ` and `current_block_`. This
simplifies statement nesting.

The most significant change in behavior is that statements now
always have a parent, so calling Block() on the initializer or
continuing of a for-loop statement will now return the
BlockStatement that holds the for-loop. Before this would
return nullptr.

Fixed: tint:979
Change-Id: I90e38fd719da2a281ed9210e975ab96171cb6842
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57707
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-07-14 09:44:41 +00:00
Ben Clayton 3e27a20f31 writer: Fix CaseStatment tests
Case statements cannot be used as regular statements. They must exist inside a switch.

Change-Id: Ica2e0573ad926c3e257f02c95397a8666dfcd547
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57705
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
2021-07-13 22:13:11 +00:00
Ben Clayton 8751227258 fuzzers: Disable clang warning for clang 12
Fixes build when using clang 12

Change-Id: Ia60e8690e0b6dbe7c33879dfdf1b41bfcf71f6f6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57884
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-07-13 20:04:51 +00:00
Alastair Donaldson 9f4d94d70e Generate shader corpora for SPIR-V fuzzers
Add a script that generates corpora of SPIR-V shaders for the tint
SPIR-V fuzzers, from test cases in the repository.

Fixes: tint:966
Change-Id: I3be5a868ed8ac9c9cfe3b1d5d7d5607e2e26168d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57881
Auto-Submit: Alastair Donaldson <afdx@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2021-07-13 19:42:22 +00:00
Alastair Donaldson ff0a8f0822 Generate shader corpora for WGSL fuzzers
Adds scripts that generate corpora of WGSL shaders for the tint
WGSL fuzzers, from test cases in the repository.

Bug: tint:966
Change-Id: Icf8293472ff04ca15111acacda8582b11c0723be
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57880
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Alastair Donaldson <afdx@google.com>
2021-07-13 17:11:35 +00:00
Ben Clayton f6a4fe073a Add test case for tint:219
The original problem appears to be fixed.

Fixed: tint:219
Change-Id: I8d16fbb715da3ca149769699c86f86a4bed85b4f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57703
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2021-07-13 16:41:56 +00:00
Ryan Harrison 4166eccb70 Factor out the InspectorHelper from the Inspector test file
This class is very large, so factoring it out into its own seperate
file.

Also renaming it to InspectorBuilder, in anticipation of adding tests
that don't build their state through explicitly calling into the
ProgramBuilder.

BUG=tint:967

Change-Id: I316458a969479200edf6962ab2008180f9a1e7e2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57800
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-07-13 15:34:45 +00:00