[webkit-changes] [WebKit/WebKit] 1f4a07: [WebGPU] read_write storage textures should use ap...

2024-07-22 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1f4a0763d4cea8cc3bd5c0fb9ce4b26af441719e
  
https://github.com/WebKit/WebKit/commit/1f4a0763d4cea8cc3bd5c0fb9ce4b26af441719e
  Author: Tadeu Zagallo 
  Date:   2024-07-22 (Mon, 22 Jul 2024)

  Changed paths:
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp

  Log Message:
  ---
  [WebGPU] read_write storage textures should use appropriate fence functions, 
when needed
https://bugs.webkit.org/show_bug.cgi?id=276490
rdar://131545944

Reviewed by Mike Wyrzykowski.

Emit a fence after textureStore calls if the texture has read_write access 
mode. This
fixes the following CTS test: 
shader,execution,memory_model,texture_intra_invocation_coherence:*

* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::emitTextureStore):

Canonical link: https://commits.webkit.org/281217@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] ee913e: [WebGPU] https://compute.toys/view/1173 fails to load

2024-07-09 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ee913e1ce61d355cdc97cb330cc57639578f2449
  
https://github.com/WebKit/WebKit/commit/ee913e1ce61d355cdc97cb330cc57639578f2449
  Author: Tadeu Zagallo 
  Date:   2024-07-09 (Tue, 09 Jul 2024)

  Changed paths:
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
M Source/WebGPU/WGSL/tests/valid/packing.wgsl

  Log Message:
  ---
  [WebGPU] https://compute.toys/view/1173 fails to load
https://bugs.webkit.org/show_bug.cgi?id=276262
rdar://131184432

Reviewed by Mike Wyrzykowski.

There was an incorrect condition that we should only emit a packed type if it 
was
constructible. This was implemented to fix a test, but the test still passes 
after
changing it back, which makes me think there was an underlying issue that has 
already
been fixed.

* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/tests/valid/packing.wgsl:

Canonical link: https://commits.webkit.org/280769@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 2f1f2a: [WebGPU] https://compute.toys/view/1203 fails to l...

2024-07-08 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2f1f2aab9d91e6a1875d5d43fbc94e8e076dbe71
  
https://github.com/WebKit/WebKit/commit/2f1f2aab9d91e6a1875d5d43fbc94e8e076dbe71
  Author: Tadeu Zagallo 
  Date:   2024-07-08 (Mon, 08 Jul 2024)

  Changed paths:
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
M Source/WebGPU/WGSL/tests/valid/packing.wgsl

  Log Message:
  ---
  [WebGPU] https://compute.toys/view/1203 fails to load (works in Chrome)
https://bugs.webkit.org/show_bug.cgi?id=276229
rdar://131126958

Reviewed by Mike Wyrzykowski.

Originally, we had a problem with the left-hand side of compound assignments 
getting
unpacked, so we changed it so that the packing of the right-hand had to match 
the
packing of the left (instead of always unpacking it). That works for some cases,
but not for arrays of vec3, since that uses PackedVec3, which can't be used in
operations with packed_vec3. e.g. `array[0] += vec3f(0)` would have type 
PackedVec3
on the lhs and a packed_vec3 in the rhs, which are incompatible. In order to fix
that, both the lhs and rhs should always be unpacked. The unfortunate part about
that is that during code generation the expression gets rewritten into `lhs = 
lhs + rhs`,
which should become `lhs = pack(unpack(lhs) + unpack(rhs))`, but it is not 
trivial
to rewrite that with our current API. We work around that by generating
`unpack(lhs) += unpack(rhs)`, then during code generation we skip the `unpack`
call on the lhs, resulting in the final code `lhs += unpack(lhs) + unpack(rhs)`.
Notice that this is missing the `pack` call on the rhs, that works since the 
packed
type can be implicitly constructed from the unpacked type.

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::visit):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/tests/valid/packing.wgsl:

Canonical link: https://commits.webkit.org/280731@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 3b1cf8: [WGSL] Offset parameter to texture functions shoul...

2024-07-08 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3b1cf88ddf2b118045096099a656ced989c7546d
  
https://github.com/WebKit/WebKit/commit/3b1cf88ddf2b118045096099a656ced989c7546d
  Author: Tadeu Zagallo 
  Date:   2024-07-08 (Mon, 08 Jul 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp
A Source/WebGPU/WGSL/tests/invalid/texture-offset.wgsl

  Log Message:
  ---
  [WGSL] Offset parameter to texture functions should be a const-expression
https://bugs.webkit.org/show_bug.cgi?id=276226
rdar://130227871

Reviewed by Mike Wyrzykowski.

According to the spec, the `offset` argument to texture functions must be a
const-expression, and the values must be between -8 and 7.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/tests/invalid/texture-offset.wgsl: Added.

Canonical link: https://commits.webkit.org/280726@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] f6b375: [WGSL] built-in functions should only be allowed i...

2024-07-04 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f6b375129695f4b25759d9780f4521f482f93335
  
https://github.com/WebKit/WebKit/commit/f6b375129695f4b25759d9780f4521f482f93335
  Author: Tadeu Zagallo 
  Date:   2024-07-04 (Thu, 04 Jul 2024)

  Changed paths:
M Source/WebGPU/WGSL/AST/ASTCallExpression.h
M Source/WebGPU/WGSL/TypeCheck.cpp
A Source/WebGPU/WGSL/VisibilityValidator.cpp
A Source/WebGPU/WGSL/VisibilityValidator.h
M Source/WebGPU/WGSL/WGSL.cpp
A Source/WebGPU/WGSL/tests/invalid/visibility.wgsl
M Source/WebGPU/WGSL/tests/valid/overload.wgsl
M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj

  Log Message:
  ---
  [WGSL] built-in functions should only be allowed in appropriate shader stages
https://bugs.webkit.org/show_bug.cgi?id=276140
rdar://130225282

Reviewed by Mike Wyrzykowski.

We already had the information about which shader stages the built-ins could be
called from, but we were missing the check. Add a new pass that traverses the
call graph and checks if all the built-ins are called from the appropriate 
stages.

* Source/WebGPU/WGSL/AST/ASTCallExpression.h:
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::chooseOverload):
* Source/WebGPU/WGSL/VisibilityValidator.cpp: Added.
(WGSL::VisibilityValidator::VisibilityValidator):
(WGSL::VisibilityValidator::validate):
(WGSL::VisibilityValidator::visit):
(WGSL::VisibilityValidator::error):
(WGSL::validateVisibility):
* Source/WebGPU/WGSL/VisibilityValidator.h: Added.
* Source/WebGPU/WGSL/WGSL.cpp:
(WGSL::staticCheck):
* Source/WebGPU/WGSL/tests/invalid/visibility.wgsl: Added.
* Source/WebGPU/WGSL/tests/valid/overload.wgsl:
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:

Canonical link: https://commits.webkit.org/280662@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 438e5a: [WGSL] Struct size computation can still overflow

2024-07-02 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 438e5ad731250075ae206b438270062bef527874
  
https://github.com/WebKit/WebKit/commit/438e5ad731250075ae206b438270062bef527874
  Author: Tadeu Zagallo 
  Date:   2024-07-02 (Tue, 02 Jul 2024)

  Changed paths:
A LayoutTests/fast/webgpu/regression/repro_130656572-expected.txt
A LayoutTests/fast/webgpu/regression/repro_130656572.html
M Source/WebGPU/WGSL/AttributeValidator.cpp

  Log Message:
  ---
  [WGSL] Struct size computation can still overflow
https://bugs.webkit.org/show_bug.cgi?id=276083
rdar://130656572

Reviewed by Mike Wyrzykowski.

There were still two places were we added to offset, which isn't a checked 
value.

* LayoutTests/fast/webgpu/regression/repro_130656572-expected.txt: Added.
* LayoutTests/fast/webgpu/regression/repro_130656572.html: Added.
* Source/WebGPU/WGSL/AttributeValidator.cpp:
(WGSL::AttributeValidator::visit):

Canonical link: https://commits.webkit.org/280579@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 9cf3c6: [WGSL] const_assert should not generate code

2024-06-26 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9cf3c6cb2077104e655ebb47ae777b1e4d2ccd55
  
https://github.com/WebKit/WebKit/commit/9cf3c6cb2077104e655ebb47ae777b1e4d2ccd55
  Author: Tadeu Zagallo 
  Date:   2024-06-26 (Wed, 26 Jun 2024)

  Changed paths:
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
A Source/WebGPU/WGSL/tests/valid/fuzz-130088292.wgsl

  Log Message:
  ---
  [WGSL] const_assert should not generate code
https://bugs.webkit.org/show_bug.cgi?id=275856
rdar://130088292

Reviewed by Mike Wyrzykowski.

The code generator was missing the entry for const_assert, so by default the 
assert
condition was being generated.

* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/tests/valid/fuzz-130088292.wgsl: Added.

Canonical link: https://commits.webkit.org/280372@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] c49e50: [WGSL] Compound assignments incorrectly (un)pack t...

2024-06-26 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c49e508c6e3f5fc1f557e88df625c6e2d23af986
  
https://github.com/WebKit/WebKit/commit/c49e508c6e3f5fc1f557e88df625c6e2d23af986
  Author: Tadeu Zagallo 
  Date:   2024-06-26 (Wed, 26 Jun 2024)

  Changed paths:
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
A Source/WebGPU/WGSL/tests/valid/fuzz-130082002.wgsl

  Log Message:
  ---
  [WGSL] Compound assignments incorrectly (un)pack the assignee
https://bugs.webkit.org/show_bug.cgi?id=275855
rdar://130082002

Reviewed by Mike Wyrzykowski.

The default behavior in the global rewriter is that all expressions get unpack,
any exceptions need to be handled manually, as we do for assignments. However,
the rewriter was missing an entry for compound assignments (e.g. x += y).

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::visit):
* Source/WebGPU/WGSL/tests/valid/fuzz-130082002.wgsl: Added.

Canonical link: https://commits.webkit.org/280371@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 2b4f5e: [WGSL] Struct offset can overflow

2024-06-26 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2b4f5ef73598b70e32abd9def228f9d9f25462aa
  
https://github.com/WebKit/WebKit/commit/2b4f5ef73598b70e32abd9def228f9d9f25462aa
  Author: Tadeu Zagallo 
  Date:   2024-06-26 (Wed, 26 Jun 2024)

  Changed paths:
M Source/WebGPU/WGSL/AttributeValidator.cpp
M Source/WebGPU/WGSL/tests/valid/struct.wgsl

  Log Message:
  ---
  [WGSL] Struct offset can overflow
https://bugs.webkit.org/show_bug.cgi?id=275850
rdar://130092379

Reviewed by Mike Wyrzykowski.

We fixed a similar issue with the struct size overflowing in 279809@main, but I 
missed
that the same could happen to the offset. The issue was that all the operations 
were
already using Checked types, except rounding up the offset to the required 
alignment,
which is where the overflow happened.

* Source/WebGPU/WGSL/AttributeValidator.cpp:
(WGSL::AttributeValidator::visit):
* Source/WebGPU/WGSL/tests/valid/struct.wgsl:

Canonical link: https://commits.webkit.org/280370@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 82a098: [WGSL] Pointer rewriting causes variables to have ...

2024-06-25 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 82a09825dd6e6bc0b87a6e2847d735282b60d6cc
  
https://github.com/WebKit/WebKit/commit/82a09825dd6e6bc0b87a6e2847d735282b60d6cc
  Author: Tadeu Zagallo 
  Date:   2024-06-25 (Tue, 25 Jun 2024)

  Changed paths:
M Source/WebGPU/WGSL/AST/ASTVariable.h
M Source/WebGPU/WGSL/TypeCheck.cpp
A Source/WebGPU/WGSL/tests/valid/fuzz-130092499.wgsl

  Log Message:
  ---
  [WGSL] Pointer rewriting causes variables to have the wrong type
https://bugs.webkit.org/show_bug.cgi?id=275816
rdar://130092499

Reviewed by Mike Wyrzykowski.

The type checker can update the type of a variable's initializer expression to 
satisfy
the constraints on initializers, in this case a variable cannot have a 
reference type,
so it updates the expression to have the reference's underlying type (e.g. i32& 
becomes
i32). However, during pointer rewriting the initializer expression can change, 
erasing
the type coercion. To fix that, we now save the computed "store type" for the 
variable
in the AST::Variable node itself, so that it's preserved even if the 
initializer changes.

* Source/WebGPU/WGSL/AST/ASTVariable.h:
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/tests/valid/fuzz-130092499.wgsl: Added.

Canonical link: https://commits.webkit.org/280330@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] eeebca: [WGSL] Parser does not require semicolon after ass...

2024-06-25 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: eeebca849bb2f0561dbcb9ce717befce3f46873b
  
https://github.com/WebKit/WebKit/commit/eeebca849bb2f0561dbcb9ce717befce3f46873b
  Author: Tadeu Zagallo 
  Date:   2024-06-25 (Tue, 25 Jun 2024)

  Changed paths:
M Source/WebGPU/WGSL/Parser.cpp
A Source/WebGPU/WGSL/tests/invalid/parse-pointer-assignment.wgsl

  Log Message:
  ---
  [WGSL] Parser does not require semicolon after assignment
https://bugs.webkit.org/show_bug.cgi?id=275817
rdar://130424224

Reviewed by Mike Wyrzykowski.

The parser was not requiring after assignments that used unary operators on the
left-hand side (e.g. * = 1).

* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser::parseStatement):
* Source/WebGPU/WGSL/tests/invalid/parse-pointer-assignment.wgsl: Added.

Canonical link: https://commits.webkit.org/280329@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 22543a: [WGSL] shader, execution, flow_control, switch:switch...

2024-06-19 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 22543ab3dd20ac898a8a0c95d716c3799f7a36b4
  
https://github.com/WebKit/WebKit/commit/22543ab3dd20ac898a8a0c95d716c3799f7a36b4
  Author: Tadeu Zagallo 
  Date:   2024-06-19 (Wed, 19 Jun 2024)

  Changed paths:
M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/flow_control/switch-expected.txt
M LayoutTests/platform/mac-wk2/TestExpectations
M Source/WebGPU/WGSL/AST/ASTContinueStatement.h
M Source/WebGPU/WGSL/AST/ASTLoopStatement.h
M Source/WebGPU/WGSL/AST/ASTSwitchStatement.h
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
M Source/WebGPU/WGSL/TypeCheck.cpp
A Source/WebGPU/WGSL/tests/invalid/continue.wgsl

  Log Message:
  ---
  [WGSL] 
shader,execution,flow_control,switch:switch_inside_loop_with_continue:* is 
failing
https://bugs.webkit.org/show_bug.cgi?id=275636
rdar://13044

Reviewed by Mike Wyrzykowski.

In WGSL, the `loop` statement can have a `continuing` block which gets evaluated
whenever there is a `continue` statement in the loop body. This is implemented 
by
copying the contents of the `continuing` block before each `continue` statement.
However, there's a small issue: the `continuing` block may contain a `break-if`,
and there might be a `continue` statement within a `switch`. Currently, we don't
handle this case, so we generate the `break` statement inside the `switch`, 
which
means that the `break` targets the `switch` instead of the `loop`.

To fix this issue we need to detect when there's a `switch` statement within a
`loop` statement that contains a `continuing` block. Then, the code for the 
`continuing`
cannot be copied into the `switch`, so we generate the code after the switch and
use a local variable to track whether it should run. We also need to detect 
whether
the `switch` is nested multiple levels deep, since that requires emitting 
different
code to go the enclosing `switch`, instead of emitting the `continuing` block.

* 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/flow_control/switch-expected.txt:
* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebGPU/WGSL/AST/ASTContinueStatement.h:
* Source/WebGPU/WGSL/AST/ASTLoopStatement.h:
* Source/WebGPU/WGSL/AST/ASTSwitchStatement.h:
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::analyze):
* Source/WebGPU/WGSL/tests/invalid/continue.wgsl: Added.

Canonical link: https://commits.webkit.org/280178@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] f3b78a: [WGSL] Type::size should work for primitive structs

2024-06-14 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f3b78a0f53405ce4616815e5b8c56001bf2c7f68
  
https://github.com/WebKit/WebKit/commit/f3b78a0f53405ce4616815e5b8c56001bf2c7f68
  Author: Tadeu Zagallo 
  Date:   2024-06-14 (Fri, 14 Jun 2024)

  Changed paths:
M Source/WebGPU/WGSL/Types.cpp
M Source/WebGPU/WGSL/tests/valid/struct.wgsl

  Log Message:
  ---
  [WGSL] Type::size should work for primitive structs
https://bugs.webkit.org/show_bug.cgi?id=275444
rdar://129771751

Reviewed by Mike Wyrzykowski.

Originally Type::size was only used for calculating the size of resources, so
only types that could used for resources were supported. As of 279876@main it's
also used to get the size of local variables, which can also be primitive 
structs.

* Source/WebGPU/WGSL/Types.cpp:
(WGSL::Type::size const):
* Source/WebGPU/WGSL/tests/valid/struct.wgsl:

Canonical link: https://commits.webkit.org/280010@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 89a9ae: [WebGPU] error in WGSL::prepare with attached WGSL...

2024-06-13 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 89a9ae9c43f42e50267b9924530d22abf920f908
  
