Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9af7ee6fac32f75aa909bb9ef3a69478da926a3d
https://github.com/WebKit/WebKit/commit/9af7ee6fac32f75aa909bb9ef3a69478da926a3d
Author: Tadeu Zagallo <[email protected]>
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/WebGPU/WebGPU/Pipeline.mm:
(WebGPU::createLibrary):
* Source/WebGPU/WebGPU/ShaderModule.mm:
(WebGPU::earlyCompileShaderModule):
Canonical link: https://commits.webkit.org/275826@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes