Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information