[webkit-changes] [WebKit/WebKit] dc9dac: [WGSL] Add scaffolding for the type checker

Tadeu Zagallo noreply at github.com
Thu Feb 2 05:57:35 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dc9dac69fd36796e1cd101057c90b12a068ad720
      https://github.com/WebKit/WebKit/commit/dc9dac69fd36796e1cd101057c90b12a068ad720
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-02-02 (Thu, 02 Feb 2023)

  Changed paths:
    M Source/WebGPU/WGSL/ContextProvider.h
    M Source/WebGPU/WGSL/ContextProviderInlines.h
    A Source/WebGPU/WGSL/TypeCheck.cpp
    A Source/WebGPU/WGSL/TypeCheck.h
    M Source/WebGPU/WGSL/WGSL.cpp
    M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj

  Log Message:
  -----------
  [WGSL] Add scaffolding for the type checker
https://bugs.webkit.org/show_bug.cgi?id=251524
<rdar://problem/104921530>

Reviewed by Myles C. Maxfield.

Start working on the type checker. For now I added most of the structure I had
in mind, but didn't really find a clear stopping point, so there are a couple
hacks to keep the compiler happy, but I didn't want the PR to get too large.

So far, I added the core pieces for the inference algorithm, and the visitors for
all the nodes we should need to get the hello-compute shader working, but the actual
implementation will be added in a follow up PR.

* Source/WebGPU/WGSL/ContextProvider.h:
* Source/WebGPU/WGSL/ContextProviderInlines.h:
(WGSL::ContextProvider<Value>::Context::add):
(WGSL::ContextProvider<Value>::introduceVariable const):
* Source/WebGPU/WGSL/TypeCheck.cpp: Added.
(WGSL::TypeChecker::TypeChecker):
(WGSL::UnificationContext::UnificationContext):
(WGSL::UnificationContext::~UnificationContext):
(WGSL::UnificationContext::unify):
(WGSL::UnificationContext::substitute):
(WGSL::UnificationContext::solveConstraints):
(WGSL::UnificationContext::runSubstitutions):
(WGSL::TypeChecker::check):
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::infer):
(WGSL::TypeChecker::variable):
(WGSL::TypeChecker::resolve):
(WGSL::TypeChecker::inferred):
(WGSL::TypeChecker::unify):
(WGSL::TypeChecker::substitute):
(WGSL::typeCheck):
* Source/WebGPU/WGSL/TypeCheck.h: Copied from Source/WebGPU/WGSL/ContextProvider.h.
* Source/WebGPU/WGSL/WGSL.cpp:
(WGSL::prepare):
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:

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




More information about the webkit-changes mailing list