https://github.com/WebKit/WebKit/commit/89a9ae9c43f42e50267b9924530d22abf920f908
  Author: Tadeu Zagallo 
  Date:   2024-06-13 (Thu, 13 Jun 2024)

  Changed paths:
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
A Source/WebGPU/WGSL/tests/valid/array-length-unordered.wgsl

  Log Message:
  ---
  [WebGPU] error in WGSL::prepare with attached WGSL source
https://bugs.webkit.org/show_bug.cgi?id=275406
rdar://129691678

Reviewed by Mike Wyrzykowski and Dan Glastonbury.

The generated `_ArrayLength` variable's `@binding` was colliding with 
user-defined
variables. The issue was that the `@binding` was calculated based in the last
variable in binding group, but the group wasn't sorted, so the last variable 
might
not contain the biggest binding for the group.

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::collectGlobals):
* Source/WebGPU/WGSL/tests/valid/array-length-unordered.wgsl: Added.

Canonical link: https://commits.webkit.org/279987@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] bd4fcf: [WGSL] TypeChecker assumes textureGather always ha...

2024-06-11 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bd4fcfb2d57558640b148303df4e0eee2839a090
  
https://github.com/WebKit/WebKit/commit/bd4fcfb2d57558640b148303df4e0eee2839a090
  Author: Tadeu Zagallo 
  Date:   2024-06-11 (Tue, 11 Jun 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WGSL/tests/invalid/overload.wgsl

  Log Message:
  ---
  [WGSL] TypeChecker assumes textureGather always has arguments
https://bugs.webkit.org/show_bug.cgi?id=275320
rdar://129227317

Reviewed by Mike Wyrzykowski.

While a valid call to textureGather must always have arguments, we were not 
checking
if the call was valid before accessing the arguments.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/tests/invalid/overload.wgsl:

Canonical link: https://commits.webkit.org/279906@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 1b56b0: [WGSL] All limits should be validated

2024-06-10 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1b56b013aed38c07fe25caae946a50493d748275
  
https://github.com/WebKit/WebKit/commit/1b56b013aed38c07fe25caae946a50493d748275
  Author: Tadeu Zagallo 
  Date:   2024-06-10 (Mon, 10 Jun 2024)

  Changed paths:
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Source/WebGPU/WGSL/Parser.cpp
M Source/WebGPU/WGSL/ParserPrivate.h
M Source/WebGPU/WGSL/TypeCheck.cpp
A Source/WebGPU/WGSL/tests/invalid/limits-brace-enclosed.wgsl
A Source/WebGPU/WGSL/tests/invalid/limits-composite-type.wgsl
A Source/WebGPU/WGSL/tests/invalid/limits-const-array.wgsl
A Source/WebGPU/WGSL/tests/invalid/limits-function-parameters.wgsl
A Source/WebGPU/WGSL/tests/invalid/limits-function-vars.wgsl
A Source/WebGPU/WGSL/tests/invalid/limits-private-vars.wgsl
A Source/WebGPU/WGSL/tests/invalid/limits-struct-members.wgsl
A Source/WebGPU/WGSL/tests/invalid/limits-switch-case.wgsl
A Source/WebGPU/WGSL/tests/invalid/limits-workgroup-vars.wgsl
R Source/WebGPU/WGSL/tests/invalid/struct-parse.wgsl
M Source/WebGPU/WGSL/tests/valid/type-promotion.wgsl

  Log Message:
  ---
  [WGSL] All limits should be validated
https://bugs.webkit.org/show_bug.cgi?id=275267
rdar://128923553

Reviewed by Mike Wyrzykowski.

Add validation for all the limits defined in the WGSL spec[1].

[1]: https://www.w3.org/TR/WGSL/#limits

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::visit):
(WGSL::RewriteGlobalVariables::visitEntryPoint):
(WGSL::RewriteGlobalVariables::determineUsedGlobals):
* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser::parseStructure):
(WGSL::Parser::parseTypeName):
(WGSL::Parser::parseFunction):
(WGSL::Parser::parseSwitchStatement):
* Source/WebGPU/WGSL/ParserPrivate.h:
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/tests/invalid/limits-brace-enclosed.wgsl: Added.
* Source/WebGPU/WGSL/tests/invalid/limits-composite-type.wgsl: Added.
* Source/WebGPU/WGSL/tests/invalid/limits-const-array.wgsl: Added.
* Source/WebGPU/WGSL/tests/invalid/limits-function-parameters.wgsl: Added.
* Source/WebGPU/WGSL/tests/invalid/limits-function-vars.wgsl: Added.
* Source/WebGPU/WGSL/tests/invalid/limits-private-vars.wgsl: Added.
* Source/WebGPU/WGSL/tests/invalid/limits-struct-members.wgsl: Renamed from 
Source/WebGPU/WGSL/tests/invalid/struct-parse.wgsl.
* Source/WebGPU/WGSL/tests/invalid/limits-switch-case.wgsl: Added.
* Source/WebGPU/WGSL/tests/invalid/limits-workgroup-vars.wgsl: Added.
* Source/WebGPU/WGSL/tests/valid/type-promotion.wgsl:

Canonical link: https://commits.webkit.org/279876@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 298627: [WGSL] Struct size rounding overflows

2024-06-07 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2986275957ba7c73b1699e2059540a6c4b2b9126
  
https://github.com/WebKit/WebKit/commit/2986275957ba7c73b1699e2059540a6c4b2b9126
  Author: Tadeu Zagallo 
  Date:   2024-06-07 (Fri, 07 Jun 2024)

  Changed paths:
M Source/WebGPU/WGSL/AttributeValidator.cpp
M Source/WebGPU/WGSL/tests/valid/struct.wgsl

  Log Message:
  ---
  [WGSL] Struct size rounding overflows
https://bugs.webkit.org/show_bug.cgi?id=275180
rdar://129227421

Reviewed by Mike Wyrzykowski.

We were checking for overflow of the struct size, but missed the check for 
overflow
when rounding up the total size to the alignment.

* Source/WebGPU/WGSL/AttributeValidator.cpp:
(WGSL::AttributeValidator::visit):
* Source/WebGPU/WGSL/tests/valid/struct.wgsl:

Canonical link: https://commits.webkit.org/279809@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 8c16f8: [WGSL] Cannot access fields of PackedVec3

2024-06-07 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8c16f89f981dd428c469acdcadca90666bf0e67f
  
https://github.com/WebKit/WebKit/commit/8c16f89f981dd428c469acdcadca90666bf0e67f
  Author: Tadeu Zagallo 
  Date:   2024-06-07 (Fri, 07 Jun 2024)

  Changed paths:
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
M Source/WebGPU/WGSL/WGSL.cpp
A Source/WebGPU/WGSL/tests/valid/array-vec3.wgsl

  Log Message:
  ---
  [WGSL] Cannot access fields of PackedVec3
https://bugs.webkit.org/show_bug.cgi?id=275175
rdar://129052933

Reviewed by Mike Wyrzykowski.

The current implementation of PackedVec3 wraps a packed_vec, but it 
doesn't
provide any means to access the components of the vector. Change it so it 
matches
the vec/packed_vec interface by having x/y/z members and implementing a 
subscript
operator.

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::getPacking):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::emitNecessaryHelpers):
* Source/WebGPU/WGSL/WGSL.cpp:
(WGSL::prepareImpl):

Canonical link: https://commits.webkit.org/279808@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 29d113: [WGSL] shader, execution, expression, unary, address_o...

2024-05-28 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 29d113f326172fe15e5e79df5f4e600c52b418c9
  
https://github.com/WebKit/WebKit/commit/29d113f326172fe15e5e79df5f4e600c52b418c9
  Author: Tadeu Zagallo 
  Date:   2024-05-28 (Tue, 28 May 2024)

  Changed paths:
A 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/unary/address_of_and_indirection-expected.txt
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] shader,execution,expression,unary,address_of_and_indirection:* is 
failing
https://bugs.webkit.org/show_bug.cgi?id=274754
rdar://128792671

Reviewed by Mike Wyrzykowski.

There were two issues:
- we weren't setting CallExpression::m_isConstructor for calls to struct and 
array
  constructors.
- we were not handling the case for index access on pointers in the code 
generator.
  i.e. `x[i]` needs to emit `(*x)[i]` when `x` is a pointer.

* 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/unary/address_of_and_indirection-expected.txt:
 Added.
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):

Canonical link: https://commits.webkit.org/279399@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 8f05ce: [WGSL] textureGather is missing validation

2024-05-27 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8f05ced05e3ddafe3629b900b6c001fc658eb3ff
  
https://github.com/WebKit/WebKit/commit/8f05ced05e3ddafe3629b900b6c001fc658eb3ff
  Author: Tadeu Zagallo 
  Date:   2024-05-27 (Mon, 27 May 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp
A Source/WebGPU/WGSL/tests/invalid/texture-gather.wgsl

  Log Message:
  ---
  [WGSL] textureGather is missing validation
https://bugs.webkit.org/show_bug.cgi?id=274668
rdar://128664891

Reviewed by Mike Wyrzykowski.

We were missing the validation that when the first argument to `textureGather`
is the integer "component" argument, it must be a constant value between 0 and 
3.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/tests/invalid/texture-gather.wgsl: Added.

Canonical link: https://commits.webkit.org/279345@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] be5f6e: [WGSL] shader, execution, expression, call, builtin, wo...

2024-05-27 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: be5f6ee9c8bcc433a04a56e60d982dd3d2948a8f
  
https://github.com/WebKit/WebKit/commit/be5f6ee9c8bcc433a04a56e60d982dd3d2948a8f
  Author: Tadeu Zagallo 
  Date:   2024-05-27 (Mon, 27 May 2024)

  Changed paths:
A 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/call/builtin/workgroupUniformLoad-expected.txt
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
M Source/WebGPU/WGSL/TypeDeclarations.rb

  Log Message:
  ---
  [WGSL] shader,execution,expression,call,builtin,workgroupUniformLoad:* is 
failing
https://bugs.webkit.org/show_bug.cgi?id=274666
rdar://128691118

Reviewed by Mike Wyrzykowski.

There was a typo in the type declaration and a bug ni the metal code generator 
that
emitted a type constructor even when the resolved overload wasn't one.

* 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/call/builtin/workgroupUniformLoad-expected.txt:
 Added.
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/TypeDeclarations.rb:

Canonical link: https://commits.webkit.org/279344@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 2d30b5: [WGSL] Type::size can still overflow

2024-05-27 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2d30b56d45745db5beeae7129a46e6c1fb39e7a0
  
https://github.com/WebKit/WebKit/commit/2d30b56d45745db5beeae7129a46e6c1fb39e7a0
  Author: Tadeu Zagallo 
  Date:   2024-05-27 (Mon, 27 May 2024)

  Changed paths:
A LayoutTests/fast/webgpu/fuzz-128677742-expected.txt
A LayoutTests/fast/webgpu/fuzz-128677742.html
M Source/WebGPU/WGSL/Types.cpp

  Log Message:
  ---
  [WGSL] Type::size can still overflow
https://bugs.webkit.org/show_bug.cgi?id=274669
rdar://128677742

Reviewed by Mike Wyrzykowski.

In 279204@main I added checks for overflow in Type::size, but I missed the case 
where
`array.element->size()` returns uint_max, and rounding it up to the alignment 
returns 0.

* LayoutTests/fast/webgpu/fuzz-128677742-expected.txt: Added.
* LayoutTests/fast/webgpu/fuzz-128677742.html: Added.
* Source/WebGPU/WGSL/Types.cpp:
(WGSL::Type::size const):

Canonical link: https://commits.webkit.org/279343@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] a34fd9: [WGSL] shader, execution, expression, constructor, non...

2024-05-27 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a34fd9fade1fc5f2de8097a8418ca66be3a57501
  
https://github.com/WebKit/WebKit/commit/a34fd9fade1fc5f2de8097a8418ca66be3a57501
  Author: Tadeu Zagallo 
  Date:   2024-05-27 (Mon, 27 May 2024)

  Changed paths:
A 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/constructor/non_zero-expected.txt
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp

  Log Message:
  ---
  [WGSL] shader,execution,expression,constructor,non_zero:* is still failing
https://bugs.webkit.org/show_bug.cgi?id=274600
rdar://128624933

Reviewed by Mike Wyrzykowski.

I fixed the tests in 278991@main, but didn't update the expectations as it 
required
updating the CTS tests first, and the tests got broken before I could update it.
The fix was fairly simple, we just weren't generating the PackedVec3 struct for 
a
couple tests that needed it, which was fixed by changing where we detect that we
need to generate the struct.

* 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/constructor/non_zero-expected.txt:
 Added.
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::pack):
(WGSL::RewriteGlobalVariables::packArrayResource):
(WGSL::RewriteGlobalVariables::packArrayType):

Canonical link: https://commits.webkit.org/279342@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 5a74a8: [WebGPU] Update CTS tests

2024-05-24 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5a74a872dbcfe8327e88a571cd6713785ce439c9
  
https://github.com/WebKit/WebKit/commit/5a74a872dbcfe8327e88a571cd6713785ce439c9
  Author: Tadeu Zagallo 
  Date:   2024-05-24 (Fri, 24 May 2024)

  Changed paths:
M LayoutTests/http/tests/webgpu/common/framework/metadata.js
M LayoutTests/http/tests/webgpu/common/internal/version.js
M LayoutTests/http/tests/webgpu/common/runtime/helper/test_worker.js
M LayoutTests/http/tests/webgpu/common/util/navigator_gpu.js
M LayoutTests/http/tests/webgpu/common/util/util.js
M LayoutTests/http/tests/webgpu/cts-chunked2sec.https.html
M LayoutTests/http/tests/webgpu/cts.https.html
M LayoutTests/http/tests/webgpu/resources/cache/hashes.json
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/binary/af_addition.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/binary/af_matrix_addition.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/binary/af_matrix_subtraction.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/binary/af_multiplication.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/binary/af_subtraction.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/bitcast.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/fract.bin
A 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/fwidth.bin
M 
LayoutTests/http/tests/webgpu/webgpu/api/operation/memory_sync/texture/readonly_depth_stencil.spec.js
M 
LayoutTests/http/tests/webgpu/webgpu/api/operation/render_pass/storeop2.spec.js
M 
LayoutTests/http/tests/webgpu/webgpu/api/operation/render_pipeline/overrides.spec.js
M 
LayoutTests/http/tests/webgpu/webgpu/api/operation/render_pipeline/pipeline_output_targets.spec.js
M LayoutTests/http/tests/webgpu/webgpu/api/operation/rendering/basic.spec.js
M LayoutTests/http/tests/webgpu/webgpu/api/operation/rendering/depth.spec.js
M 
LayoutTests/http/tests/webgpu/webgpu/api/operation/rendering/depth_bias.spec.js
M 
LayoutTests/http/tests/webgpu/webgpu/api/operation/rendering/stencil.spec.js
M 
LayoutTests/http/tests/webgpu/webgpu/api/operation/resource_init/check_texture/by_ds_test.js
M 
LayoutTests/http/tests/webgpu/webgpu/api/operation/resource_init/check_texture/texture_zero_init_test.js
M 
LayoutTests/http/tests/webgpu/webgpu/api/operation/sampling/anisotropy.spec.js
M 
LayoutTests/http/tests/webgpu/webgpu/api/validation/capability_checks/limits/maxInterStageShaderComponents.spec.js
M 
LayoutTests/http/tests/webgpu/webgpu/api/validation/queue/submit-expected.txt
M LayoutTests/http/tests/webgpu/webgpu/api/validation/queue/submit.spec.js
M 
LayoutTests/http/tests/webgpu/webgpu/api/validation/render_pipeline/inter_stage.spec.js
M 
LayoutTests/http/tests/webgpu/webgpu/api/validation/resource_usages/texture/in_pass_encoder.spec.js
M LayoutTests/http/tests/webgpu/webgpu/api/validation/validation_test.js
M LayoutTests/http/tests/webgpu/webgpu/capability_info.js
M LayoutTests/http/tests/webgpu/webgpu/listing.js
M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/access/array/index.spec.js
M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/access/structure/index.spec.js
M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/binary/af_data.js
M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/binary/af_matrix_scalar_multiplication.cache.js
M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/binary/af_matrix_subtraction.cache.js
M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/binary/af_multiplication.cache.js
M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/binary/af_subtraction.cache.js
M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/binary/bitwise_shift.spec.js
M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/call/builtin/atomics/atomicSub.spec.js
M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/call/builtin/fract.cache.js
A 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/call/builtin/fwidth.cache.js
A 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/call/builtin/fwidth.js
M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/call/builtin/fwidth.spec.js
M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/call/builtin/fwidthCoarse.spec.js
M 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/call/builtin/fwidthFine.spec.js
M 
LayoutTests/http/tests/webgpu

[webkit-changes] [WebKit/WebKit] 083dc3: [WGSL] Function parameters have incorrect scope

2024-05-24 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 083dc3ea78f47e88b2e48f4253e9f8248fdf95e9
  
