The concept of 'closing' an open type or number made sense when these
were immutable once the first type/number had been matched during
overload resolution.
In order to support abstract numerics, these template parameters need to
be constrained as the arguments are evaluated, so there's no longer a
binary open / closed state.
Give up on this concept, and rename everything to 'template type' and
'template number'. This is likely easier for people to understand
anyway.
Also fix a small typo in the ICE message printed when there's an
ambiguous overload resolution (should never happen with the current
entries in the table).
Bug: tint:1504
Change-Id: I2bf043c71e5afa757259968eae4af830c50f38e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90662
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Migrate from a hand-rolled tagged-union of [i32, u32, f32, f16, bool]
types. Instead use a std::variant of [AInt, AFloat, bool]. The Constant
holds the actual type, so no information is lost with the reduced types.
Note: Currently integer constants are still limited to 32-bits in size.
This is enforced by the frontend.
Bug: tint:1504
Change-Id: I316957787649c454fffb532334159d726cd1fb2d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90643
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Remove the ProgramBuilder from ClosedState and use a pointer for the
'overload' field instead of a reference. Let's the Candidate be
copy-assignable, which in turn, allows the Candidates vector to be
sorted directly, instead of jumping through hoops to use moves.
Replace random mix of 'int', 'uint8_t' with 'size_t' (externally to the
constant table data). Reduces fragile weak binding between distant code.
Swap the overload scoring order (high-best -> low-best). Remove the
'matched' field - we can now just check whether the 'score' is 0.
Further simplifies sorting.
Change-Id: I4a4b7934be337306202647d096c546eab5c8498f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90641
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
I like to create multiple build folders at the root for different types
of CMake builds:
build-clang
build_asan
etc.
Don't want these showing up in git status.
Change-Id: I03fe5a812f7090e6d6481a5b07bc8c95a33ac106
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90601
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Use 'df' to print the disk utilization whenever we print a task status.
This is to help try to identify spurious out-of-disk flakes we've been seeing.
Change-Id: If26527923e2af720786626a6248699927eb5f430
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90642
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Chromium can also set checkout_clang_tidy, in which cause Dawn should
still not attempt to checkout its own.
Bug: chromium:1326292
Change-Id: I3c41ad49e5d72cc31ed44455a444c8caf3aefc43
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90640
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
If the CallSiteRequiredToBeUniform tag is present, add the edge from
RequiredToBeUniform to a new diagnostic node for the function call,
instead of to the control flow coming out of the function call. Doing
the latter causes a false positive when a function both requires
uniform control flow and causes non-uniform control flow.
Bug: tint:880
Change-Id: Icade8f76302e8c21529502f5f945f1981acfc45a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90582
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: James Price <jrprice@google.com>
This reverts commit 63cea3f8c0.
...except it skips adding the the constructor/destructor/copy
definitions for dawn::native::Format. Adding them triggers "constexpr
variable cannot have non-literal type" (or "declaration requires a
global constructor" if it's not marked constexpr), unless they're
explicitly marked as =default in the header - which just triggers a
different chromium-style warning, so there's no point.
A better solution to the chromium-style warning on Format may be to just
make the class physically smaller:
https://www.chromium.org/developers/coding-style/chromium-style-checker-errors/#constructordestructor-errors
Bug: dawn:1405
Change-Id: Ied6e9d0abff6bf1330131a40c6583bab18888b67
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90303
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Eliminates a static initializer in kUnusedFormat (in Texture.cpp) by
making dawn::native::Format constexpr-constructible.
kUnusedFormat doesn't actually have to be constexpr to fix this, but it
adds explicit enforcement that it's constexpr-constructible.
Includes some extra initializers as a workaround for a bug in the old
version of MSVC (14.26) that's on Kokoro. amaiorano figured out how to
reproduce it locally, with a local install of VS2019 and this magic
CMake incantation:
$ cmake -G "Visual Studio 16 2019" -T v142,version=14.26 ..
Bug: dawn:1405
Change-Id: Ic94324fc624fd720671dec35dcc5ea8ad77ee46d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89863
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
This is still under investigation, but let's skip for now as it makes
the CTS run very long.
Bug: tint:1524
Change-Id: Ic238ea22119f6165a3d22582bfb93ffd57efed3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90560
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Antonio Maiorano <amaiorano@google.com>
For all types except for arrays and structures, which are explicitly
typed and have trivial overloads.
This will simplify maintenance of type functions, unifies diagnostic
messages and will greatly simplify the [AbstractInt -> i32|u32]
[AbstractFloat -> f32|f16] logic.
Bug: tint:1504
Change-Id: I2b17ed530d1cece22adcbfc6de0bec4fbda4c7bd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90248
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This will allow the bots to specify a particular backend.
Change-Id: I9486019c3aef3f8aafb79e30dfc62d23ae9eefac
Bug: dawn:1420
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90320
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This CL adds the DEPS entry to checkout `clang-tidy` if requested
in the `.gclient` config file. A doc is added which gives some
guidance on how to run `clang-tidy`.
Change-Id: I92eeaff33137158ffd17315649fb333c366fc91d
Bug: dawn:1414
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89801
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
When importing Dawn into Tint:
error: [chromium-style] auto variable type must not deduce to a raw pointer type.
Change-Id: I6ff4451a5519c38b18eb8d96f6bc82b8090077f8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90500
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
The bitwise-and and bitwise-or binary operators on booleans result in an integer.
Explicitly cast this back to a boolean.
Fixed: tint:1540
Fixed: tint:1541
Change-Id: I395176f291e6080c88b8cff18e14ed6cd1234074
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90501
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
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>