⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 248310 in webkit


Ignore:
Timestamp:
Aug 6, 2019, 1:31:04 PM (7 years ago)
Author:
sbarati@apple.com
Message:

[WHLSL] Remove the auto initialize variables pass
https://bugs.webkit.org/show_bug.cgi?id=200472

Reviewed by Robin Morisset.

From a separation of concerns perspective, it's a bit nicer to make variables
without initializers call their default constructors as a transformation over the AST.
This removes the need for the lowering to need to worry about such things. However,
changing metal lowering to deal with this is trivial. It means we need to change one
line of code in Metal code generation, and we get to remove a ~50 LOC AST pass.
Also, in this case, it saves us from the compile time hit of having to run the
auto initialize variables phase, which takes ~1.2ms on compute_boids.

  • Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:

(WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):

  • Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp: Removed.
  • Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.h: Removed.
  • Modules/webgpu/WHLSL/WHLSLPrepare.cpp:

(WebCore::WHLSL::prepareShared):

  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
Location:
trunk/Source/WebCore
Files:
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r248307 r248310  
     12019-08-06  Saam Barati  <sbarati@apple.com>
     2
     3        [WHLSL] Remove the auto initialize variables pass
     4        https://bugs.webkit.org/show_bug.cgi?id=200472
     5
     6        Reviewed by Robin Morisset.
     7
     8        From a separation of concerns perspective, it's a bit nicer to make variables
     9        without initializers call their default constructors as a transformation over the AST.
     10        This removes the need for the lowering to need to worry about such things. However,
     11        changing metal lowering to deal with this is trivial. It means we need to change one
     12        line of code in Metal code generation, and we get to remove a ~50 LOC AST pass.
     13        Also, in this case, it saves us from the compile time hit of having to run the
     14        auto initialize variables phase, which takes ~1.2ms on compute_boids.
     15
     16        * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
     17        (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
     18        * Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp: Removed.
     19        * Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.h: Removed.
     20        * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
     21        (WebCore::WHLSL::prepareShared):
     22        * Sources.txt:
     23        * WebCore.xcodeproj/project.pbxproj:
     24
    1252019-08-06  Sam Weinig  <weinig@apple.com>
    226
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp

    r248307 r248310  
    552552        m_stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(*variableDeclaration.type()), ' ', variableName, " = ", takeLastValue(), ";\n");
    553553    } else
    554         m_stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(*variableDeclaration.type()), ' ', variableName, ";\n");
     554        m_stringBuilder.flexibleAppend(m_typeNamer.mangledNameForType(*variableDeclaration.type()), ' ', variableName, " = { };\n");
    555555}
    556556
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPrepare.cpp

    r248303 r248310  
    3030
    3131#include "WHLSLASTDumper.h"
    32 #include "WHLSLAutoInitializeVariables.h"
    3332#include "WHLSLCheckDuplicateFunctions.h"
    3433#include "WHLSLCheckTextureReferences.h"
     
    188187    RUN_PASS(checkLiteralTypes, program);
    189188    CHECK_PASS(checkTextureReferences, program);
    190     CHECK_PASS(autoInitializeVariables, program);
    191189    RUN_PASS(resolveProperties, program);
    192190    RUN_PASS(findHighZombies, program);
  • trunk/Source/WebCore/Sources.txt

    r248282 r248310  
    310310Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp
    311311Modules/webgpu/WHLSL/WHLSLASTDumper.cpp
    312 Modules/webgpu/WHLSL/WHLSLAutoInitializeVariables.cpp
    313312Modules/webgpu/WHLSL/WHLSLInferTypes.cpp
    314313Modules/webgpu/WHLSL/WHLSLLexer.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r248303 r248310  
    83258325                52B0D4BF1C57FD660077CE53 /* VideoFullscreenChangeObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenChangeObserver.h; sourceTree = "<group>"; };
    83268326                52B0D4C11C57FF910077CE53 /* VideoFullscreenInterfaceMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenInterfaceMac.h; sourceTree = "<group>"; };
    8327                 52B3434922A0752200E49389 /* WHLSLAutoInitializeVariables.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLAutoInitializeVariables.h; sourceTree = "<group>"; };
    8328                 52B3434B22A0752300E49389 /* WHLSLAutoInitializeVariables.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLAutoInitializeVariables.cpp; sourceTree = "<group>"; };
    83298327                52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoFullscreenLayerManagerObjC.mm; sourceTree = "<group>"; };
    83308328                52D5A18E1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenLayerManagerObjC.h; sourceTree = "<group>"; };
     
    2549725495                                C20F88AA22966B0E00D610FA /* WHLSLASTDumper.cpp */,
    2549825496                                C20F88AC22966B0F00D610FA /* WHLSLASTDumper.h */,
    25499                                 52B3434B22A0752300E49389 /* WHLSLAutoInitializeVariables.cpp */,
    25500                                 52B3434922A0752200E49389 /* WHLSLAutoInitializeVariables.h */,
    2550125497                                1C6B95DD22C858A400E6F14F /* WHLSLBuildStandardLibraryFunctionMap.py */,
    2550225498                                C234A9B221E92C1F003C984D /* WHLSLCheckDuplicateFunctions.cpp */,
Note: See TracChangeset for help on using the changeset viewer.