https://github.com/WebKit/WebKit/commit/083dc3ea78f47e88b2e48f4253e9f8248fdf95e9
  Author: Tadeu Zagallo 
  Date:   2024-05-24 (Fri, 24 May 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp
A Source/WebGPU/WGSL/tests/invalid/shadowing.wgsl

  Log Message:
  ---
  [WGSL] Function parameters have incorrect scope
https://bugs.webkit.org/show_bug.cgi?id=274602
rdar://128625182

Reviewed by Mike Wyrzykowski.

The parameters were being placed in a separate scope from the function local 
variables,
allowing a local variable to shadow a parameter, which shouldn't be valid 
according to
the spec.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/tests/invalid/shadowing.wgsl: Added.

Canonical link: https://commits.webkit.org/279262@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 666a7c: [WGSL] Struct arguments to entry points are clashing

2024-05-24 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 666a7c0243c3384322183eee16c53ef44d7aa0a3
  
https://github.com/WebKit/WebKit/commit/666a7c0243c3384322183eee16c53ef44d7aa0a3
  Author: Tadeu Zagallo 
  Date:   2024-05-24 (Fri, 24 May 2024)

  Changed paths:
M Source/WebGPU/WGSL/MangleNames.cpp
M Source/WebGPU/WGSL/tests/valid/packing.wgsl
M Source/WebGPU/WGSL/tests/valid/struct.wgsl

  Log Message:
  ---
  [WGSL] Struct arguments to entry points are clashing
https://bugs.webkit.org/show_bug.cgi?id=274603
rdar://128625590

Reviewed by Mike Wyrzykowski.

Struct parameters of entry point functions get merged into a single struct or
hoisted into a top-level parameter if it's a builtin. However, when we rename
all variables we also rename all struct fields as `field0...fieldN` for every
struct, so when the fields got merged into a single struct (or hoisted) they
collided. In order to fix this we just make every field unique by never 
resetting
the field counter.

* Source/WebGPU/WGSL/MangleNames.cpp:
(WGSL::NameManglerVisitor::visit):
* Source/WebGPU/WGSL/tests/valid/packing.wgsl:
* Source/WebGPU/WGSL/tests/valid/struct.wgsl:

Canonical link: https://commits.webkit.org/279261@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 543bc8: [WGSL] Type::size can overflow

2024-05-23 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 543bc8506d61350573b54b6bdd0667e0322d2dfc
  
https://github.com/WebKit/WebKit/commit/543bc8506d61350573b54b6bdd0667e0322d2dfc
  Author: Tadeu Zagallo 
  Date:   2024-05-23 (Thu, 23 May 2024)

  Changed paths:
A LayoutTests/fast/webgpu/fuzz-128381161-expected.txt
A LayoutTests/fast/webgpu/fuzz-128381161.html
M Source/WebGPU/WGSL/AttributeValidator.cpp
M Source/WebGPU/WGSL/Parser.cpp
M Source/WebGPU/WGSL/Types.cpp
A Source/WebGPU/WGSL/tests/invalid/struct-parse.wgsl

  Log Message:
  ---
  [WGSL] Type::size can overflow
https://bugs.webkit.org/show_bug.cgi?id=274395
rdar://128381161

Reviewed by Mike Wyrzykowski.

We use 32-bit values to represent the byte size of types, and that can overflow 
when
computing the size of structs or arrays. That is not a problem in practice, as 
the
size of buffers is limited by the API, so we just clamp the numbers to uint_max.

* LayoutTests/fast/webgpu/fuzz-128381161-expected.txt: Added.
* LayoutTests/fast/webgpu/fuzz-128381161.html: Added.
* Source/WebGPU/WGSL/AttributeValidator.cpp:
(WGSL::AttributeValidator::visit):
* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser::parseStructure):
* Source/WebGPU/WGSL/Types.cpp:
(WGSL::Type::size const):
* Source/WebGPU/WGSL/tests/invalid/struct-parse.wgsl: Added.

Canonical link: https://commits.webkit.org/279204@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 8cb609: [WGSL] Fix failing wgslc tests

2024-05-22 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8cb609477c197cfc25fd66fab6f51b7017c7e8dd
  
https://github.com/WebKit/WebKit/commit/8cb609477c197cfc25fd66fab6f51b7017c7e8dd
  Author: Tadeu Zagallo 
  Date:   2024-05-22 (Wed, 22 May 2024)

  Changed paths:
M Source/WebGPU/WGSL/AST/ASTForward.h
M Source/WebGPU/WGSL/AST/ASTParameter.h
M Source/WebGPU/WGSL/AST/ASTVariable.h
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
M Source/WebGPU/WGSL/WGSLShaderModule.h
M Source/WebGPU/WGSL/tests/valid/packing.wgsl

  Log Message:
  ---
  [WGSL] Fix failing wgslc tests
https://bugs.webkit.org/show_bug.cgi?id=274479
rdar://128485179

Reviewed by Mike Wyrzykowski.

There were 2 issues after 278991@main:
- we emitted definitions for `__unpack(PackedVec3)` even when we didn't emit
  the PackedVec3 struct
- in a previous patch we tried skipping some explicit pack/unpack calls for
  vec3/packed_vec3, but that doesn't work for PackedVec3, so we can no longer
  skip these calls.

* Source/WebGPU/WGSL/AST/ASTForward.h:
* Source/WebGPU/WGSL/AST/ASTParameter.h:
* Source/WebGPU/WGSL/AST/ASTVariable.h:
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::visitCallee):
(WGSL::RewriteGlobalVariables::visit):
(WGSL::RewriteGlobalVariables::pack):
(WGSL::RewriteGlobalVariables::packStructResource):
(WGSL::RewriteGlobalVariables::packArrayResource):
(WGSL::RewriteGlobalVariables::insertMaterializations):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::emitNecessaryHelpers):
(WGSL::Metal::FunctionDefinitionWriter::visit):
(WGSL::Metal::FunctionDefinitionWriter::shouldPackType const):
(WGSL::Metal::FunctionDefinitionWriter::emitPackedVector):
(WGSL::Metal::FunctionDefinitionWriter::serializeVariable):
* Source/WebGPU/WGSL/WGSLShaderModule.h:
(WGSL::ShaderModule::usesPackVector const):
(WGSL::ShaderModule::setUsesPackVector):
(WGSL::ShaderModule::clearUsesPackVector):
(WGSL::ShaderModule::usesUnpackVector const):
(WGSL::ShaderModule::setUsesUnpackVector):
(WGSL::ShaderModule::clearUsesUnpackVector):
* Source/WebGPU/WGSL/tests/valid/packing.wgsl:

Canonical link: https://commits.webkit.org/279141@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 7db834: [WGSL] Type checker does not handle shadowing of o...

2024-05-21 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7db8345cbe6b5da4ca87617e866b1f6bac6f4a65
  
https://github.com/WebKit/WebKit/commit/7db8345cbe6b5da4ca87617e866b1f6bac6f4a65
  Author: Tadeu Zagallo 
  Date:   2024-05-21 (Tue, 21 May 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WGSL/tests/invalid/function-call.wgsl

  Log Message:
  ---
  [WGSL] Type checker does not handle shadowing of overloaded built-ins 
correctly
https://bugs.webkit.org/show_bug.cgi?id=274391
rdar://128202008

Reviewed by Mike Wyrzykowski.

The type checker incorrectly looked up the built-in definition even there was 
another
definition shadowing it.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/tests/invalid/function-call.wgsl:

Canonical link: https://commits.webkit.org/279053@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 73ee00: [WGSL] shader, execution, expression, constructor, non...

2024-05-20 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 73ee00997bdce2a202aa8b37044355eb2b9075e6
  
https://github.com/WebKit/WebKit/commit/73ee00997bdce2a202aa8b37044355eb2b9075e6
  Author: Tadeu Zagallo 
  Date:   2024-05-20 (Mon, 20 May 2024)

  Changed paths:
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
M Source/WebGPU/WGSL/Types.cpp
M Source/WebGPU/WGSL/Types.h
M Source/WebGPU/WGSL/WGSLShaderModule.h

  Log Message:
  ---
  [WGSL] shader,execution,expression,constructor,non_zero:* is failing
https://bugs.webkit.org/show_bug.cgi?id=274319
rdar://128283127

Reviewed by Mike Wyrzykowski.

There were 2 issues:
- A metal compilation failure when assigning an array of packed vectors to an
  array of unpacked vectors
- array> needs to be converted to array, where S is a struct with the
  packed vec3 and explicit padding

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::pack):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::emitNecessaryHelpers):
(WGSL::Metal::FunctionDefinitionWriter::generatePackingHelpers):
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/Types.cpp:
(WGSL::Type::packing const):
* Source/WebGPU/WGSL/Types.h:
* Source/WebGPU/WGSL/WGSLShaderModule.h:
(WGSL::ShaderModule::usesPackedVec3 const):
(WGSL::ShaderModule::setUsesPackedVec3):
(WGSL::ShaderModule::clearUsesPackedVec3):

Canonical link: https://commits.webkit.org/278991@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 47944f: [WGSL] Add type checking for compound assignment

2024-05-16 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 47944ff1d4a0313a1e1581a58e11b1a3a067735c
  
https://github.com/WebKit/WebKit/commit/47944ff1d4a0313a1e1581a58e11b1a3a067735c
  Author: Tadeu Zagallo 
  Date:   2024-05-15 (Wed, 15 May 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp
A Source/WebGPU/WGSL/tests/invalid/compound-assignment.wgsl
M Source/WebGPU/WGSL/tests/valid/fuzz-127229681.wgsl
M Source/WebGPU/WGSL/tests/valid/pack-unpack.wgsl

  Log Message:
  ---
  [WGSL] Add type checking for compound assignment
https://bugs.webkit.org/show_bug.cgi?id=274212
rdar://128064852

Reviewed by Mike Wyrzykowski.

Resolve a long standing fixme and add type checking for the compound assignments
by sharing the code with binary expressions.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::binaryExpression):
(WGSL::TypeChecker::chooseOverload):
* Source/WebGPU/WGSL/tests/invalid/compound-assignment.wgsl: Added.
* Source/WebGPU/WGSL/tests/valid/fuzz-127229681.wgsl:
* Source/WebGPU/WGSL/tests/valid/pack-unpack.wgsl:

Canonical link: https://commits.webkit.org/278848@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 6dae8e: [WGSL] Constant size for array types should be con...

2024-05-14 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6dae8e21c19fb04f9e21abdabce268a95f543508
  
https://github.com/WebKit/WebKit/commit/6dae8e21c19fb04f9e21abdabce268a95f543508
  Author: Tadeu Zagallo 
  Date:   2024-05-14 (Tue, 14 May 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WGSL/tests/invalid/array.wgsl

  Log Message:
  ---
  [WGSL] Constant size for array types should be concretized
https://bugs.webkit.org/show_bug.cgi?id=274149
rdar://127986684

Reviewed by Mike Wyrzykowski.

The size of an array type has to be a concrete integer, but we were using the
constant value without concretizing, so 64-bit integers were allowed.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/tests/invalid/array.wgsl:

Canonical link: https://commits.webkit.org/278761@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 1d59f8: [WebGPU] https://philogb.github.io/page/indraspear...

2024-05-13 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1d59f80ecec0eced8582a067dcb2d25b80e25f59
  
https://github.com/WebKit/WebKit/commit/1d59f80ecec0eced8582a067dcb2d25b80e25f59
  Author: Tadeu Zagallo 
  Date:   2024-05-13 (Mon, 13 May 2024)

  Changed paths:
M Source/WebGPU/WGSL/AST/ASTCompoundStatement.h
M Source/WebGPU/WGSL/AttributeValidator.cpp
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Source/WebGPU/WGSL/Parser.cpp
M Source/WebGPU/WGSL/tests/valid/for.wgsl

  Log Message:
  ---
  [WebGPU] https://philogb.github.io/page/indraspearls/ fails to compile shader
https://bugs.webkit.org/show_bug.cgi?id=273070
rdar://126865140

Reviewed by Mike Wyrzykowski.

Add support for attributes before compound statements.

* Source/WebGPU/WGSL/AST/ASTCompoundStatement.h:
* Source/WebGPU/WGSL/AttributeValidator.cpp:
(WGSL::AttributeValidator::visit):
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::initializeVariables):
(WGSL::RewriteGlobalVariables::storeInitialValue):
* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser::parseAttribute):
(WGSL::Parser::parseCompoundStatement):
* Source/WebGPU/WGSL/tests/valid/for.wgsl:

Canonical link: https://commits.webkit.org/278682@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 2e8bbb: ASSERTION FAILED: !behaviors.containsAny({ Behavio...

2024-05-13 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2e8bbb15e393fc31460e751d5986cf47a12e00a6
  
https://github.com/WebKit/WebKit/commit/2e8bbb15e393fc31460e751d5986cf47a12e00a6
  Author: Tadeu Zagallo 
  Date:   2024-05-13 (Mon, 13 May 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp
A Source/WebGPU/WGSL/tests/invalid/break.wgsl

  Log Message:
  ---
  ASSERTION FAILED: !behaviors.containsAny({ Behavior::Break, 
Behavior::Continue })
https://bugs.webkit.org/show_bug.cgi?id=273411
rdar://127310621

Reviewed by Mike Wyrzykowski.

While it's invalid for a function to have break or continue behaviors, that's a 
type
error, not an assertion.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/tests/invalid/break.wgsl: Added.

Canonical link: https://commits.webkit.org/278681@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] a2a16a: [WGSL] Pointers should not be unpacked

2024-05-10 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a2a16a65166393cc268b7fbafb8f48082ac1984f
  
https://github.com/WebKit/WebKit/commit/a2a16a65166393cc268b7fbafb8f48082ac1984f
  Author: Tadeu Zagallo 
  Date:   2024-05-10 (Fri, 10 May 2024)

  Changed paths:
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
A Source/WebGPU/WGSL/tests/valid/fuzz-127229681.wgsl

  Log Message:
  ---
  [WGSL] Pointers should not be unpacked
https://bugs.webkit.org/show_bug.cgi?id=273894
rdar://127229681

Reviewed by Mike Wyrzykowski.

The fuzzer found a crash due to the base of an index access being incorrectly
unpacked when it was an address-of expression. We would always unpack unary
expressions, since math operations should be performed on unpacked values, but
for pointer operators (address-of and dereference) we do not need to force the
operand to be unpacked.

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::visit):
(WGSL::RewriteGlobalVariables::getPacking):
* Source/WebGPU/WGSL/tests/valid/fuzz-127229681.wgsl: Added.

Canonical link: https://commits.webkit.org/278613@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 87a9d5: ASSERTION FAILED: !m_inferredType in WebGPU/WGSL/T...

2024-05-08 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 87a9d5d76bc2669035ff6353ba58c6d1951b1160
  
