[webkit-changes] [WebKit/WebKit] 51a39e: [WGSL] Add validation to integer division during c...

Tadeu Zagallo noreply at github.com
Fri Nov 3 09:10:07 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 51a39e9c35c5c1e2105bcfa29662c294f012f99b
      https://github.com/WebKit/WebKit/commit/51a39e9c35c5c1e2105bcfa29662c294f012f99b
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-11-03 (Fri, 03 Nov 2023)

  Changed paths:
    M Source/WebGPU/WGSL/ConstantFunctions.h
    M Source/WebGPU/WGSL/ConstantValue.cpp
    M Source/WebGPU/WGSL/Overload.h
    M Source/WebGPU/WGSL/TypeCheck.cpp
    A Source/WebGPU/WGSL/tests/invalid/division.wgsl

  Log Message:
  -----------
  [WGSL] Add validation to integer division during constant evaluation
https://bugs.webkit.org/show_bug.cgi?id=264107
rdar://117865966

Reviewed by Mike Wyrzykowski.

Similar to PR#19898, but for constant evaluation. The patch is bigger since it
required changing the signature of all constant functions to reflect the fact
that the constant functions can fail, but the actual division validation is rather
straightforward. The test case still has a couple FIXMEs, which aren't too
complicated but will be implemented in separated PRs since this one was largely
a mechanical refactor.

* Source/WebGPU/WGSL/ConstantFunctions.h:
(WGSL::constantUnaryOperation):
(WGSL::constantBinaryOperation):
(WGSL::constantTernaryOperation):
(WGSL::scalarOrVector):
(WGSL::CONSTANT_FUNCTION):
(WGSL::BINARY_OPERATION):
(WGSL::containsZero):
(WGSL::constantAdd): Deleted.
(WGSL::constantMinus): Deleted.
(WGSL::constantMultiply): Deleted.
(WGSL::constantBitwiseOr): Deleted.
(WGSL::constantBitwiseAnd): Deleted.
(WGSL::constantBitwiseShiftLeft): Deleted.
(WGSL::constantBitwiseShiftRight): Deleted.
(WGSL::constantVec2): Deleted.
(WGSL::constantVec3): Deleted.
(WGSL::constantVec4): Deleted.
(WGSL::constantAll): Deleted.
(WGSL::constantAny): Deleted.
(WGSL::constantSelect): Deleted.
(WGSL::constantCross): Deleted.
(WGSL::constantDeterminant): Deleted.
(WGSL::constantDistance): Deleted.
(WGSL::constantDot): Deleted.
(WGSL::constantLength): Deleted.
(WGSL::constantExtractBits): Deleted.
(WGSL::constantFaceForward): Deleted.
(WGSL::constantFma): Deleted.
(WGSL::constantFract): Deleted.
(WGSL::constantFrexp): Deleted.
(WGSL::constantInsertBits): Deleted.
(WGSL::constantLdexp): Deleted.
(WGSL::constantModf): Deleted.
(WGSL::constantNormalize): Deleted.
(WGSL::constantQuantizeToF16): Deleted.
(WGSL::constantReflect): Deleted.
(WGSL::constantRefract): Deleted.
(WGSL::constantTranspose): Deleted.
* Source/WebGPU/WGSL/ConstantValue.cpp:
(WGSL::ConstantValue::dump const):
* Source/WebGPU/WGSL/Overload.h:
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::chooseOverload):
(WGSL::TypeChecker::convertValue):
* Source/WebGPU/WGSL/tests/invalid/division.wgsl: Added.

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




More information about the webkit-changes mailing list