Fixes a stack overflow when traversing particularly deep graphs.
This changes the iteration order which changes some of the diagnostic
notes, but the diagnostics are still correct and deterministic so it
does not matter.
Fixed: chromium:47418
Change-Id: I2def633b6d96d1525027f7929b0fa0a6fba0efeb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90140
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Add additional nodes to capture places where control flow is changed
(if, switch, for, short-circuiting op, function call), and use these
to show the actual point at which control flow became non-uniform as a
result of a non-uniform value.
Do this recursively, to capture cases where control flow becomes
non-uniform after a function call statement.
Bug: tint:880
Change-Id: Ied92d690f98a5c11a1892eef500a50d0f123943d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89862
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
These are currently not used, but the first step towards moving type
constructors and converters over to using the intrinisc table.
This will simplify maintenance of type functions, and will greatly
simplify the [AbstractInt -> i32|u32] [AbstractFloat -> f32|f16] logic.
Bug: tint:1504
Change-Id: I15526670a6ff801e66551ab5adc37b1570ac49de
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90242
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
- Match indentation in the whole third_party/CMakeLists.txt file
- Import glslang after SPIRV-Tools to avoid a warning that HLSL code
might be invalid.
- Disable installs for glslang.
- Fix casing of one "using Foo"
Change-Id: Ia7b32501cb84e0fe2df9cde0762cee774ef65581
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90245
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This patch adds a workaround on a DXC error in the translation of DP4a
functions that the third parameter "acc" of both dot4add_i8packed() and
dot4add_u8packed() can only be a variable, or a compile error will be
generated.
Bug: tint:1497
Test: tint_unittests
Change-Id: I263d27fb18bd354e0c9110f60cbc98860cf7afe5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90027
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
If the WGSL provided over 255 arguments, then we'd overflow the uint8_t,
and a bad candidate could be matched.
We have validation in place to ensure that user functions are not
declared with more than 255 parameters, but no validation for number of
arguments provided.
Fixed: chromium:1323605
Change-Id: I048709e8b02bdd95d5082128a1186080c79b2fc7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90249
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
GetOrCreateAttachmentState access mCaches in Device even if device is
already destroyed. Gate the function by checking if encoder is
destroyed.
Bug: chromium:1323310
Change-Id: I8151c5ec696e4da28b8296d9142f3120379782ef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89860
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
Remove the space between operator"" and the name of the function, as per
the C++ spec. cppreference says as much, but its example code inserts a
space, confusingly.
Fixed: tint:1535
Change-Id: I46ac8fab74290db1a3c0085b56bc66a4c1d318f4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90280
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
The shader source can be very large and this is causing excessively
large error messages that get truncated in some applications that use
Dawn native. We don't need to see the whole shader in the error
message.
Change-Id: I15ad7fa7814d19875a7c28b39e5fa9a24f265b98
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90161
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
These notes often contain additional useful information that is not
currently being surfaced to the developer console.
Change-Id: I342bfc3147593755d6addf5466f27b083f954826
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90160
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Fix the namespace - this should have been tint::resolver.
Use a single u32 bitset for overload flags instead of multiple fields.
Bug: tint:1504
Change-Id: I633b21ce14e20fc9aeeed5221886c1d22e327bdc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90241
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Do the partitioning of unary and binary operators in the intrinsic table
generators, instead of searching all operators at runtime.
Will allow code to be simplified.
Bug: tint:1504
Change-Id: I67246b954e530e0542b1b67c99fb34a756cf532a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90240
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This patch:
1. Add the `f16` WGSL extension.
2. Add `f16` as keyword, and remove it from reserved word list.
3. Add ast::f16 and sem::f16, and implement validation that using `f16`
type must be with `f16` extension enabled.
4. Add `Number<NumberKindF16>` for f16 literal and constant, and add
`ast::FloatLiteralExpression::Suffix::kH`.
5. Add placeholder in all writer which report error when try to emit f16
type.
Bugs: tint:1473, tint:1502
Change-Id: Ifb363beeb2699ed7cac57e07227d1b2cfa8050b4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89922
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
This patch make `sem::Vector::Size()` and `Align()` more general to
prepare for subtypes of 16bits, e.g. f16. Previously these methods
assert that the subtypes are of 4bytes.
Change-Id: Ic939f177e87faabdf17d1d404cee82a91072a179
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90163
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
The WebGPU spec says that a validation error is produced if there is a
color target in the pipeline descriptor that has writeMask!=0 while
there are no shader outputs for this target. In Dawn format==undefined
is used as a tag that the color target is not present, so writeMask is
allowed to be 0 if format==undefined. (the validation in the case where
format!=undefined was already present).
Fixed: dawn:1376
Change-Id: I7737b6557223e0fc31740fd4ec2cbfaa54b77a71
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90040
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
It's useful to override them in Chrome so that HandleCommands
can be wrapped with some logic.
Bug: chromium:1315260
Change-Id: I856c360575bf6696cd51c13d8ce326afa2f2e08b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89704
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Add tests for the source information for all binary expressions.
Change-Id: I163cddf60eab4b7af8a1bafb899a1d5bfff6fe0c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89802
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
If the function has no return statements, we need to do this to
capture the potential non-uniformity coming from nested function
calls.
This also removes the need to add explicit edges for discard
statements, so remove them.
Bug: tint:880
Change-Id: I88b1132faf35a6d36460ef353912f77a15f8abaa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89861
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
[chromium-style] auto variable type must not deduce to a raw pointer type
Fixes Dawn -> Tint roll
Change-Id: I1e249dd9891d2f93d631032c1721e8980d8cb343
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90000
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Instead of Failure.
If we have duplicate results (same query, same tags), but with different results, then we have to merge them. Previously we'd merge Pass and Slow as Failure, which was just odd. Fix this so the combined result is Slow.
Bug: dawn:1342
Change-Id: If9b035bb3c1e59b7a93a5c8b194f854405e656d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89960
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Chromium tracks the devices which live on the wire so it can
automatically call tick on devices that have pending work. This used
to be done by querying an (id, generation) pair and checking if it
resolves to a non-null device.
This CL adds a new way to query directly using the device, since a
refactor in Chrome will change creation such that the id and generation
is not known when a new device is requested.
Also fixes a bug for device callbacks where the required callback
userdata wasn't fully populated for devices created with
requestAdapter. Update a test to check for this as well.
Bug: chromium:1315260
Change-Id: I7468edc3e77bade191e1e9f3eaadebbf4441d88a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89520
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Show the original source of non-uniformity when producing errors from
the uniformity analysis.
Bug: tint:880
Change-Id: Id386ae8fa5ff1b1443d54c0b5ef12ab76b3b3f13
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89723
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
When producing an error from the uniformity analysis, add notes to
show the underlying reason for the uniformity requirement.
For function calls that are required-to-be-uniform, show the innermost
builtin call that has the requirement.
For function parameters that are required-to-be-uniform, recurse into
that function to show where its requirement comes from.
Add some new tests to specifically test the error messages.
Bug: tint:880
Change-Id: Ib166fdeceaffb156a3afc50ebc5a4ad0860dc002
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89722
Reviewed-by: Ben Clayton <bclayton@google.com>
Move the control flow graphs to `FunctionInfo` so that they are not
destroyed when we finish processing the function.
This will make it easier to produce more detailed diagnostics for
uniformity issues, which will be coming in subsequent CLs.
There is no functional change in this CL.
Bug: tint:880
Change-Id: I1322fb54b16bd1c660799a62435fbdcd7fb39cb2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89822
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This implements the uniformity analysis as currently described in the
WGSL specification. Uniformity issues are presented as warnings, and
will be switched to errors in a future release.
A follow-up patch will improve the error messages, which currently
just show the point at which a uniformity was detected.
In a future release, once we have obtained initial feedback from
users, uniformity issues will become errors.
Bug: tint:880
Change-Id: I7d0b3080932c786c5d50b55720fec6d19f00d356
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88368
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Bug: dawn:1410
Change-Id: I0ad4873474614bcd62638583bf905ff2742eaae2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89821
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>