https://github.com/WebKit/WebKit/commit/87a9d5d76bc2669035ff6353ba58c6d1951b1160
  Author: Tadeu Zagallo 
  Date:   2024-05-08 (Wed, 08 May 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp
A Source/WebGPU/WGSL/tests/invalid/if.wgsl

  Log Message:
  ---
  ASSERTION FAILED: !m_inferredType in WebGPU/WGSL/TypeCheck.cpp(1978)
https://bugs.webkit.org/show_bug.cgi?id=273407
rdar://127605450

Reviewed by Mike Wyrzykowski.

When reporting a type error for the test condition of an if statement we should
not infer bottom.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/tests/invalid/if.wgsl: Added.

Canonical link: https://commits.webkit.org/278504@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] a32d21: [WGSL] AttributeValidator derefs a nullptr return ...

2024-05-08 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a32d219bdf05c2f2eb7bff03c13781fa31e83eaa
  
https://github.com/WebKit/WebKit/commit/a32d219bdf05c2f2eb7bff03c13781fa31e83eaa
  Author: Tadeu Zagallo 
  Date:   2024-05-08 (Wed, 08 May 2024)

  Changed paths:
M Source/WebGPU/WGSL/AttributeValidator.cpp

  Log Message:
  ---
  [WGSL] AttributeValidator derefs a nullptr return type
https://bugs.webkit.org/show_bug.cgi?id=273837
rdar://127182544

Reviewed by Mike Wyrzykowski.

The UB sanitizer caught that we unconditionally deref the function's return
type in the AttributeValidator. The fix is to simply guard it by checking if
the function actually has a return type.

* Source/WebGPU/WGSL/AttributeValidator.cpp:
(WGSL::AttributeValidator::visit):

Canonical link: https://commits.webkit.org/278503@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] ae36ff: [WebGPU] Validate buffer length for bind group ent...

2024-04-26 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ae36fffb790d1c33f548681ce46b41c007850418
  
https://github.com/WebKit/WebKit/commit/ae36fffb790d1c33f548681ce46b41c007850418
  Author: Tadeu Zagallo 
  Date:   2024-04-26 (Fri, 26 Apr 2024)

  Changed paths:
A LayoutTests/fast/webgpu/fuzz-126848520-auto-layout-expected.txt
A LayoutTests/fast/webgpu/fuzz-126848520-auto-layout.html
A LayoutTests/fast/webgpu/fuzz-126848520-explicit-layout-expected.txt
A LayoutTests/fast/webgpu/fuzz-126848520-explicit-layout.html
M Source/WebCore/Modules/WebGPU/Implementation/WebGPUDeviceImpl.cpp
M Source/WebGPU/WGSL/EntryPointRewriter.cpp
M Source/WebGPU/WGSL/EntryPointRewriter.h
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Source/WebGPU/WGSL/GlobalVariableRewriter.h
M Source/WebGPU/WGSL/WGSL.cpp
M Source/WebGPU/WGSL/WGSL.h
M Source/WebGPU/WGSL/wgslc.cpp
M Source/WebGPU/WebGPU/BindGroupLayout.mm
M Source/WebGPU/WebGPU/ComputePassEncoder.mm
M Source/WebGPU/WebGPU/Pipeline.h
M Source/WebGPU/WebGPU/Pipeline.mm
M Source/WebGPU/WebGPU/RenderPassEncoder.mm
M Source/WebGPU/WebGPU/RenderPipeline.mm
M Source/WebGPU/WebGPU/ShaderModule.mm
M Source/WebGPU/WebGPU/WebGPU.h

  Log Message:
  ---
  [WebGPU] Validate buffer length for bind group entries
https://bugs.webkit.org/show_bug.cgi?id=273151
rdar://126848520

Reviewed by Mike Wyrzykowski.

We were missing a validation that the size of the buffer passed into a bind 
group
was big enough to fit the type of that entry. Most of the plumbing was already 
done,
but we never populated the `minBindingSize` in the compiler info. That works 
out of
the box for auto layouts, but for user-provided layouts we need to update the 
entries
with the computed size, and this later needs to be checked from draw/dispatch.

* LayoutTests/fast/webgpu/fuzz-126848520-auto-layout-expected.txt: Added.
* LayoutTests/fast/webgpu/fuzz-126848520-auto-layout.html: Added.
* LayoutTests/fast/webgpu/fuzz-126848520-explicit-layout-expected.txt: Added.
* LayoutTests/fast/webgpu/fuzz-126848520-explicit-layout.html: Added.
* Source/WebGPU/WGSL/EntryPointRewriter.cpp:
(WGSL::rewriteEntryPoints):
* Source/WebGPU/WGSL/EntryPointRewriter.h:
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::RewriteGlobalVariables):
(WGSL::RewriteGlobalVariables::visitEntryPoint):
(WGSL::bindingMemberForGlobal):
(WGSL::RewriteGlobalVariables::insertStructs):
(WGSL::rewriteGlobalVariables):
* Source/WebGPU/WGSL/GlobalVariableRewriter.h:
* Source/WebGPU/WGSL/WGSL.cpp:
(WGSL::prepareImpl):
(WGSL::prepare):
* Source/WebGPU/WGSL/WGSL.h:
* Source/WebGPU/WGSL/wgslc.cpp:
(runWGSL):
* Source/WebGPU/WebGPU/BindGroupLayout.mm:
(WebGPU::createArgumentDescriptor):
* Source/WebGPU/WebGPU/ComputePassEncoder.mm:
(WebGPU::ComputePassEncoder::executePreDispatchCommands):
* Source/WebGPU/WebGPU/Pipeline.h:
* Source/WebGPU/WebGPU/Pipeline.mm:
(WebGPU::createLibrary):
(WebGPU::validateBindGroup):
* Source/WebGPU/WebGPU/RenderPassEncoder.mm:
(WebGPU::RenderPassEncoder::executePreDrawCommands):
* Source/WebGPU/WebGPU/RenderPipeline.mm:
* Source/WebGPU/WebGPU/ShaderModule.mm:
(WebGPU::earlyCompileShaderModule):

Canonical link: https://commits.webkit.org/278052@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] f3b5e7: [WebGPU] RenderPassEncoder should use WeakPtr in m...

2024-04-25 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f3b5e76d12f5e8c9eb8dbfea08f91f741290f856
  
https://github.com/WebKit/WebKit/commit/f3b5e76d12f5e8c9eb8dbfea08f91f741290f856
  Author: Tadeu Zagallo 
  Date:   2024-04-25 (Thu, 25 Apr 2024)

  Changed paths:
M LayoutTests/TestExpectations
A LayoutTests/fast/webgpu/fuzz-126711484-expected.txt
A LayoutTests/fast/webgpu/fuzz-126711484.html
M Source/WebGPU/WebGPU/RenderBundle.h
M Source/WebGPU/WebGPU/RenderBundle.mm
M Source/WebGPU/WebGPU/RenderPassEncoder.mm

  Log Message:
  ---
  [WebGPU] RenderPassEncoder should use WeakPtr in more places
https://bugs.webkit.org/show_bug.cgi?id=273077
rdar://126711484

Reviewed by Mike Wyrzykowski.

This is very similar to 277742@main, where the use of raw C++ pointers in the
descriptor can lead to UAF. In this case, we should also use the same WeakPtrs
created in the previous commit in `RenderBundle::validateRenderPass`.

* LayoutTests/fast/webgpu/fuzz-126711484-expected.txt: Added.
* LayoutTests/fast/webgpu/fuzz-126711484.html: Added.
* Source/WebGPU/WebGPU/RenderBundle.h:
* Source/WebGPU/WebGPU/RenderBundle.mm:
(WebGPU::RenderBundle::validateRenderPass const):
* Source/WebGPU/WebGPU/RenderPassEncoder.mm:
(WebGPU::RenderPassEncoder::executeBundles):

Canonical link: https://commits.webkit.org/277979@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] fa0ace: [WGSL] shader, execution, expression, call, user, ptr_p...

2024-04-23 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fa0acee7fc7f2c005d578f926b125508f24f5caa
  
https://github.com/WebKit/WebKit/commit/fa0acee7fc7f2c005d578f926b125508f24f5caa
  Author: Tadeu Zagallo 
  Date:   2024-04-23 (Tue, 23 Apr 2024)

  Changed paths:
A 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/call/user/ptr_params-expected.txt
M Source/WebGPU/WGSL/CallGraph.cpp
M Source/WebGPU/WGSL/CallGraph.h
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp

  Log Message:
  ---
  [WGSL] shader,execution,expression,call,user,ptr_params:* is failing
https://bugs.webkit.org/show_bug.cgi?id=273071
rdar://126865271

Reviewed by Mike Wyrzykowski.

The WGSL compiler rewrites calls to `arrayLength(ptr)` to use the length 
injected
via the API, which is basically done by replacing it `ptr_length`. This simple
approach worked originally since pointers to runtime-sized arrays couldn't be 
passed
to other functions, so we always knew syntactically which array we were 
requesting
the length for. However, the spec was updated to support pointers to variables 
in
the storage space in function parameters, which means that it's now possible to
read the array length of a function argument. This requires passing the the 
length
alongside the array through the call sites anywhere the array length is read.

* 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/call/user/ptr_params-expected.txt:
 Added.
* Source/WebGPU/WGSL/CallGraph.cpp:
(WGSL::CallGraphBuilder::visit):
* Source/WebGPU/WGSL/CallGraph.h:
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::visitCallee):
(WGSL::RewriteGlobalVariables::visit):
(WGSL::RewriteGlobalVariables::getPacking):
(WGSL::RewriteGlobalVariables::getBase):

Canonical link: https://commits.webkit.org/277867@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 990e1a: [WGSL] Attribute validator asserts on non-overrides

2024-04-18 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 990e1a76ed379729e2bf9eb827e029dcdf00a1d2
  
https://github.com/WebKit/WebKit/commit/990e1a76ed379729e2bf9eb827e029dcdf00a1d2
  Author: Tadeu Zagallo 
  Date:   2024-04-18 (Thu, 18 Apr 2024)

  Changed paths:
M Source/WebGPU/WGSL/AttributeValidator.cpp
M Source/WebGPU/WGSL/tests/invalid/attribute-validation.wgsl
M Source/WebGPU/WGSL/tests/invalid/division.wgsl

  Log Message:
  ---
  [WGSL] Attribute validator asserts on non-overrides
https://bugs.webkit.org/show_bug.cgi?id=272837
rdar://126621130

Reviewed by Mike Wyrzykowski.

In 277194@main I added an assertion that the store type of a variable with an 
@id
attribute must scalar, but that only holds if the variable is an override.

* Source/WebGPU/WGSL/AttributeValidator.cpp:
(WGSL::AttributeValidator::visit):
* Source/WebGPU/WGSL/tests/invalid/attribute-validation.wgsl:
* Source/WebGPU/WGSL/tests/invalid/division.wgsl:

Canonical link: https://commits.webkit.org/277666@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 2459e1: [WGSL] Field access should support pointers

2024-04-18 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2459e1442e9d4021cbbacdc9114a51136d7a7d57
  
https://github.com/WebKit/WebKit/commit/2459e1442e9d4021cbbacdc9114a51136d7a7d57
  Author: Tadeu Zagallo 
  Date:   2024-04-18 (Thu, 18 Apr 2024)

  Changed paths:
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Source/WebGPU/WGSL/MangleNames.cpp
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
M Source/WebGPU/WGSL/tests/valid/access-expression.wgsl

  Log Message:
  ---
  [WGSL] Field access should support pointers
https://bugs.webkit.org/show_bug.cgi?id=272838
rdar://126621076

Reviewed by Mike Wyrzykowski.

The WGSL spec was updated to support struct field access on pointers (e.g. 
().y),
and while the type checker was updated to support it, there were a couple other
changes necessary:
- the renamer/mangler did not correctly rename the field when accessing a 
pointer
- the global rewriter asserted that the base should be either a reference or a 
struct
- the code generator was not emitting the correct code (i.e. x->y instead of 
x.y)

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::getPacking):
* Source/WebGPU/WGSL/MangleNames.cpp:
(WGSL::NameManglerVisitor::visit):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/tests/valid/access-expression.wgsl:

Canonical link: https://commits.webkit.org/277665@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 79d5e4: [WebGPU] https://playcanvas.github.io/#/graphics/p...

2024-04-17 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 79d5e4f3dd8b2f5546a7b64ce23df08cd3e7d34c
  
https://github.com/WebKit/WebKit/commit/79d5e4f3dd8b2f5546a7b64ce23df08cd3e7d34c
  Author: Tadeu Zagallo 
  Date:   2024-04-17 (Wed, 17 Apr 2024)

  Changed paths:
A 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/parse/statement_behavior-expected.txt
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WebGPU] https://playcanvas.github.io/#/graphics/post-effects fails shader 
compilation
https://bugs.webkit.org/show_bug.cgi?id=272637
rdar://126425833

Reviewed by Mike Wyrzykowski.

The specific issue that affected the sampled in the bug report was that 
BreakStatement
was incorrectly returning `Next` instead of `Break` in the behavior analysis. 
However,
I also made sure that all of the behavior analysis CTS tests are now passing 
and updated
the expectations.

* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/parse/statement_behavior-expected.txt:
 Added.
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::analyze):
(WGSL::TypeChecker::analyzeStatements):

Canonical link: https://commits.webkit.org/277618@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] bffda8: [WebGPU] shader, execution, expression, binary, ai_ari...

2024-04-15 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bffda80ff3ade29d8e40f3615d3e5d4e9c549135
  
https://github.com/WebKit/WebKit/commit/bffda80ff3ade29d8e40f3615d3e5d4e9c549135
  Author: Tadeu Zagallo 
  Date:   2024-04-15 (Mon, 15 Apr 2024)

  Changed paths:
A 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/binary/ai_arithmetic-expected.txt
A 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/binary/ai_comparison-expected.txt
A 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/call/builtin/bitcast-expected.txt
A 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/unary/ai_arithmetic-expected.txt
A 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/unary/ai_assignment-expected.txt
A 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/unary/ai_complement-expected.txt
M Source/WebGPU/WGSL/ConstantFunctions.h
M Source/WebGPU/WGSL/Lexer.cpp
M Source/WebGPU/WGSL/Lexer.h
M Source/WebGPU/WGSL/Parser.cpp
M Source/WebGPU/WGSL/Token.h
M Tools/TestWebKitAPI/Tests/WGSL/LexerTests.cpp

  Log Message:
  ---
  [WebGPU] 
shader,execution,expression,binary,ai_arithmetic:addition_scalar_vector:* 
appears to hang
https://bugs.webkit.org/show_bug.cgi?id=272574
rdar://126331501

Reviewed by Mike Wyrzykowski.

There 2 bugs in this test:
- the constant shift left builtin incorrectly reported an overflow on abstract
  integers due to using a 32 bit value for the mask it uses to validate
- the lexer used a double to represent all literal values, which can not 
represent
  all 64-bit integers

All of the new abstract integer CTS tests are now passing. I also added the
expectations for the bitcast test which includes some cases for abstract 
integers.

* 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/binary/ai_arithmetic-expected.txt:
 Added.
* 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/binary/ai_comparison-expected.txt:
 Added.
* 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/call/builtin/bitcast-expected.txt:
 Added.
* 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/unary/ai_arithmetic-expected.txt:
 Added.
* 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/unary/ai_assignment-expected.txt:
 Added.
* 
LayoutTests/http/tests/webgpu/webgpu/shader/execution/expression/unary/ai_complement-expected.txt:
 Added.
* Source/WebGPU/WGSL/ConstantFunctions.h:
(WGSL::CONSTANT_FUNCTION):
* Source/WebGPU/WGSL/Lexer.cpp:
(WGSL::Lexer::lexNumber):
* Source/WebGPU/WGSL/Lexer.h:
(WGSL::Lexer::makeFloatToken):
(WGSL::Lexer::makeIntegerToken):
(WGSL::Lexer::makeLiteralToken): Deleted.
* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser::parsePrimaryExpression):
* Source/WebGPU/WGSL/Token.h:
(WGSL::Token::Token):
(WGSL::Token::operator=):
* Tools/TestWebKitAPI/Tests/WGSL/LexerTests.cpp:
(TestWGSLAPI::checkSingleIntegerLiteral):
(TestWGSLAPI::checkSingleFloatLiteral):
(TestWGSLAPI::checkNextTokenIsIntegerLiteral):
(TestWGSLAPI::checkNextTokenIsFloatLiteral):
(TestWGSLAPI::TEST(WGSLLexerTests, SingleTokens)):
(TestWGSLAPI::TEST(WGSLLexerTests, ComputeShader)):
(TestWGSLAPI::TEST(WGSLLexerTests, GraphicsShader)):
(TestWGSLAPI::TEST(WGSLLexerTests, TriangleVert)):
(TestWGSLAPI::checkSingleLiteral): Deleted.
(TestWGSLAPI::checkNextTokenIsLiteral): Deleted.

Canonical link: https://commits.webkit.org/277498@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 9c724a: [WebGPU] Update CTS tests

2024-04-15 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9c724a5a370ceefab8cfa944920c4f800d0a08c9
  
https://github.com/WebKit/WebKit/commit/9c724a5a370ceefab8cfa944920c4f800d0a08c9
  Author: Tadeu Zagallo 
  Date:   2024-04-15 (Mon, 15 Apr 2024)

  Changed paths:
M LayoutTests/http/tests/webgpu/common/framework/fixture.js
M LayoutTests/http/tests/webgpu/common/framework/test_config.js
M LayoutTests/http/tests/webgpu/common/internal/logging/log_message.js
M LayoutTests/http/tests/webgpu/common/internal/logging/logger.js
M LayoutTests/http/tests/webgpu/common/internal/logging/result.js
M 
LayoutTests/http/tests/webgpu/common/internal/logging/test_case_recorder.js
M LayoutTests/http/tests/webgpu/common/internal/query/query.js
M LayoutTests/http/tests/webgpu/common/internal/test_group.js
M LayoutTests/http/tests/webgpu/common/internal/version.js
M LayoutTests/http/tests/webgpu/common/internal/websocket_logger.js
M LayoutTests/http/tests/webgpu/common/runtime/helper/options.js
M LayoutTests/http/tests/webgpu/common/runtime/helper/test_worker-worker.js
M LayoutTests/http/tests/webgpu/common/runtime/helper/test_worker.js
M LayoutTests/http/tests/webgpu/common/runtime/helper/utils_worker.js
M LayoutTests/http/tests/webgpu/common/runtime/helper/wrap_for_worker.js
M LayoutTests/http/tests/webgpu/common/runtime/wpt.js
M LayoutTests/http/tests/webgpu/common/util/util.js
M LayoutTests/http/tests/webgpu/cts-chunked2sec.https.html
M LayoutTests/http/tests/webgpu/cts.https.html
M LayoutTests/http/tests/webgpu/external/petamoriken/float16/float16.d.js
M 
LayoutTests/http/tests/webgpu/external/petamoriken/float16/float16.d.js.map
M LayoutTests/http/tests/webgpu/external/petamoriken/float16/float16.js
M LayoutTests/http/tests/webgpu/external/petamoriken/float16/float16.js.map
M LayoutTests/http/tests/webgpu/resources/README.md
M LayoutTests/http/tests/webgpu/resources/cache/hashes.json
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/acos.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/acosh.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/asin.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/asinh.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/atan.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/atan2.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/atanh.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/binary/af_addition.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/binary/af_matrix_addition.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/binary/f16_division.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/bitcast.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/ceil.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/cos.bin
A 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/derivatives.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/distance.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/exp.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/exp2.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/floor.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/fract.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/frexp.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/inverseSqrt.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/ldexp.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/length.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/log.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/log2.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/normalize.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/pow.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/saturate.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/sin.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/sqrt.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/step.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/tan.bin
M 
LayoutTests/http/tests/webgpu/resources/cache/webgpu/shader/execution/tanh.bin
M 
LayoutTests/http/tests/webgpu/resources

[webkit-changes] [WebKit/WebKit] c482c9: [WGSL] shader, validation, shader_io, id:* is failing

