Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1dbcd409197bfeda0417246083637b13f77e4f13
https://github.com/WebKit/WebKit/commit/1dbcd409197bfeda0417246083637b13f77e4f13
Author: Kimmo Kinnunen <[email protected]>
Date: 2025-06-06 (Fri, 06 Jun 2025)
Changed paths:
M Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj
M Source/ThirdParty/ANGLE/WebKit/TranslatorFuzzerSupport.h
M Source/ThirdParty/ANGLE/changes.diff
M Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h
M Source/ThirdParty/ANGLE/include/platform/autogen/FeaturesMtl_autogen.h
M Source/ThirdParty/ANGLE/include/platform/mtl_features.json
M
Source/ThirdParty/ANGLE/scripts/code_generation_hashes/Static_builtins.json
M Source/ThirdParty/ANGLE/src/compiler.gni
M Source/ThirdParty/ANGLE/src/compiler/fuzz/translator_fuzzer.cpp
M Source/ThirdParty/ANGLE/src/compiler/translator/Compiler.cpp
M
Source/ThirdParty/ANGLE/src/compiler/translator/ImmutableString_autogen.cpp
M Source/ThirdParty/ANGLE/src/compiler/translator/Operator_autogen.h
M Source/ThirdParty/ANGLE/src/compiler/translator/SymbolTable_autogen.cpp
M
Source/ThirdParty/ANGLE/src/compiler/translator/builtin_function_declarations.txt
M Source/ThirdParty/ANGLE/src/compiler/translator/msl/EmitMetal.cpp
M Source/ThirdParty/ANGLE/src/compiler/translator/msl/ProgramPrelude.cpp
A
Source/ThirdParty/ANGLE/src/compiler/translator/tree_ops/msl/EnsureLoopForwardProgress.cpp
A
Source/ThirdParty/ANGLE/src/compiler/translator/tree_ops/msl/EnsureLoopForwardProgress.h
M
Source/ThirdParty/ANGLE/src/compiler/translator/tree_util/BuiltIn_autogen.h
M Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm
M Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ShaderMtl.mm
M Source/ThirdParty/ANGLE/src/tests/angle_unittests.gni
A
Source/ThirdParty/ANGLE/src/tests/compiler_tests/EnsureLoopForwardProgress_test.cpp
M
Source/ThirdParty/ANGLE/src/tests/compiler_tests/ImmutableString_test_autogen.cpp
M Source/ThirdParty/ANGLE/src/tests/compiler_tests/MSLOutput_test.cpp
M Source/ThirdParty/ANGLE/src/tests/compiler_tests/Parse_test.cpp
M Source/ThirdParty/ANGLE/src/tests/gl_tests/GLSLTest.cpp
M Source/ThirdParty/ANGLE/src/tests/gl_tests/TimeoutDrawTest.cpp
M Source/ThirdParty/ANGLE/util/autogen/angle_features_autogen.cpp
M Source/ThirdParty/ANGLE/util/autogen/angle_features_autogen.h
M Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm
Log Message:
-----------
ANGLE: Metal: Allow optimization of simple loops
https://bugs.webkit.org/show_bug.cgi?id=294109
rdar://141993099
Reviewed by Mike Wyrzykowski.
Reimplement the feature to avoid undefined behavior of infinite loops.
Add EnsureLoopForwardProgress rewrite pass that inserts a volatile
variable access to all loops that it cannot analyze as being finite.
Detect loops of form `for (; i <op> x; ++i)` as being finite.
The <op> can be any of <,<=,>,>=,==, != operator.
The i can be int or uint.
The ++i can be -- or ++, -=1, +=1.
This assumes that backends using the feature emit signed int arithmetic
with defined wraparound semantics.
Uses volatile write instead of asm("") due to asm not forcing the
behavior in some compiler versions. The volatile variable access is
defined in C++ as forward progress, and by inheritance this works in
MSL.
Later commits may remove injectAsmStatementIntoLoopBodies if
ensureLoopForwardProgress is appropriate for all use-cases.
* Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj:
* Source/ThirdParty/ANGLE/WebKit/TranslatorFuzzerSupport.h:
* Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h:
* Source/ThirdParty/ANGLE/include/platform/autogen/FeaturesMtl_autogen.h:
* Source/ThirdParty/ANGLE/include/platform/mtl_features.json:
* Source/ThirdParty/ANGLE/scripts/code_generation_hashes/Static_builtins.json:
* Source/ThirdParty/ANGLE/src/compiler.gni:
* Source/ThirdParty/ANGLE/src/compiler/fuzz/translator_fuzzer.cpp:
(LLVMFuzzerTestOneInput):
* Source/ThirdParty/ANGLE/src/compiler/translator/Compiler.cpp:
(sh::TCompiler::checkAndSimplifyAST):
* Source/ThirdParty/ANGLE/src/compiler/translator/ImmutableString_autogen.cpp:
* Source/ThirdParty/ANGLE/src/compiler/translator/Operator_autogen.h:
* Source/ThirdParty/ANGLE/src/compiler/translator/SymbolTable_autogen.cpp:
(sh::Func::loopForwardProgress_):
(sh::TSymbolTable::findBuiltIn const):
(sh::TSymbolTable::isUnmangledBuiltInName const):
*
Source/ThirdParty/ANGLE/src/compiler/translator/builtin_function_declarations.txt:
* Source/ThirdParty/ANGLE/src/compiler/translator/msl/EmitMetal.cpp:
(GetOperatorString):
* Source/ThirdParty/ANGLE/src/compiler/translator/msl/ProgramPrelude.cpp:
*
Source/ThirdParty/ANGLE/src/compiler/translator/tree_ops/msl/EnsureLoopForwardProgress.cpp:
Added.
(sh::EnsureLoopForwardProgress):
*
Source/ThirdParty/ANGLE/src/compiler/translator/tree_ops/msl/EnsureLoopForwardProgress.h:
Added.
(sh::EnsureLoopForwardProgress):
* Source/ThirdParty/ANGLE/src/compiler/translator/tree_util/BuiltIn_autogen.h:
* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm:
(rx::DisplayMtl::initializeFeatures):
* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ShaderMtl.mm:
(rx::ShaderMtl::compile):
* Source/ThirdParty/ANGLE/src/tests/angle_unittests.gni:
*
Source/ThirdParty/ANGLE/src/tests/compiler_tests/EnsureLoopForwardProgress_test.cpp:
Added.
*
Source/ThirdParty/ANGLE/src/tests/compiler_tests/ImmutableString_test_autogen.cpp:
(sh::TEST(ImmutableStringTest, ScriptGeneratedHashesMatch)):
* Source/ThirdParty/ANGLE/src/tests/compiler_tests/MSLOutput_test.cpp:
((MSLOutputTest, EnsureLoopForwardProgressInfinite)):
((MSLOutputTest, EnsureLoopForwardProgressFinite)):
* Source/ThirdParty/ANGLE/src/tests/compiler_tests/Parse_test.cpp:
* Source/ThirdParty/ANGLE/src/tests/gl_tests/GLSLTest.cpp:
* Source/ThirdParty/ANGLE/src/tests/gl_tests/TimeoutDrawTest.cpp:
(angle::TimeoutDrawTest::TimeoutDrawTest): Deleted.
(): Deleted.
(angle::TEST_P): Deleted.
* Source/ThirdParty/ANGLE/util/autogen/angle_features_autogen.cpp:
* Source/ThirdParty/ANGLE/util/autogen/angle_features_autogen.h:
* Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm:
(WebCore::initializeEGLDisplay):
Canonical link: https://commits.webkit.org/295932@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