Changeset 246625 in webkit
- Timestamp:
- Jun 19, 2019 7:05:28 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r246621 r246625 1 2019-06-19 Saam Barati <sbarati@apple.com> 2 3 [WHLSL] The checker needs to resolve types for the anonymous variables in ReadModifyWrite expressions 4 https://bugs.webkit.org/show_bug.cgi?id=198988 5 6 Reviewed by Dean Jackson and Myles C. Maxfield. 7 8 * webgpu/whlsl-checker-should-set-type-of-read-modify-write-variables-expected.txt: Added. 9 * webgpu/whlsl-checker-should-set-type-of-read-modify-write-variables.html: Added. 10 1 11 2019-06-19 Nikita Vasilyev <nvasilyev@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r246616 r246625 1 2019-06-19 Saam Barati <sbarati@apple.com> 2 3 [WHLSL] The checker needs to resolve types for the anonymous variables in ReadModifyWrite expressions 4 https://bugs.webkit.org/show_bug.cgi?id=198988 5 6 Reviewed by Dean Jackson and Myles C. Maxfield. 7 8 This patch makes it so that the Checker assigns types to the internal variables 9 in a read modify write expression. These were the only variables that didn't have 10 types ascribed to them. 11 12 This patch also does a fly by fix where we kept pointers to value types 13 in a HashMap in the checker. This is wrong precisely when the HashMap gets 14 resized. Instead, we now just store the value itself since we're just 15 dealing with a simple Variant that wraps either an empty struct or an 16 enum. 17 18 Test: webgpu/whlsl-checker-should-set-type-of-read-modify-write-variables.html 19 20 * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h: 21 (WebCore::WHLSL::AST::VariableDeclaration::setType): 22 (WebCore::WHLSL::AST::VariableDeclaration::type const): 23 * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp: Make it obvious that read 24 modify write expressions are such by prefixing them with "RMW". 25 (WebCore::WHLSL::ASTDumper::visit): 26 * Modules/webgpu/WHLSL/WHLSLChecker.cpp: 27 (WebCore::WHLSL::Checker::visit): 28 1 29 2019-06-19 Devin Rousso <drousso@apple.com> 2 30 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h
r246273 r246625 65 65 String& name() { return m_name; } 66 66 67 const Optional<UniqueRef<UnnamedType>>& type() const { return m_type; } // Anonymous variables inside ReadModifyWriteExpressions have their type set by the type checker. 67 // We use this for ReadModifyWrite expressions, since we don't know the type of their 68 // internal variables until the checker runs. All other variables should start life out 69 // with a type. 70 void setType(UniqueRef<UnnamedType> type) 71 { 72 ASSERT(!m_type); 73 m_type = WTFMove(type); 74 } 75 const Optional<UniqueRef<UnnamedType>>& type() const { return m_type; } 68 76 UnnamedType* type() { return m_type ? &*m_type : nullptr; } 69 77 Optional<Semantic>& semantic() { return m_semantic; } -
trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLASTDumper.cpp
r246121 r246625 640 640 auto newVariable = readModifyWriteExpression.newVariableReference(); 641 641 642 m_out.print(" (");642 m_out.print("RMW("); 643 643 visit(oldVariable.get()); 644 644 m_out.print(" = "); -
trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp
r246579 r246625 464 464 struct RecurseInfo { 465 465 ResolvingType& resolvingType; 466 AST::TypeAnnotation&typeAnnotation;466 const AST::TypeAnnotation typeAnnotation; 467 467 }; 468 468 Optional<RecurseInfo> recurseAndGetInfo(AST::Expression&, bool requiresLeftValue = false); … … 860 860 return; 861 861 862 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=198166 Figure out what to do with the ReadModifyWriteExpression's AnonymousVariables.862 readModifyWriteExpression.oldValue().setType(leftValueInfo->resolvingType.getUnnamedType()->clone()); 863 863 864 864 auto newValueInfo = recurseAndGetInfo(readModifyWriteExpression.newValueExpression()); … … 866 866 return; 867 867 868 if (!matchAndCommit(leftValueInfo->resolvingType, newValueInfo->resolvingType)) { 868 if (Optional<UniqueRef<AST::UnnamedType>> matchedType = matchAndCommit(leftValueInfo->resolvingType, newValueInfo->resolvingType)) 869 readModifyWriteExpression.newValue().setType(WTFMove(matchedType.value())); 870 else { 869 871 setError(); 870 872 return; … … 1132 1134 1133 1135 AST::TypeAnnotation typeAnnotation = AST::RightValue(); 1134 if (!variableReference.variable()->isAnonymous()) // FIXME: https://bugs.webkit.org/show_bug.cgi?id=198166 This doesn't seem right. 1135 typeAnnotation = AST::LeftValue { AST::AddressSpace::Thread }; 1136 typeAnnotation = AST::LeftValue { AST::AddressSpace::Thread }; 1136 1137 assignType(variableReference, variableReference.variable()->type()->clone(), WTFMove(typeAnnotation)); 1137 1138 }
Note: See TracChangeset
for help on using the changeset viewer.