2024-04-15 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c482c958a01575be223137f2235c82ce9884770a
  
https://github.com/WebKit/WebKit/commit/c482c958a01575be223137f2235c82ce9884770a
  Author: Tadeu Zagallo 
  Date:   2024-04-15 (Mon, 15 Apr 2024)

  Changed paths:
A 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/decl/override-expected.txt
A 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/shader_io/id-expected.txt
M Source/WebGPU/WGSL/AttributeValidator.cpp

  Log Message:
  ---
  [WGSL] shader,validation,shader_io,id:* is failing
https://bugs.webkit.org/show_bug.cgi?id=272536
rdar://126286458

Reviewed by Mike Wyrzykowski.

The id attribute validation was missing the upper bound check.

* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/decl/override-expected.txt:
 Added.
* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/shader_io/id-expected.txt:
 Added.
* Source/WebGPU/WGSL/AttributeValidator.cpp:
(WGSL::AttributeValidator::visit):

Canonical link: https://commits.webkit.org/277492@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] f0eff1: [WGSL] Identifier lexing reads after EOF

2024-04-11 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f0eff1790b685946e909097fcc0109afbaa414be
  
https://github.com/WebKit/WebKit/commit/f0eff1790b685946e909097fcc0109afbaa414be
  Author: Tadeu Zagallo 
  Date:   2024-04-11 (Thu, 11 Apr 2024)

  Changed paths:
M Source/WebGPU/WGSL/Lexer.cpp
A Source/WebGPU/WGSL/tests/invalid/unicode.wgsl

  Log Message:
  ---
  [WGSL] Identifier lexing reads after EOF
https://bugs.webkit.org/show_bug.cgi?id=272403
rdar://126128360

Reviewed by Mike Wyrzykowski and Alex Christensen.

After adding support for unicode identifiers we now need an explicit check for 
EOF.

* Source/WebGPU/WGSL/Lexer.cpp:
(WGSL::Lexer::nextToken):
* Source/WebGPU/WGSL/tests/invalid/unicode.wgsl: Added.

Canonical link: https://commits.webkit.org/277382@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 207014: [WGSL] Bounds checking needs to handle pointers

2024-04-11 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 207014e9bc0ae60ec6376ffbd4cfe017b32ac621
  
https://github.com/WebKit/WebKit/commit/207014e9bc0ae60ec6376ffbd4cfe017b32ac621
  Author: Tadeu Zagallo 
  Date:   2024-04-11 (Thu, 11 Apr 2024)

  Changed paths:
M Source/WebGPU/WGSL/BoundsCheck.cpp
M Source/WebGPU/WGSL/tests/valid/runtime-sized-array-resource.wgsl

  Log Message:
  ---
  [WGSL] Bounds checking needs to handle pointers
https://bugs.webkit.org/show_bug.cgi?id=272477
rdar://126210788

Reviewed by Mike Wyrzykowski.

Originally only array references could be used as the base for an index access,
but the spec was updated to support using pointers as well, but the code for
bounds check insertion wasn't updated.

* Source/WebGPU/WGSL/BoundsCheck.cpp:
(WGSL::BoundsCheckVisitor::visit):
* Source/WebGPU/WGSL/tests/valid/runtime-sized-array-resource.wgsl:

Canonical link: https://commits.webkit.org/277381@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] c5b0e4: [WGSL] Fix broken wgslc tests

2024-04-08 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c5b0e434b552f9ea9b45b699ba435b1bd048
  
https://github.com/WebKit/WebKit/commit/c5b0e434b552f9ea9b45b699ba435b1bd048
  Author: Tadeu Zagallo 
  Date:   2024-04-08 (Mon, 08 Apr 2024)

  Changed paths:
M Source/WebGPU/WGSL/AttributeValidator.cpp
A 
Source/WebGPU/WGSL/tests/invalid/attribute-validation-during-type-checking.wgsl
M Source/WebGPU/WGSL/tests/invalid/attribute-validation.wgsl
M Source/WebGPU/WGSL/tests/valid/concretization.wgsl
M Source/WebGPU/WGSL/tests/valid/constants-utf16.wgsl
M Source/WebGPU/WGSL/tests/valid/constants.wgsl
M Source/WebGPU/WGSL/tests/valid/global-constant-vector.wgsl
M Source/WebGPU/WGSL/tests/valid/overload.wgsl
M Source/WebGPU/WGSL/tests/valid/packing.wgsl

  Log Message:
  ---
  [WGSL] Fix broken wgslc tests
https://bugs.webkit.org/show_bug.cgi?id=272227
rdar://125966589

Reviewed by Mike Wyrzykowski and Dan Glastonbury.

The tests just needed to be updated because they contained invalid code that
is now being rejected after we added more validation.

* Source/WebGPU/WGSL/AttributeValidator.cpp:
(WGSL::AttributeValidator::visit):
* 
Source/WebGPU/WGSL/tests/invalid/attribute-validation-during-type-checking.wgsl:
 Added.
* Source/WebGPU/WGSL/tests/invalid/attribute-validation.wgsl:
* Source/WebGPU/WGSL/tests/valid/concretization.wgsl:
* Source/WebGPU/WGSL/tests/valid/constants-utf16.wgsl:
* Source/WebGPU/WGSL/tests/valid/constants.wgsl:
* Source/WebGPU/WGSL/tests/valid/global-constant-vector.wgsl:
* Source/WebGPU/WGSL/tests/valid/overload.wgsl:
* Source/WebGPU/WGSL/tests/valid/packing.wgsl:

Canonical link: https://commits.webkit.org/277194@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 15c31e: [WebGPU] https://gpuweb.github.io/cts/standalone/?...

2024-04-08 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 15c31e21d87705f509b1206beee9eee170e6cda3
  
https://github.com/WebKit/WebKit/commit/15c31e21d87705f509b1206beee9eee170e6cda3
  Author: Tadeu Zagallo 
  Date:   2024-04-08 (Mon, 08 Apr 2024)

  Changed paths:
A 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/shader_io/workgroup_size-expected.txt
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WebGPU] 
https://gpuweb.github.io/cts/standalone/?q=webgpu:api,operation,compute_pipeline,overrides:workgroup_size:isAsync=true;type=%22u32%22;size=3;v=%22y%22
 is failing
https://bugs.webkit.org/show_bug.cgi?id=272204
rdar://125945949

Reviewed by Mike Wyrzykowski and Dan Glastonbury.

In 275374@main I changed some of the attribute type checking to use a new 
`check` helper,
which checks if a type satisfies a constraint and then concretizes it if 
necessary. That
helper was being used when checking the `@workgroup_size`, which is not 
correct, since we
cannot concretize the type of each argument individually.

* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/shader_io/workgroup_size-expected.txt:
 Added.
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):

Canonical link: https://commits.webkit.org/277193@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 087346: [WebGPU] WGSL compiler should support unicode char...

2024-04-05 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 087346e089cf2fe3c75037da7eb17553534a6fdb
  
https://github.com/WebKit/WebKit/commit/087346e089cf2fe3c75037da7eb17553534a6fdb
  Author: Tadeu Zagallo 
  Date:   2024-04-05 (Fri, 05 Apr 2024)

  Changed paths:
M 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/parse/identifiers-expected.txt
M Source/WebGPU/WGSL/Lexer.cpp
M Source/WebGPU/WGSL/Lexer.h
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj
M Source/WebGPU/WebGPU/ShaderModule.mm

  Log Message:
  ---
  [WebGPU] WGSL compiler should support unicode characters
https://bugs.webkit.org/show_bug.cgi?id=266774
rdar://120004379

Reviewed by Mike Wyrzykowski and Yusuke Suzuki.

For the most part, we already supported unicode, but the implementation for
isIdentifierStart and isIdentifierContinue needed to be updated. After this 
patch
all the identifier tests in the CTS (under 
shader,validation,parse,identifiers:*)
are passing.

* Source/WebGPU/WGSL/Lexer.cpp:
(WGSL::isIdentifierStart):
(WGSL::isIdentifierContinue):
(WGSL::Lexer::nextToken):
* Source/WebGPU/WGSL/Lexer.h:
(WGSL::Lexer::isIdentifierStart): Deleted.
(WGSL::Lexer::isIdentifierContinue): Deleted.
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::check):
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:
* Source/WebGPU/WebGPU/ShaderModule.mm:
(WebGPU::Device::createShaderModule):

Canonical link: https://commits.webkit.org/277108@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 9c6ee0: [WGSL] Pointer rewriter should visit phony assignment

2024-04-03 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9c6ee0f8bb9311052934ad81e2e5f5f044d42fed
  
https://github.com/WebKit/WebKit/commit/9c6ee0f8bb9311052934ad81e2e5f5f044d42fed
  Author: Tadeu Zagallo 
  Date:   2024-04-03 (Wed, 03 Apr 2024)

  Changed paths:
M Source/WebGPU/WGSL/PointerRewriter.cpp
M Source/WebGPU/WGSL/tests/valid/array-length.wgsl
M Source/WebGPU/WGSL/wgslc.cpp

  Log Message:
  ---
  [WGSL] Pointer rewriter should visit phony assignment
https://bugs.webkit.org/show_bug.cgi?id=272035
rdar://125618287

Reviewed by Mike Wyrzykowski.

The pointer rewriter needs to delete phony assignments when the right-hand side
is a pointer, but it fails to visit the assignment when it's not a pointer. I 
also
fixed a compilation error in wgslc due to some recent refactoring to use 
std::span.

* Source/WebGPU/WGSL/PointerRewriter.cpp:
(WGSL::PointerRewriter::visit):
* Source/WebGPU/WGSL/tests/valid/array-length.wgsl:
* Source/WebGPU/WGSL/wgslc.cpp:
(runWGSL):

Canonical link: https://commits.webkit.org/277005@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 2fa5e5: [WGSL] Validate functions missing a return statement

2024-03-25 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2fa5e500ae947d383e44891f61cd27213c0f622e
  
https://github.com/WebKit/WebKit/commit/2fa5e500ae947d383e44891f61cd27213c0f622e
  Author: Tadeu Zagallo 
  Date:   2024-03-25 (Mon, 25 Mar 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WGSL/tests/invalid/function-call.wgsl

  Log Message:
  ---
  [WGSL] Validate functions missing a return statement
https://bugs.webkit.org/show_bug.cgi?id=271482
rdar://124143123

Reviewed by Mike Wyrzykowski.

Implement the behavior analysis from the spec[1] and check if functions with a
return type are missing a return statement.

[1]: https://www.w3.org/TR/WGSL/#behaviors

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::analyze):
(WGSL::TypeChecker::analyzeStatements):
* Source/WebGPU/WGSL/tests/invalid/function-call.wgsl:

Canonical link: https://commits.webkit.org/276630@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 679ba4: [WGSL] shader, validation, shader_io, locations:* is ...

2024-03-21 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 679ba4ca58bd1cf47630c787a690a711bff917de
  
https://github.com/WebKit/WebKit/commit/679ba4ca58bd1cf47630c787a690a711bff917de
  Author: Tadeu Zagallo 
  Date:   2024-03-21 (Thu, 21 Mar 2024)

  Changed paths:
M 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/shader_io/locations-expected.txt
M Source/WebGPU/WGSL/AttributeValidator.cpp

  Log Message:
  ---
  [WGSL] shader,validation,shader_io,locations:* is failing
https://bugs.webkit.org/show_bug.cgi?id=271258
rdar://125026498

Reviewed by Mike Wyrzykowski.

Add the validation for location attributes according to the spec[1].

[1]: https://www.w3.org/TR/WGSL/#user-defined-inputs-outputs

* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/shader_io/locations-expected.txt:
* Source/WebGPU/WGSL/AttributeValidator.cpp:
(WGSL::AttributeValidator::validateIO):
(WGSL::AttributeValidator::validateLocationIO):
(WGSL::AttributeValidator::validateStructIO):

Canonical link: https://commits.webkit.org/276460@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] ec673c: [WGSL] shader, validation, shader_io, builtins:* is f...

2024-03-21 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ec673c847c6ae4891c2fc9d259bb377cd1d02cbc
  
https://github.com/WebKit/WebKit/commit/ec673c847c6ae4891c2fc9d259bb377cd1d02cbc
  Author: Tadeu Zagallo 
  Date:   2024-03-21 (Thu, 21 Mar 2024)

  Changed paths:
M 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/shader_io/builtins-expected.txt
M Source/WebGPU/WGSL/AttributeValidator.cpp
M Source/WebGPU/WGSL/AttributeValidator.h
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WGSL/WGSL.cpp
M Source/WebGPU/WGSL/WGSLEnums.cpp
M Source/WebGPU/WGSL/WGSLEnums.h

  Log Message:
  ---
  [WGSL] shader,validation,shader_io,builtins:* is failing
https://bugs.webkit.org/show_bug.cgi?id=271254
rdar://125022496

Reviewed by Mike Wyrzykowski.

Validate builtin attributes according to the spec[1].

[1]: https://www.w3.org/TR/WGSL/#builtin-inputs-outputs

* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/shader_io/builtins-expected.txt:
* Source/WebGPU/WGSL/AttributeValidator.cpp:
(WGSL::AttributeValidator::validateIO):
(WGSL::AttributeValidator::validateBuiltinIO):
(WGSL::AttributeValidator::validateLocationIO):
(WGSL::AttributeValidator::validateStructIO):
(WGSL::validateIO):
* Source/WebGPU/WGSL/AttributeValidator.h:
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/WGSL.cpp:
(WGSL::staticCheck):
* Source/WebGPU/WGSL/WGSLEnums.cpp:
* Source/WebGPU/WGSL/WGSLEnums.h:

Canonical link: https://commits.webkit.org/276454@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 9af7ee: [WGSL] Build call graph during staticCheck

2024-03-07 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9af7ee6fac32f75aa909bb9ef3a69478da926a3d
  
https://github.com/WebKit/WebKit/commit/9af7ee6fac32f75aa909bb9ef3a69478da926a3d
  Author: Tadeu Zagallo 
  Date:   2024-03-07 (Thu, 07 Mar 2024)

  Changed paths:
M Source/WebGPU/WGSL/CallGraph.cpp
M Source/WebGPU/WGSL/CallGraph.h
M Source/WebGPU/WGSL/EntryPointRewriter.cpp
M Source/WebGPU/WGSL/EntryPointRewriter.h
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Source/WebGPU/WGSL/GlobalVariableRewriter.h
M Source/WebGPU/WGSL/MangleNames.cpp
M Source/WebGPU/WGSL/MangleNames.h
M Source/WebGPU/WGSL/Metal/MetalCodeGenerator.cpp
M Source/WebGPU/WGSL/Metal/MetalCodeGenerator.h
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.h
M Source/WebGPU/WGSL/PointerRewriter.cpp
M Source/WebGPU/WGSL/PointerRewriter.h
M Source/WebGPU/WGSL/WGSL.cpp
M Source/WebGPU/WGSL/WGSL.h
M Source/WebGPU/WGSL/WGSLShaderModule.h
M Source/WebGPU/WGSL/wgslc.cpp
M Source/WebGPU/WebGPU/Pipeline.mm
M Source/WebGPU/WebGPU/ShaderModule.mm
M Tools/TestWebKitAPI/Tests/WGSL/MetalGenerationTests.cpp

  Log Message:
  ---
  [WGSL] Build call graph during staticCheck
https://bugs.webkit.org/show_bug.cgi?id=270540
rdar://124095995

Reviewed by Mike Wyrzykowski.

Some validations that must happen during staticCheck/shader creation time 
require
knowing in which stages variables are used, and for that we need the call graph.
This patch just refactors the call graph creation into staticCheck, so that we
can use it in a subsequent patch to perform the validations.

