When enabled, unsuffixed literals will be treated as abstract numerics.
By having this disabled by default, we can build up the tests without
the risk of breaking production code.
This flag is enabled for resolver unit tests. This can safely be done
with no change in tested behavior, as all tests use the '_i' or '_u'
literal suffixes, so currently there are no tests that exercise abstract
numerics.
Bug: tint:1504
Change-Id: I39523ff6e235a12533b1dd98587b580bed98300f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91025
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
This will test the same path currently exercised by the
WebGPU/Compat prototype in Chrome.
Suppress failing tests.
Bug: dawn:1420
Change-Id: Ie3d55e387ece292a98ec15eeaa04b6fad25e3be7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90080
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Update child objects to ref the device. This allows them to outlive
the device, making the implementation more robust such that it is OK
to drop the device before other objects.
Dropping the last external reference to the device is currently an
implicit device.destroy(). This destruction breaks possible ref cycles
where the device refs internal objects which have a back ref to the
device.
Bug: dawn:1164
Change-Id: I02d8e32a21dcc5f05e531bd690baac4a234b5f6b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90360
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
• Add sem::SwitchStatement::Cases()
• Add sem::CaseStatement::Selectors()
• Add ast::SwitchStatement -> sem::SwitchStatement mapping
Removes a bunch of hopping between the AST and SEM to get at this data.
Change-Id: If48d78e7a386aa0b34c6d00ad9af1d53cb236f12
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91024
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
• Add Name() method so we can print the type name without having to
create a ProgramBuilder.
• Add a DataType for f16.
• Add AST() methods on DataType<AInt> and DataType<AFloat> which return
nullptr.
Change-Id: I130648655e114c658a0c2985822630a71a683dd6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91023
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This patch implements PipelineLayoutD3D12::DestroyImpl() where we
call ReferenceUntilUnused() to all the root and command signatures
so that they won't be destroyed when they are referenced by GPU
operations in-flight on command queue.
BUG=dawn:1422
TEST=dawn_end2end_tests
Change-Id: I54df7b53645c9beaaa2e7b74aef54e0f6d37c440
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90940
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
These two functions in HLSL only accept and return uint. Thus, if the
result of these calls is passed to a function that wants int, it will
fail, or call the uint overload if one exists. Fixed by casting the
result to int if the arg is int.
Bug: tint:1550
Change-Id: Id4c0970a29ac4c83ee5b78be8d2762e05e4a3f03
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91001
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
• Rename the 'friendly names' for the abstract numeric types so they match
the style in the intrinsic table.
• Fix a comment so the literal type is correct.
Change-Id: Ie8d7363743c8c359340de3bc6db9a3456d299d34
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91021
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
• Add sem::Type::Common() which returns the 'common' type for the list of
types.
• Migrate intrisnic table to use this.
• Add a whole-lotta-tests.
• Deduplicate and improve the EXPECT_TEST() macro. Move it to a common home.
Bug: tint:1504
Change-Id: I1564f67ecf87fc594f3f54274da906ff0d822795
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91020
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Add:
• sem::Type::is_abstract_or_scalar()
• sem::Type::ElementOf()
Use these to clean up some code in src/tint/sem/constant.cc.
Bug: tint:1504
Change-Id: I78e06b580a750c97ac654af4b0b364ddd3de6596
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90534
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
With abstract materialization, any ast::Expression may map to the new
sem::Materialize node. Because of this, we can't assume that an
ast::CallExpression maps to a sem::Call, as it might be wrapped by a
sem::Materialize.
Remove the mapping, and fix up all the code that was relying on this.
Fixes are done by either:
• Calling `UnwrapMaterialize()->As<sem::Call>()` on the semantic
expression. This is done when the logic may assume it's possible for
the expression to be a Materialize node.
• Using the explicit sem::Info::Get<sem::Call>() template argument to
cast the semantic type to sem::Call. This is done when the logic
either knows it is impossible for the expression to be a Materialize.
The backends have been stubbed, as we'll want to emit the constant value
for these nodes. It's likely that we'll just use the FoldConstants
transform to strip all Materialize nodes from the tree. For now, be
defensive.
Bug: tint:1504
Change-Id: If9231b300fc30c7fe886c17a804ead8ee2988285
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90533
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
• Split type_ctors_ into array_ctors_ and struct_ctors_. These are the
only two type constructors that we need to cache in the Resovler. All
other types are cached in the IntrinsicTable. By making these two
separate fields, there's no way we can accidentally put other types in
there. This is slightly more optimized too, as each map is smaller,
and the keys hold less data.
• Drop the 'const' on vectors that are std::move()'d. A const object
cannot be moved, and this results in a silent copy. Fix the logic of
BuiltinCall() and FunctionCall(), as these were happily using the
vectors that had been moved.
• Extract the messy Texture-Sampling collection logic out into two
functions.
The rest of the changes are tweaks required to handle abstract numerics
and materialization, which will be put up for review shortly. Landing
the no-op refactoring now reduces review noise later.
Bug: tint:1504
Change-Id: Iffc8039360d6138c3ac9b456be6ca7b8451ede9f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90532
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
A new semantic expression node that wraps another semantic node. Used to
indicate the point at which compile-time, abstract numeric typed
expressions are implicitly converted to a concrete type.
Bug: tint:1504
Change-Id: I52e256bbbdeaa9d9eff4cb93b6f937dd00bdc5cb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90531
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
These aren't used by anything (yet). Baby steps.
Bug: tint:1504
Change-Id: Icf0261ec9c6802f004d9f1bc4780a6376ebb8dfb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90530
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
TypeMatcher::String() was not respecting the [[display]] decoration of
the matcher's sub-types. By calling TypeMatcher::String() on the sub-types,
we can display the custom type names in diagnostics.
Bug: tint:1504
Change-Id: I0856fee31231f9c048d2e3028d25c4d261fbb008
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90529
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
When we initialize the dst texture before T2T copy, we clear a
buffer with zeros and do a B2T copy in order to initialize the
texture. The T2T copy may only copy a subrect of the texture's
subresource, so does the initialization via B2T copy. As a result,
the buffer can store compact zeros for that exact subrect and then
do an exact B2T copy to initialize that area.
However, the current B2T copy uses incorrect data layout for the
buffer, making some part of the dst texture uninitialized, and
even leading to D3D12 runtime validation errors sometimes if it
goes beyond the boundary of staging buffer pool (4MB).
This change fixes this bug via using the exact height of copy area
to replace dataLayout.rowsPerImage (unnecessary padding rows included)
for the height of each depth image for 3D textures.
Bug: dawn:1288
Change-Id: I303e0d363039a6a87e352a8445898031e673cf4e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90780
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
We already have third_party/webgpu-cts. This came in during the tint ->
Dawn merge, and is not necessary (and confusing).
Change-Id: I1a4ce4463e55624b5f720573c54f45d1d1dc57e7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90900
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
According to the spec, when call draw or drawIndexed, vertex step mode
vertex buffer never OOB if (vertexCount + firstVertex) = 0, and instance
step mode vertex buffer never OOB if (instanceCount + firstInstance) = 0.
Modify the validation implementation to be aligned with the spec, and
add corresponding unit tests.
This patch also add unit test case for (strideCount - 1) * arrayStride +
lastStride <= bound buffer size < strideCount * arrayStride.
Bug: dawn:1287
Change-Id: If444e400f5ac24f86ca12ff59fb886d8ef70e8c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90584
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
* Extract ast::Enable::ExtensionKind to ast::Extension.
* Move the parsing out of ast::Enable and next to ast/extension.h
* Change the ast::Enable constructor to take the Extension, instead of
a std::string. It's the WGSL parser's responsibility to parse, not the
AST nodes.
* Add ProgramBuilder::Enable() helper.
* Keep ast::Module simple - keep track of the declared AST Enable nodes,
don't do any deduplicating of the enabled extensions.
* Add the de-duplicated ast::Extensions to the sem::Module.
* Remove the kInternalExtensionForTesting enum value - we have kF16
now, which can be used instead for testing.
* Rename kNoExtension to kNone.
Bug: tint:1472
Change-Id: I9af635e95d36991ea468e6e0bf6798bb50937edc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90523
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Support overload resolution of abstract-numeric argument types,
allowing them to implicitly convert down to concrete parameter
types (and in the near future, abstract parameter types).
Major kudos to cwallez for the suggested algorithm which is a
minor adaption of what we had already.
Bug: tint:1504
Change-Id: I85fa8e70ab0b6aa643caec4c51433f15784af55f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90522
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Add support for a [[precedence(N)]] decoration on intrinsic table type
declarations. This will be used to ensure the type with the lowest
conversion rank is matched when a matcher could match multiple types
for a given abstract numeric argument type.
Bug: tint:1504
Change-Id: I96475b000c0917bbfa4e2873b1731ce048b96a7d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90664
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Relying on the config inside //build breaks in projects that use their
own version of //build instead of Chromium's.
Bug: dawn:1405
Change-Id: I18bbf5c6ddce18e6900f5f4b937d91a152bb2b32
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90524
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Adds ForTesting APIs to the instance to track the number of devices.
Bug: dawn:1164
Change-Id: Ib743afb1e86ef16740d49613f43f9e2f009232bc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90583
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
The following are now all passing:
• webgpu:shader,execution,expression,call,builtin,ceil:*
• webgpu:shader,execution,expression,call,builtin,floor:*
• webgpu:shader,execution,expression,call,builtin,fract:*
Remove the `KEEP` for the bulk of the shader execution failures.
This will enable the chunk to remove rules for tests when they start passing.
Bug: dawn:1546
Change-Id: I927804b81192efaed00b95aeebd268ec15f358c9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90521
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>