* Source/WebGPU/WGSL/CallGraph.cpp:
(WGSL::CallGraphBuilder::CallGraphBuilder):
(WGSL::CallGraphBuilder::build):
(WGSL::CallGraphBuilder::initializeMappings):
(WGSL::buildCallGraph):
(WGSL::CallGraph::CallGraph): Deleted.
* Source/WebGPU/WGSL/CallGraph.h:
(WGSL::CallGraph::CallGraph):
(WGSL::CallGraph::ast const): Deleted.
* Source/WebGPU/WGSL/EntryPointRewriter.cpp:
(WGSL::EntryPointRewriter::EntryPointRewriter):
(WGSL::rewriteEntryPoints):
* Source/WebGPU/WGSL/EntryPointRewriter.h:
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::RewriteGlobalVariables):
(WGSL::RewriteGlobalVariables::run):
(WGSL::RewriteGlobalVariables::visitCallee):
(WGSL::RewriteGlobalVariables::visit):
(WGSL::RewriteGlobalVariables::pack):
(WGSL::RewriteGlobalVariables::getPacking):
(WGSL::RewriteGlobalVariables::collectGlobals):
(WGSL::RewriteGlobalVariables::bufferLengthType):
(WGSL::RewriteGlobalVariables::bufferLengthReferenceType):
(WGSL::RewriteGlobalVariables::packStructResource):
(WGSL::RewriteGlobalVariables::packArrayResource):
(WGSL::RewriteGlobalVariables::updateReference):
(WGSL::RewriteGlobalVariables::packStructType):
(WGSL::RewriteGlobalVariables::packArrayType):
(WGSL::RewriteGlobalVariables::insertParameter):
(WGSL::RewriteGlobalVariables::visitEntryPoint):
(WGSL::RewriteGlobalVariables::createArgumentBufferEntry):
(WGSL::RewriteGlobalVariables::finalizeArgumentBufferStruct):
(WGSL::RewriteGlobalVariables::insertStructs):
(WGSL::RewriteGlobalVariables::insertDynamicOffsetsBufferIfNeeded):
(WGSL::RewriteGlobalVariables::insertMaterializations):
(WGSL::RewriteGlobalVariables::insertLocalDefinitions):
(WGSL::RewriteGlobalVariables::initializeVariables):
(WGSL::RewriteGlobalVariables::insertWorkgroupBarrier):
(WGSL::RewriteGlobalVariables::findOrInsertLocalInvocationIndex):
(WGSL::RewriteGlobalVariables::storeInitialValue):
(WGSL::rewriteGlobalVariables):
* Source/WebGPU/WGSL/GlobalVariableRewriter.h:
* Source/WebGPU/WGSL/MangleNames.cpp:
(WGSL::NameManglerVisitor::NameManglerVisitor):
(WGSL::NameManglerVisitor::run):
(WGSL::NameManglerVisitor::visit):
(WGSL::NameManglerVisitor::introduceVariable):
(WGSL::NameManglerVisitor::readVariable const):
(WGSL::mangleNames):
* Source/WebGPU/WGSL/MangleNames.h:
* Source/WebGPU/WGSL/Metal/MetalCodeGenerator.cpp:
(WGSL::Metal::generateMetalCode):
* Source/WebGPU/WGSL/Metal/MetalCodeGenerator.h:
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
(WGSL::Metal::FunctionDefinitionWriter::write):
(WGSL::Metal::FunctionDefinitionWriter::emitNecessaryHelpers):
(WGSL::Metal::FunctionDefinitionWriter::visit):
(WGSL::Metal::emitMetalFunctions):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.h:
* Source/WebGPU/WGSL/PointerRewriter.cpp:
(WGSL::PointerRewriter::PointerRewriter):
(WGSL::PointerRewriter::run):
(WGSL::PointerRewriter::rewrite):
(WGSL::PointerRewriter::visit):
(WGSL::rewritePointers):
* Source/WebGPU/WGSL/PointerRewriter.h:
* Source/WebGPU/WGSL/WGSL.cpp:
(WGSL::staticCheck):
(WGSL::prepareImpl):
(WGSL::generate):
* Source/WebGPU/WGSL/WGSL.h:
* Source/WebGPU/WGSL/WGSLShaderModule.h:
(WGSL::ShaderModule::callGraph const):
(WGSL::ShaderModule::setCallGraph):
* Source/WebGPU/WGSL/wgslc.cpp:
(runWGSL):
* Source

[webkit-changes] [WebKit/WebKit] 8c7b84: [WGSL] Validate maximum array size

2024-03-01 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8c7b8419c6ff3be3a4ae2f5246c6327a962c8698
  
https://github.com/WebKit/WebKit/commit/8c7b8419c6ff3be3a4ae2f5246c6327a962c8698
  Author: Tadeu Zagallo 
  Date:   2024-03-01 (Fri, 01 Mar 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WGSL/tests/invalid/array.wgsl

  Log Message:
  ---
  [WGSL] Validate maximum array size
https://bugs.webkit.org/show_bug.cgi?id=270313
rdar://123852286

Reviewed by Mike Wyrzykowski and Alex Christensen.

Fix 2 issues with array sizes:
- the size was being treated as unsigned and only checking for 0, but according
  to the spec the size can also be signed, and we should return an error for
  negative values
- we also need to limit the maximum size of an array. the spec[1] says the 
minimum
  size we must support is 65535 bytes, but for now we just check for 65535 
elements.

[1]: https://www.w3.org/TR/WGSL/#limits

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/tests/invalid/array.wgsl:

Canonical link: https://commits.webkit.org/275557@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 5daece: [WGSL] Refactor variable initializer typing

2024-03-01 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5daecebaee8344378f5d4db67f14422fe06029ea
  
https://github.com/WebKit/WebKit/commit/5daecebaee8344378f5d4db67f14422fe06029ea
  Author: Tadeu Zagallo 
  Date:   2024-03-01 (Fri, 01 Mar 2024)

  Changed paths:
A 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/decl/var-expected.txt
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] Refactor variable initializer typing
https://bugs.webkit.org/show_bug.cgi?id=270316
rdar://123854264

Reviewed by Mike Wyrzykowski.

In 274615@main I fixed the failing CTS tests under 
shader,validation,decl,var:initializer_kind:
by adding explicit checks for function calls and references to other global 
variables. However,
the reason those tests were failing in the first place was that a global 
variable's initializer
can only use constant and override expressions according to the spec[1].

[1]: https://www.w3.org/TR/WGSL/#var-and-value

* LayoutTests/http/tests/webgpu/webgpu/shader/validation/decl/var-expected.txt: 
Added.
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::visitVariable): Deleted.

Canonical link: https://commits.webkit.org/275554@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 978f3f: [WGSL] shader, validation, extension, pointer_composi...

2024-02-29 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 978f3f4a4a757853093522ee3073af1e27e91bac
  
https://github.com/WebKit/WebKit/commit/978f3f4a4a757853093522ee3073af1e27e91bac
  Author: Tadeu Zagallo 
  Date:   2024-02-29 (Thu, 29 Feb 2024)

  Changed paths:
A 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/extension/pointer_composite_access-expected.txt
M Source/WebGPU/WGSL/BoundsCheck.cpp
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] shader,validation,extension,pointer_composite_access:* is failing
https://bugs.webkit.org/show_bug.cgi?id=270246
rdar://123784316

Reviewed by Mike Wyrzykowski.

The original support for pointer composite access was implemented in 
275383@main,
but the case where the type is a pointer wasn't handled in two places.

* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/extension/pointer_composite_access-expected.txt:
 Added.
* Source/WebGPU/WGSL/BoundsCheck.cpp:
(WGSL::BoundsCheckVisitor::visit):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):

Canonical link: https://commits.webkit.org/275490@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] d428a6: [WGSL] shader, validation, parse, must_use:* is failing

2024-02-29 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d428a6a8c543d4232fdc38d76bb3d09bfd027dd3
  
https://github.com/WebKit/WebKit/commit/d428a6a8c543d4232fdc38d76bb3d09bfd027dd3
  Author: Tadeu Zagallo 
  Date:   2024-02-29 (Thu, 29 Feb 2024)

  Changed paths:
A 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/parse/must_use-expected.txt
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] shader,validation,parse,must_use:* is failing
https://bugs.webkit.org/show_bug.cgi?id=270247
rdar://123784798

Reviewed by Mike Wyrzykowski.

We handle the general case for must_use in builtins, but struct constructors
and bitcast needed to be handled separately.

* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/parse/must_use-expected.txt:
 Added.
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::bitcast):

Canonical link: https://commits.webkit.org/275489@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] edb023: [WGSL] shader, validation, parse, semicolon:* is failing

2024-02-29 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: edb02386f41a913296d04bedf0f811bd10bd4644
  
https://github.com/WebKit/WebKit/commit/edb02386f41a913296d04bedf0f811bd10bd4644
  Author: Tadeu Zagallo 
  Date:   2024-02-29 (Thu, 29 Feb 2024)

  Changed paths:
M 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/parse/semicolon-expected.txt
M Source/WebGPU/WGSL/Parser.cpp

  Log Message:
  ---
  [WGSL] shader,validation,parse,semicolon:* is failing
https://bugs.webkit.org/show_bug.cgi?id=270237
rdar://123773267

Reviewed by Mike Wyrzykowski.

We were missing a semicolon after diagnostic declarations, after that all 
semicolon
tests pass.

* 
LayoutTests/http/tests/webgpu/webgpu/shader/validation/parse/semicolon-expected.txt:
* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser::parseShader):

Canonical link: https://commits.webkit.org/275488@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] b866cc: [WGSL] Add new language features

2024-02-27 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b866cccd7a08edce14641d81ee3cca8a66717f4f
  
https://github.com/WebKit/WebKit/commit/b866cccd7a08edce14641d81ee3cca8a66717f4f
  Author: Tadeu Zagallo 
  Date:   2024-02-27 (Tue, 27 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/Parser.cpp
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WGSL/WGSLEnums.h

  Log Message:
  ---
  [WGSL] Add new language features
https://bugs.webkit.org/show_bug.cgi?id=270097
rdar://123637623

Reviewed by Mike Wyrzykowski.

Since the original implementation 3 new language features/extensions were added
to the spec[1]. We already implemented most of them, two of them, so it was just
a matter of adding them to the enum, but `pointer_composite_access` had to be
implemented, which in short allows accessing pointers to composite types in the
same way as references.

[1]: https://www.w3.org/TR/WGSL/#language-extensions-sec

* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser::parseRequireDirective):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/WGSLEnums.h:

Canonical link: https://commits.webkit.org/275383@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 7c4f60: [WGSL] shader, validation, parse, align:parsing:* is ...

2024-02-27 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7c4f60e281a8922446c5bec68a6012f654953476
  
https://github.com/WebKit/WebKit/commit/7c4f60e281a8922446c5bec68a6012f654953476
  Author: Tadeu Zagallo 
  Date:   2024-02-27 (Tue, 27 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/AttributeValidator.cpp
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] shader,validation,parse,align:parsing:* is failing
https://bugs.webkit.org/show_bug.cgi?id=270098
rdar://123638061

Reviewed by Mike Wyrzykowski.

There two bugs in the validation of `@align`:
- the value has to be bigger than 0, but we allowed 0 before.
- the constant values of attributes were not being concretized

* Source/WebGPU/WGSL/AttributeValidator.cpp:
(WGSL::AttributeValidator::visit):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::check):

Canonical link: https://commits.webkit.org/275374@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 8529f0: [WGSL] shader, validation, expression, unary, address_...

2024-02-27 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8529f0139b931464e17a5441db507b544d6a9926
  
https://github.com/WebKit/WebKit/commit/8529f0139b931464e17a5441db507b544d6a9926
  Author: Tadeu Zagallo 
  Date:   2024-02-27 (Tue, 27 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WGSL/TypeDeclarations.rb
M Source/WebGPU/WGSL/TypeStore.cpp
M Source/WebGPU/WGSL/TypeStore.h
M Source/WebGPU/WGSL/Types.h

  Log Message:
  ---
  [WGSL] shader,validation,expression,unary,address_of_and_indirection:* is 
failing
https://bugs.webkit.org/show_bug.cgi?id=270095
rdar://123636841

Reviewed by Mike Wyrzykowski.

Move the logic for address of and indirection from a type declaration into the
type checker in order to separate it from the arithmetic operators, and 
implement
the additional validation:
- don't allow taking the address of a vector component
- don't allow taking the address of textures and samplers

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/TypeDeclarations.rb:
* Source/WebGPU/WGSL/TypeStore.cpp:
(WGSL::ReferenceKey::encode const):
(WGSL::TypeStore::referenceType):
* Source/WebGPU/WGSL/TypeStore.h:
* Source/WebGPU/WGSL/Types.h:

Canonical link: https://commits.webkit.org/275373@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 3211e5: [WGSL] shader, validation, expression, binary, bitwise...

2024-02-27 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3211e5848f89a9c1f885c09cecd848fc45d4f4dc
  
https://github.com/WebKit/WebKit/commit/3211e5848f89a9c1f885c09cecd848fc45d4f4dc
  Author: Tadeu Zagallo 
  Date:   2024-02-27 (Tue, 27 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/ConstantFunctions.h

  Log Message:
  ---
  [WGSL] shader,validation,expression,binary,bitwise_shift:* is failing
https://bugs.webkit.org/show_bug.cgi?id=270094
rdar://123636621

Reviewed by Mike Wyrzykowski.

Add missing validation on the shift value.

* Source/WebGPU/WGSL/ConstantFunctions.h:
(WGSL::CONSTANT_FUNCTION):

Canonical link: https://commits.webkit.org/275372@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] ca4cb0: [WGSL] Serialization of constant structs is not im...

2024-02-23 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ca4cb03cffc676534681333693789bc5d7a159e8
  
https://github.com/WebKit/WebKit/commit/ca4cb03cffc676534681333693789bc5d7a159e8
  Author: Tadeu Zagallo 
  Date:   2024-02-23 (Fri, 23 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/AST/ASTStructureMember.h
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp

  Log Message:
  ---
  [WGSL] Serialization of constant structs is not implemented
https://bugs.webkit.org/show_bug.cgi?id=269921
rdar://123445698

Reviewed by Mike Wyrzykowski.

Constant structs were implemented in 275043@main, but serialization was missing.

* Source/WebGPU/WGSL/AST/ASTStructureMember.h:
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::serializeConstant):

Canonical link: https://commits.webkit.org/275234@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] cc2256: [WGSL] Type checker does not visit structure attri...

2024-02-21 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cc2256fa58d7af75de256cfa33ad8733f5556aeb
  
https://github.com/WebKit/WebKit/commit/cc2256fa58d7af75de256cfa33ad8733f5556aeb
  Author: Tadeu Zagallo 
  Date:   2024-02-21 (Wed, 21 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] Type checker does not visit structure attributes
https://bugs.webkit.org/show_bug.cgi?id=269786
rdar://123238802

Reviewed by Mike Wyrzykowski.

The attributes of a struct weren't being visited, and therefore not type 
checked.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):

Canonical link: https://commits.webkit.org/275105@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] f8d79c: [WGSL] Validate function parameter and return types

2024-02-21 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f8d79cb3381c3e2e52f3f2fa7aa0c8f3e54e63a9
  
https://github.com/WebKit/WebKit/commit/f8d79cb3381c3e2e52f3f2fa7aa0c8f3e54e63a9
  Author: Tadeu Zagallo 
  Date:   2024-02-21 (Wed, 21 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WGSL/Types.cpp
M Source/WebGPU/WGSL/Types.h

  Log Message:
  ---
  [WGSL] Validate function parameter and return types
https://bugs.webkit.org/show_bug.cgi?id=269727
rdar://123238787

Reviewed by Mike Wyrzykowski.

Validate function parameters and return types according to the spec[1].

[1]: https://www.w3.org/TR/WGSL/#function-restriction

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):

Canonical link: https://commits.webkit.org/275103@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] bdca85: [WGSL] Calls to non-constructible struct construct...

2024-02-21 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bdca8520ed5ffd00e6b77977f99b006f086f041a
  
https://github.com/WebKit/WebKit/commit/bdca8520ed5ffd00e6b77977f99b006f086f041a
  Author: Tadeu Zagallo 
  Date:   2024-02-21 (Wed, 21 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] Calls to non-constructible struct constructors should be rejected
https://bugs.webkit.org/show_bug.cgi?id=269793
rdar://123312266

Reviewed by Mike Wyrzykowski.

We were missing a check in the type checker for whether the struct being 
constructed
is actually constructible.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):

Canonical link: https://commits.webkit.org/275101@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] badede: [WGSL] Fix small parser bugs

2024-02-21 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: badede9886d3f208291d4ee550ceefd482cfc7ca
  
https://github.com/WebKit/WebKit/commit/badede9886d3f208291d4ee550ceefd482cfc7ca
  Author: Tadeu Zagallo 
  Date:   2024-02-21 (Wed, 21 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/Parser.cpp

  Log Message:
  ---
  [WGSL] Fix small parser bugs
https://bugs.webkit.org/show_bug.cgi?id=269790
rdar://123311105

Reviewed by Mike Wyrzykowski.

We were missing a check for a semicolon after const_assert and trailing commas
in attributes, which caused a few CTS test failures.

* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser::parseConstAssert):
(WGSL::Parser::parseAttribute):

Canonical link: https://commits.webkit.org/275099@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 9d9b9b: [WGSL] Global sorting tries to print the name of a...

2024-02-21 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9d9b9bba0c3d53e06df2af6da84463b83165226c
  
https://github.com/WebKit/WebKit/commit/9d9b9bba0c3d53e06df2af6da84463b83165226c
  Author: Tadeu Zagallo 
  Date:   2024-02-21 (Wed, 21 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/GlobalSorting.cpp

  Log Message:
  ---
  [WGSL] Global sorting tries to print the name of a const_assert
https://bugs.webkit.org/show_bug.cgi?id=269787
rdar://123238821

Reviewed by Mike Wyrzykowski.

A const_assert can never be part of a dependency cycle, but it can be visited
while the cycle is being computed. In that case, a debug logging was trying to
print the name of the const_assert, which resulted in an assertion failure.

* Source/WebGPU/WGSL/GlobalSorting.cpp:
(WGSL::nameForDeclaration):
(WGSL::Graph::addEdge):
(WGSL::reorder):

Canonical link: https://commits.webkit.org/275097@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] b79f9e: [WGSL] 275043@main broke webgpu samples

2024-02-20 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b79f9e5819b8c607a2256e0d4cb3a7997beca144
  
https://github.com/WebKit/WebKit/commit/b79f9e5819b8c607a2256e0d4cb3a7997beca144
  Author: Tadeu Zagallo 
  Date:   2024-02-20 (Tue, 20 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] 275043@main broke webgpu samples
https://bugs.webkit.org/show_bug.cgi?id=269807
rdar://123330381

Reviewed by Mike Wyrzykowski.

When introducing constant structs there was a bug where we incorrectly tried to
construct a constant struct even if none of the arguments were constant.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):

Canonical link: https://commits.webkit.org/275079@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 3cfd9d: [WGSL] Add support for constant structs

2024-02-20 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3cfd9dd3b52c39e46afe97c1a9460418d3c98b84
  
https://github.com/WebKit/WebKit/commit/3cfd9dd3b52c39e46afe97c1a9460418d3c98b84
  Author: Tadeu Zagallo 
  Date:   2024-02-20 (Tue, 20 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/ConstantFunctions.h
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] Add support for constant structs
https://bugs.webkit.org/show_bug.cgi?id=269710
rdar://123238708

Reviewed by Mike Wyrzykowski.

We already had ConstantStruct, but it was only being used for primitive structs
(like the one returned by frexp), so we just needed to create the constant 
values
and add the lookup logic to FieldAccessExpression.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::convertValueImpl):

Canonical link: https://commits.webkit.org/275043@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] ce8807: [WGSL] Failed concretization generates invalid types

2024-02-20 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ce88073de78f1edecd17a089451523034ffba6ac
  
https://github.com/WebKit/WebKit/commit/ce88073de78f1edecd17a089451523034ffba6ac
  Author: Tadeu Zagallo 
  Date:   2024-02-20 (Tue, 20 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/Constraints.cpp
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] Failed concretization generates invalid types
https://bugs.webkit.org/show_bug.cgi?id=269720
rdar://123238768

Reviewed by Mike Wyrzykowski.

`concretize` might return a nullptr if the type can't be concretized, so 
recursive
calls need to check the result before constructing the return type, otherwise it
can result in e.g. a vector with a nullptr element.

* Source/WebGPU/WGSL/Constraints.cpp:
(WGSL::concretize):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):

Canonical link: https://commits.webkit.org/275040@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] a4712a: [WGSL] shader, validation, expression, access, vector:...

2024-02-20 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a4712acfe708fd25162f736e45405fc334aedfcd
  
https://github.com/WebKit/WebKit/commit/a4712acfe708fd25162f736e45405fc334aedfcd
  Author: Tadeu Zagallo 
  Date:   2024-02-20 (Tue, 20 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] shader,validation,expression,access,vector:vector:* is failing
https://bugs.webkit.org/show_bug.cgi?id=269713
rdar://123239541

Reviewed by Mike Wyrzykowski.

We were missing the out of bounds validation when only the index of an access is
constant, but not the base. If the type determines the size of the 
array/vector/matrix
it should still be a compilation error.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):

Canonical link: https://commits.webkit.org/275039@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 4fcf9d: [WGSL] Add support for constant vector swizzle access

2024-02-20 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4fcf9d729f6d01c1057145b8e873c018c9e4bef4
  
https://github.com/WebKit/WebKit/commit/4fcf9d729f6d01c1057145b8e873c018c9e4bef4
  Author: Tadeu Zagallo 
  Date:   2024-02-20 (Tue, 20 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] Add support for constant vector swizzle access
https://bugs.webkit.org/show_bug.cgi?id=269709
rdar://123238288

Reviewed by Mike Wyrzykowski.

FieldAccessExpression was missing the constant implementation when the base is 
a vector.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::vectorFieldAccess):

Canonical link: https://commits.webkit.org/275038@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 2c0707: [WGSL] Primitive structs should be constructible

2024-02-15 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2c0707cd6f7bed448b84c48e62d2bd8d759e2c6f
  
https://github.com/WebKit/WebKit/commit/2c0707cd6f7bed448b84c48e62d2bd8d759e2c6f
  Author: Tadeu Zagallo 
  Date:   2024-02-15 (Thu, 15 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/Types.cpp

  Log Message:
  ---
  [WGSL] Primitive structs should be constructible
https://bugs.webkit.org/show_bug.cgi?id=269395
rdar://122965508

Reviewed by Mike Wyrzykowski.

Primitive structs were not being allowed in arrays, due to incorrectly
reporting that the type was not constructible, but my understanding of
the spec is that it should be.

* Source/WebGPU/WGSL/Types.cpp:
(WGSL::Type::isConstructible const):

Canonical link: https://commits.webkit.org/274724@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 986082: [WGSL] Constant bitcast function does not handle v...

2024-02-15 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 986082f5bc52ce35c6dbaa13b4207b3a936e6779
  
https://github.com/WebKit/WebKit/commit/986082f5bc52ce35c6dbaa13b4207b3a936e6779
  Author: Tadeu Zagallo 
  Date:   2024-02-15 (Thu, 15 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/ConstantFunctions.h

  Log Message:
  ---
  [WGSL] Constant bitcast function does not handle vectors of doubles
https://bugs.webkit.org/show_bug.cgi?id=269391
rdar://122293522

Reviewed by Mike Wyrzykowski.

Bitcast needs to accept abstract values due to special edge cases, but it also
needs to concretize the values for the default case. We were missing a 
conversion
from double (abstract float) to f32 when bitcasting between vectors of different
sizes.

* Source/WebGPU/WGSL/ConstantFunctions.h:
(WGSL::CONSTANT_FUNCTION):

Canonical link: https://commits.webkit.org/274719@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 1b0f88: [WGSL] Validation of array element type is incorrect

2024-02-15 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1b0f8896c4d1d6503e3f560b9bad212aab613763
  
https://github.com/WebKit/WebKit/commit/1b0f8896c4d1d6503e3f560b9bad212aab613763
  Author: Tadeu Zagallo 
  Date:   2024-02-15 (Thu, 15 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] Validation of array element type is incorrect
https://bugs.webkit.org/show_bug.cgi?id=269386
rdar://122960489

Reviewed by Mike Wyrzykowski.

In 274617@main I added a check that array elements must be constructible, but I 
missed
that this is only the case when constructing an array. For an array type (e.g. 
x: array)
the element type must only have creation fixed footprint.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):

Canonical link: https://commits.webkit.org/274718@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 5e14e8: [WGSL] Validate results annotated with must_use ar...

2024-02-15 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5e14e8e40aba98e447e44125f45a2e716560ebfc
  
https://github.com/WebKit/WebKit/commit/5e14e8e40aba98e447e44125f45a2e716560ebfc
  Author: Tadeu Zagallo 
  Date:   2024-02-15 (Thu, 15 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WGSL/TypeStore.cpp
M Source/WebGPU/WGSL/TypeStore.h
M Source/WebGPU/WGSL/Types.h

  Log Message:
  ---
  [WGSL] Validate results annotated with must_use are not discarded
https://bugs.webkit.org/show_bug.cgi?id=269370
rdar://122951915

Reviewed by Mike Wyrzykowski.

Check that functions/builtins annotated with must_use are not called from call 
statements.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::chooseOverload):
* Source/WebGPU/WGSL/TypeStore.cpp:
(WGSL::TypeStore::functionType):
* Source/WebGPU/WGSL/TypeStore.h:
* Source/WebGPU/WGSL/Types.h:

Canonical link: https://commits.webkit.org/274717@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 0babce: [WGSL] Validate element types of vectors, matrices...

2024-02-15 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0babce13402ffcbc740f869afe752ab688b7718c
  
https://github.com/WebKit/WebKit/commit/0babce13402ffcbc740f869afe752ab688b7718c
  Author: Tadeu Zagallo 
  Date:   2024-02-15 (Thu, 15 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] Validate element types of vectors, matrices and textures
https://bugs.webkit.org/show_bug.cgi?id=269379
rdar://122293433

Reviewed by Mike Wyrzykowski.

Validate that the element type of each of these type generators is valid 
according
to the spec:
- vectors can only contain scalar types
- matrices can only contain floating point types
- a texture's sampled type must be a concrete 32 bit scalar (i32, u32 or f32)

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::TypeChecker):
(WGSL::TypeChecker::allocateSimpleConstructor):

Canonical link: https://commits.webkit.org/274714@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 07e900: [WGSL] Validate the types of let, const and overri...

2024-02-15 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 07e9008c10abb247206a9293a1c42873ede003ec
  
https://github.com/WebKit/WebKit/commit/07e9008c10abb247206a9293a1c42873ede003ec
  Author: Tadeu Zagallo 
  Date:   2024-02-15 (Thu, 15 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] Validate the types of let, const and override variables
https://bugs.webkit.org/show_bug.cgi?id=269374
rdar://122293575

Reviewed by Mike Wyrzykowski.

Check that the type of each of these kinds of declarations is valid according to
the spec table[1].

[1]: https://www.w3.org/TR/WGSL/#var-and-value

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visitVariable):

Canonical link: https://commits.webkit.org/274713@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 30a16f: [WGSL] Fix arrayLength when using pointer variables

2024-02-15 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 30a16f3e2486b1627e6249729e8e837b584cac19
  
https://github.com/WebKit/WebKit/commit/30a16f3e2486b1627e6249729e8e837b584cac19
  Author: Tadeu Zagallo 
  Date:   2024-02-15 (Thu, 15 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
M Source/WebGPU/WGSL/PointerRewriter.cpp

  Log Message:
  ---
  [WGSL] Fix arrayLength when using pointer variables
https://bugs.webkit.org/show_bug.cgi?id=269371
rdar://122293523

Reviewed by Mike Wyrzykowski.

We eliminate pointer variables by replacing references to the variables with the
variable initializer expression. This caused a few issues with the global 
variable
rewriter:
- since we see multiple pointers to the same ast node, we can end up replacing 
it
  multiple times. In order to fix that we wrap the initializer in an identity 
expression
  and handle that nin the rewriter.
- avoid rewriting the array when we encounter an arrayLength call, since that 
is unnecessary
- finally, we assert that we should never encounter calls to arrayLength in the 
final
  program. All of those should have been rewritten, and the code it generated 
was not correct

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::pack):
(WGSL::RewriteGlobalVariables::getPacking):
(WGSL::RewriteGlobalVariables::readVariable const):
(WGSL::RewriteGlobalVariables::readVariable): Deleted.
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::emitArrayLength):
* Source/WebGPU/WGSL/PointerRewriter.cpp:
(WGSL::PointerRewriter::visit):

Canonical link: https://commits.webkit.org/274712@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] d01f00: [WGSL] Cannot initialize variable with non-concret...

2024-02-14 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d01f00ff4efa7da5a686a4d41f612be6850057dc
  
https://github.com/WebKit/WebKit/commit/d01f00ff4efa7da5a686a4d41f612be6850057dc
  Author: Tadeu Zagallo 
  Date:   2024-02-14 (Wed, 14 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] Cannot initialize variable with non-concrete type
https://bugs.webkit.org/show_bug.cgi?id=269304
rdar://122293570

Reviewed by Mike Wyrzykowski.

Currently we release_assert, but it should be a type error instead.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::variableFlavorToString):
(WGSL::TypeChecker::visitVariable):

Canonical link: https://commits.webkit.org/274621@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 2d31db: [WGSL] Global sort does not check max expression d...

2024-02-14 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2d31dba1a971959a98ff0a87c4d243cf905e3908
  
https://github.com/WebKit/WebKit/commit/2d31dba1a971959a98ff0a87c4d243cf905e3908
  Author: Tadeu Zagallo 
  Date:   2024-02-14 (Wed, 14 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/GlobalSorting.cpp

  Log Message:
  ---
  [WGSL] Global sort does not check max expression depth in parameters
https://bugs.webkit.org/show_bug.cgi?id=269305
rdar://122293551

Reviewed by Mike Wyrzykowski.

We check for maximum expression depth in GlobalSorting, but while visiting 
parameters
we visit further the parameter type, which allows for expressions that exceed 
the max
depth to occur in the parameter's attributes.

* Source/WebGPU/WGSL/GlobalSorting.cpp:
(WGSL::GraphBuilder::visit):

Canonical link: https://commits.webkit.org/274618@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 26862e: [WGSL] Array elements must be constructible

2024-02-14 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 26862e874a4664c4c9d53fe60c4b752393d2046f
  
https://github.com/WebKit/WebKit/commit/26862e874a4664c4c9d53fe60c4b752393d2046f
  Author: Tadeu Zagallo 
  Date:   2024-02-14 (Wed, 14 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] Array elements must be constructible
https://bugs.webkit.org/show_bug.cgi?id=269309
rdar://122293571

Reviewed by Mike Wyrzykowski.

Check that array element type is constructible.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):

Canonical link: https://commits.webkit.org/274617@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] a28287: [WGSL] Stack overflow when parsing coreLHSExpression

2024-02-14 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a28287972916cdb8091cb16e74b47d87fe5cf7a1
  
https://github.com/WebKit/WebKit/commit/a28287972916cdb8091cb16e74b47d87fe5cf7a1
  Author: Tadeu Zagallo 
  Date:   2024-02-14 (Wed, 14 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/Parser.cpp

  Log Message:
  ---
  [WGSL] Stack overflow when parsing coreLHSExpression
https://bugs.webkit.org/show_bug.cgi?id=269306
rdar://122293634

Reviewed by Mike Wyrzykowski.

We have a check for maximum recursion depth in parseLHSExpression, but for some 
reason
we only checked when parsing a unary expression, so we could still overflow 
when the
lhs expression was a "coreLHSExpression".

* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser::parseLHSExpression):

Canonical link: https://commits.webkit.org/274616@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] cedb0d: [WGSL] shader, validation, decl, var:initializer_kind...

2024-02-14 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cedb0d4044f0c16c34166bb89cc8ff9dfa539296
  
https://github.com/WebKit/WebKit/commit/cedb0d4044f0c16c34166bb89cc8ff9dfa539296
  Author: Tadeu Zagallo 
  Date:   2024-02-14 (Wed, 14 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] shader,validation,decl,var:initializer_kind:* is failing
https://bugs.webkit.org/show_bug.cgi?id=269080
rdar://122652837

Reviewed by Mike Wyrzykowski.

Validate that global variables do not use other global variables or call
user-defined functions in their initializers.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visitVariable):
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::isModuleScope const):

Canonical link: https://commits.webkit.org/274615@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 4a8e3e: [WebGPU] unsized arrays require bounds checking

2024-02-13 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4a8e3ed33b457fb86af90d09931855a3ae88fa54
  
https://github.com/WebKit/WebKit/commit/4a8e3ed33b457fb86af90d09931855a3ae88fa54
  Author: Tadeu Zagallo 
  Date:   2024-02-13 (Tue, 13 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/AST/ASTCallExpression.h
M Source/WebGPU/WGSL/AST/ASTExpression.h
A Source/WebGPU/WGSL/BoundsCheck.cpp
A Source/WebGPU/WGSL/BoundsCheck.h
M Source/WebGPU/WGSL/WGSL.cpp
M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj

  Log Message:
  ---
  [WebGPU] unsized arrays require bounds checking
https://bugs.webkit.org/show_bug.cgi?id=251376
rdar://104827098

Reviewed by Mike Wyrzykowski.

Add bounds checking to index accesses. This gets all the 
shader,execution,robust_access:*
CTS tests passing.

* Source/WebGPU/WGSL/AST/ASTCallExpression.h:
* Source/WebGPU/WGSL/AST/ASTExpression.h:
* Source/WebGPU/WGSL/BoundsCheck.cpp: Added.
(WGSL::BoundsCheckVisitor::BoundsCheckVisitor):
(WGSL::BoundsCheckVisitor::run):
(WGSL::BoundsCheckVisitor::visit):
(WGSL::insertBoundsChecks):
* Source/WebGPU/WGSL/BoundsCheck.h: Added.
* Source/WebGPU/WGSL/WGSL.cpp:
(WGSL::prepareImpl):
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:

Canonical link: https://commits.webkit.org/274540@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 28ce66: [WebGPU] Crash in Constraints.cpp:199 concretize

2024-02-13 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 28ce6649da17570640ac88f29a7218024683
  
https://github.com/WebKit/WebKit/commit/28ce6649da17570640ac88f29a7218024683
  Author: Tadeu Zagallo 
  Date:   2024-02-13 (Tue, 13 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/Constraints.cpp
M Source/WebGPU/WGSL/Overload.cpp
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WGSL/tests/invalid/bitcast.wgsl

  Log Message:
  ---
  [WebGPU] Crash in Constraints.cpp:199 concretize
https://bugs.webkit.org/show_bug.cgi?id=269114
rdar://122677724

Reviewed by Mike Wyrzykowski.

Make concretize return nullptr instead of release asserting so it's safe to call
with any types.

* Source/WebGPU/WGSL/Constraints.cpp:
(WGSL::concretize):
* Source/WebGPU/WGSL/Overload.cpp:
(WGSL::OverloadResolver::calculateRank):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visitVariable):
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::bitcast):
* Source/WebGPU/WGSL/tests/invalid/bitcast.wgsl:

Canonical link: https://commits.webkit.org/274539@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] a11d9b: [WGSL] Fix wgslc tests

2024-02-13 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a11d9bd8350a97ad50c40b00eccae5b49937ed75
  
https://github.com/WebKit/WebKit/commit/a11d9bd8350a97ad50c40b00eccae5b49937ed75
  Author: Tadeu Zagallo 
  Date:   2024-02-13 (Tue, 13 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Source/WebGPU/WGSL/tests/invalid/const-assert.wgsl
M Source/WebGPU/WGSL/tests/valid/global-used-by-callee.wgsl
M Source/WebGPU/WGSL/tests/valid/overload.wgsl

  Log Message:
  ---
  [WGSL] Fix wgslc tests
https://bugs.webkit.org/show_bug.cgi?id=269238
rdar://122829420

Reviewed by Mike Wyrzykowski.

Some of the tests contained invalid code that started failing with validations
recently added. One was failing due to an unnecessary unpack call with arrays
of vec3, which can be implicitly converted.

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::pack):
* Source/WebGPU/WGSL/tests/invalid/const-assert.wgsl:
* Source/WebGPU/WGSL/tests/valid/global-used-by-callee.wgsl:
* Source/WebGPU/WGSL/tests/valid/overload.wgsl:

Canonical link: https://commits.webkit.org/274538@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 562393: [WGSL] Validate that resources do not collide

2024-02-12 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 56239356040fd44ee197fea5563fb1ed91975efc
  
https://github.com/WebKit/WebKit/commit/56239356040fd44ee197fea5563fb1ed91975efc
  Author: Tadeu Zagallo 
  Date:   2024-02-12 (Mon, 12 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp

  Log Message:
  ---
  [WGSL] Validate that resources do not collide
https://bugs.webkit.org/show_bug.cgi?id=269078
rdar://122652489

Reviewed by Mike Wyrzykowski.

The goal was to fix shader,validation,decl,var:binding_collisions:*, but in 
order
to pass that test this validation needs to during during shader creation time, 
while
we current run it at pipeline creation time. However, moving the validation 
requires
a significantly larger change, which will happen later, but this seemed like a
worthwhile validation to have in the meantime.

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::visitEntryPoint):
(WGSL::RewriteGlobalVariables::determineUsedGlobals):

Canonical link: https://commits.webkit.org/274459@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 50a41b: [WGSL] cornell box sample no longer works

2024-02-12 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 50a41be3f79734f0a90679a2412b152dc4f6cbd3
  
https://github.com/WebKit/WebKit/commit/50a41be3f79734f0a90679a2412b152dc4f6cbd3
  Author: Tadeu Zagallo 
  Date:   2024-02-12 (Mon, 12 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp

  Log Message:
  ---
  [WGSL] cornell box sample no longer works
https://bugs.webkit.org/show_bug.cgi?id=269089
rdar://122666021

Reviewed by Mike Wyrzykowski.

There were two issues after the recent patches:
- After 274365@main we started validating the layout against the shader, 
checking that
  both the type of the resources match, but also that all variables used by the 
shader
  are present in the layout. However, we were checking that the generate 
arrayLength
  variables were present, which we did not keep track of, so any shader that 
used
  arrayLength would be rejected.
- After 274296@main we started replacing references to override variables with 
their
  values. That replacement relies on the inferred type for the identifier, 
which wasn't
  being filled correctly when creating identifiers as part of the global 
variable
  rewriting.

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::visitCallee):
(WGSL::RewriteGlobalVariables::insertStructs):

Canonical link: https://commits.webkit.org/274458@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 920eba: [WebGPU] ShaderModule::createLibrary may produce i...

2024-02-09 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 920eba11793e61c3988802a8befb005cf895e3e3
  
https://github.com/WebKit/WebKit/commit/920eba11793e61c3988802a8befb005cf895e3e3
  Author: Tadeu Zagallo 
  Date:   2024-02-09 (Fri, 09 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Source/WebGPU/WGSL/GlobalVariableRewriter.h
M Source/WebGPU/WGSL/WGSL.cpp
M Source/WebGPU/WGSL/WGSL.h
M Source/WebGPU/WGSL/wgslc.cpp
M Source/WebGPU/WebGPU/Pipeline.mm
M Source/WebGPU/WebGPU/ShaderModule.mm
M Tools/TestWebKitAPI/Tests/WGSL/MetalGenerationTests.cpp

  Log Message:
  ---
  [WebGPU] ShaderModule::createLibrary may produce invalid metal with custom 
layouts
https://bugs.webkit.org/show_bug.cgi?id=268898
rdar://122256850

Reviewed by Mike Wyrzykowski.

The global variable rewriter should return an error when the shader is 
incompatible with
the user-provided layout, in order to avoid generating invalid Metal code.

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::run):
(WGSL::RewriteGlobalVariables::visitEntryPoint):
(WGSL::RewriteGlobalVariables::insertStructs):
(WGSL::rewriteGlobalVariables):
* Source/WebGPU/WGSL/GlobalVariableRewriter.h:
* Source/WebGPU/WGSL/WGSL.cpp:
(WGSL::staticCheck):
(WGSL::prepareImpl):
(WGSL::prepare):
* Source/WebGPU/WGSL/WGSL.h:
* Source/WebGPU/WGSL/wgslc.cpp:
(runWGSL):
* Source/WebGPU/WebGPU/Pipeline.mm:
(WebGPU::createLibrary):
* Source/WebGPU/WebGPU/ShaderModule.mm:
(WebGPU::earlyCompileShaderModule):

Canonical link: https://commits.webkit.org/274365@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 2e6c18: [WGSL] override expressions as array lengths do no...

2024-02-08 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2e6c189562a8c6a3c3bc460f399d45ae801a0bd2
  
https://github.com/WebKit/WebKit/commit/2e6c189562a8c6a3c3bc460f399d45ae801a0bd2
  Author: Tadeu Zagallo 
  Date:   2024-02-08 (Thu, 08 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/CallGraph.cpp
M Source/WebGPU/WGSL/CallGraph.h
A Source/WebGPU/WGSL/CompilationScope.cpp
A Source/WebGPU/WGSL/CompilationScope.h
M Source/WebGPU/WGSL/ConstantFunctions.h
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Source/WebGPU/WGSL/MangleNames.cpp
M Source/WebGPU/WGSL/MangleNames.h
M Source/WebGPU/WGSL/Metal/MetalCodeGenerator.cpp
M Source/WebGPU/WGSL/Metal/MetalCodeGenerator.h
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.h
M Source/WebGPU/WGSL/Overload.cpp
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WGSL/TypeStore.cpp
M Source/WebGPU/WGSL/TypeStore.h
M Source/WebGPU/WGSL/Types.cpp
M Source/WebGPU/WGSL/Types.h
M Source/WebGPU/WGSL/WGSL.cpp
M Source/WebGPU/WGSL/WGSL.h
M Source/WebGPU/WGSL/WGSLShaderModule.h
M Source/WebGPU/WGSL/wgslc.cpp
M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj
M Source/WebGPU/WebGPU/ComputePipeline.mm
M Source/WebGPU/WebGPU/Pipeline.h
M Source/WebGPU/WebGPU/Pipeline.mm
M Source/WebGPU/WebGPU/RenderPipeline.mm
M Source/WebGPU/WebGPU/ShaderModule.mm
M Tools/TestWebKitAPI/Tests/WGSL/MetalGenerationTests.cpp

  Log Message:
  ---
  [WGSL] override expressions as array lengths do not compile
https://bugs.webkit.org/show_bug.cgi?id=268425
rdar://121971104

Reviewed by Mike Wyrzykowski.

Allow overrides to be used as array length. This required a series of changes:
- validating that runtime expressions aren't used in a constant/override context
- breaking the compiler API into 3 parts to expose the necessary information to
  the API so it can feed the constants back to the compiler
- changing the type representation for arrays so it can encode 1) fixed-sized 
arrays,
  2) override-sized arrays and 3) runtime-sized arrays

* Source/WebGPU/WGSL/CallGraph.cpp:
(WGSL::CallGraphBuilder::CallGraphBuilder):
(WGSL::CallGraphBuilder::initializeMappings):
(WGSL::buildCallGraph):
* Source/WebGPU/WGSL/CallGraph.h:
* Source/WebGPU/WGSL/CompilationScope.cpp: Copied from 
Source/WebGPU/WGSL/MangleNames.h.
(WGSL::CompilationScope::CompilationScope):
(WGSL::CompilationScope::~CompilationScope):
* Source/WebGPU/WGSL/CompilationScope.h: Copied from 
Source/WebGPU/WGSL/MangleNames.h.
* Source/WebGPU/WGSL/ConstantFunctions.h:
(WGSL::zeroValue):
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::collectGlobals):
(WGSL::RewriteGlobalVariables::storeInitialValue):
(WGSL::RewriteGlobalVariables::containsRuntimeArray): Deleted.
* Source/WebGPU/WGSL/MangleNames.cpp:
(WGSL::NameManglerVisitor::NameManglerVisitor):
(WGSL::NameManglerVisitor::visit):
(WGSL::mangleNames):
* Source/WebGPU/WGSL/MangleNames.h:
* Source/WebGPU/WGSL/Metal/MetalCodeGenerator.cpp:
(WGSL::Metal::generateMetalCode):
* Source/WebGPU/WGSL/Metal/MetalCodeGenerator.h:
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
(WGSL::Metal::FunctionDefinitionWriter::visitGlobal):
(WGSL::Metal::FunctionDefinitionWriter::visit):
(WGSL::Metal::emitMetalFunctions):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.h:
* Source/WebGPU/WGSL/Overload.cpp:
(WGSL::OverloadResolver::materialize const):
(WGSL::OverloadResolver::unify):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::evaluationToString):
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::visitVariable):
(WGSL::TypeChecker::bitcast):
(WGSL::TypeChecker::chooseOverload):
(WGSL::TypeChecker::infer):
(WGSL::TypeChecker::introduceType):
(WGSL::TypeChecker::introduceValue):
(WGSL::TypeChecker::introduceFunction):
(WGSL::TypeChecker::texelFormat):
(WGSL::TypeChecker::accessMode):
(WGSL::TypeChecker::addressSpace):
* Source/WebGPU/WGSL/TypeStore.cpp:
(WGSL::ArrayKey::encode const):
(WGSL::TypeStore::arrayType):
* Source/WebGPU/WGSL/TypeStore.h:
* Source/WebGPU/WGSL/Types.cpp:
(WGSL::Type::dump const):
(WGSL::Type::size const):
(WGSL::Type::isConstructible const):
(WGSL::Type::isStorable const):
(WGSL::Type::isHostShareable const):
(WGSL::Type::hasFixedFootprint const):
(WGSL::Type::hasCreationFixedFootprint const):
(WGSL::Type::containsRuntimeArray const):
(WGSL::Type::containsOverrideArray const):
* Source/WebGPU/WGSL/Types.h:
(WGSL::Types::Array::isRuntimeSized const):
(WGSL::Types::Array::isCreationFixed const):
(WGSL::Types::Array::isOverrideSized const):
* Source/WebGPU/WGSL/WGSL.cpp:
(WGSL::prepareImpl):
(WGSL::generate):
(WGSL::evaluate):
* Source/WebGPU/WGSL/WGSL.h:
* Source/WebGPU/WGSL/WGSLShaderModule.h:
(WGSL::ShaderModule::Compilation::Compilation): Deleted.
(WGSL::ShaderModule::Compilation::~Compilation): Deleted

[webkit-changes] [WebKit/WebKit] 200045: [WGSL] shader, validation, decl, var:* is failing

2024-02-07 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 200045f29c1b7ecf425cd1dc954c85689ac7f163
  
https://github.com/WebKit/WebKit/commit/200045f29c1b7ecf425cd1dc954c85689ac7f163
  Author: Tadeu Zagallo 
  Date:   2024-02-07 (Wed, 07 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WGSL/Types.cpp
M Source/WebGPU/WGSL/Types.h

  Log Message:
  ---
  [WGSL] shader,validation,decl,var:* is failing
https://bugs.webkit.org/show_bug.cgi?id=268878
rdar://122436149

Reviewed by Mike Wyrzykowski.

Validate the type of variable declarations according to the spec rules[1] based
on the address space and access mode.

[1]: https://www.w3.org/TR/WGSL/#var-and-value

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visitVariable):
* Source/WebGPU/WGSL/Types.cpp:
(WGSL::Type::isStorable const):
(WGSL::Type::isHostShareable const):
(WGSL::Type::hasFixedFootprint const):
* Source/WebGPU/WGSL/Types.h:

Canonical link: https://commits.webkit.org/274243@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] a00fd5: [WGSL] shader, validation, decl, var_access_mode:* is...

2024-02-07 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a00fd580f6e158fd28cde089a3a73ba4f980ce46
  
https://github.com/WebKit/WebKit/commit/a00fd580f6e158fd28cde089a3a73ba4f980ce46
  Author: Tadeu Zagallo 
  Date:   2024-02-07 (Wed, 07 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp

  Log Message:
  ---
  [WGSL] shader,validation,decl,var_access_mode:* is failing
https://bugs.webkit.org/show_bug.cgi?id=268877
rdar://122436006

Reviewed by Mike Wyrzykowski.

Validate against using write-only with the storage address space to pass the 
CTS tests

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visitVariable):

Canonical link: https://commits.webkit.org/274216@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] e6b8fd: [WGSL] shader, validation, decl, ptr_spelling:* is fa...

2024-02-05 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e6b8fd3541abc95135ee9a6a16ab045b53990117
  
https://github.com/WebKit/WebKit/commit/e6b8fd3541abc95135ee9a6a16ab045b53990117
  Author: Tadeu Zagallo 
  Date:   2024-02-05 (Mon, 05 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WGSL/Types.cpp
M Source/WebGPU/WGSL/Types.h

  Log Message:
  ---
  [WGSL] shader,validation,decl,ptr_spelling:* is failing
https://bugs.webkit.org/show_bug.cgi?id=268646
rdar://122197533

Reviewed by Mike Wyrzykowski.

Add the extra validation to ptr types to pass the tests.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::TypeChecker):
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/Types.cpp:
(WGSL::Type::isStorable const):
(WGSL::Type::containsRuntimeArray const):
* Source/WebGPU/WGSL/Types.h:

Canonical link: https://commits.webkit.org/274094@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] caf4df: [WGSL] shader, validation, const_assert, const_assert...

2024-02-05 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: caf4dfc46d78f96ac1960fa9b816a784d4c75c5f
  
https://github.com/WebKit/WebKit/commit/caf4dfc46d78f96ac1960fa9b816a784d4c75c5f
  Author: Tadeu Zagallo 
  Date:   2024-02-05 (Mon, 05 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/AST/AST.h
A Source/WebGPU/WGSL/AST/ASTConstAssert.h
A Source/WebGPU/WGSL/AST/ASTConstAssertStatement.h
M Source/WebGPU/WGSL/AST/ASTForward.h
M Source/WebGPU/WGSL/AST/ASTNode.h
M Source/WebGPU/WGSL/AST/ASTVisitor.cpp
M Source/WebGPU/WGSL/AST/ASTVisitor.h
M Source/WebGPU/WGSL/GlobalSorting.cpp
M Source/WebGPU/WGSL/Parser.cpp
M Source/WebGPU/WGSL/ParserPrivate.h
M Source/WebGPU/WGSL/TypeCheck.cpp
A Source/WebGPU/WGSL/tests/invalid/const-assert.wgsl
A Source/WebGPU/WGSL/tests/valid/const-assert.wgsl
M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj

  Log Message:
  ---
  [WGSL] shader,validation,const_assert,const_assert:* is failing
https://bugs.webkit.org/show_bug.cgi?id=268640
rdar://122194238

Reviewed by Mike Wyrzykowski.

Add support for const_expr statements and top-level declarations.

* Source/WebGPU/WGSL/AST/AST.h:
* Source/WebGPU/WGSL/AST/ASTConstAssert.h: Added.
* Source/WebGPU/WGSL/AST/ASTConstAssertStatement.h: Added.
* Source/WebGPU/WGSL/AST/ASTForward.h:
* Source/WebGPU/WGSL/AST/ASTNode.h:
* Source/WebGPU/WGSL/AST/ASTVisitor.cpp:
(WGSL::AST::Visitor::visit):
* Source/WebGPU/WGSL/AST/ASTVisitor.h:
* Source/WebGPU/WGSL/GlobalSorting.cpp:
(WGSL::Graph::addNode):
(WGSL::Graph::addEdge):
(WGSL::reorder):
* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser::parseDeclaration):
(WGSL::Parser::parseConstAssert):
(WGSL::Parser::parseStatement):
* Source/WebGPU/WGSL/ParserPrivate.h:
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
* Source/WebGPU/WGSL/tests/invalid/const-assert.wgsl: Added.
* Source/WebGPU/WGSL/tests/valid/const-assert.wgsl: Added.
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:

Canonical link: https://commits.webkit.org/274093@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 1cb515: [WGSL] Resources without group or binding attribut...

2024-02-02 Thread Tadeu Zagallo
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1cb51568120b86c17edbf1918a9d7e2d41a5285a
  
https://github.com/WebKit/WebKit/commit/1cb51568120b86c17edbf1918a9d7e2d41a5285a
  Author: Tadeu Zagallo 
  Date:   2024-02-02 (Fri, 02 Feb 2024)

  Changed paths:
M Source/WebGPU/WGSL/AttributeValidator.cpp

  Log Message:
  ---
  [WGSL] Resources without group or binding attributes should be rejected
https://bugs.webkit.org/show_bug.cgi?id=268624
rdar://121527140

Reviewed by Mike Wyrzykowski.

Validate that all resources have @group and @binding attributes.

* Source/WebGPU/WGSL/AttributeValidator.cpp:
(WGSL::AttributeValidator::visit):

Canonical link: https://commits.webkit.org/274000@main


___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


  1   2   3   4   5   6   >