RESOLVED FIXED Bug 198399
[WHLSL] Educate the property resolver about IndexExpressions
https://bugs.webkit.org/show_bug.cgi?id=198399
Summary [WHLSL] Educate the property resolver about IndexExpressions
Myles C. Maxfield
Reported 2019-05-30 17:23:06 PDT
[WHLSL] Educate the property resolver about IndexExpressions
Attachments
WIP (49.61 KB, patch)
2019-05-30 17:23 PDT, Myles C. Maxfield
no flags
WIP (49.63 KB, patch)
2019-05-30 17:27 PDT, Myles C. Maxfield
no flags
WIP (157.68 KB, patch)
2019-05-31 00:00 PDT, Myles C. Maxfield
no flags
WIP (104.88 KB, patch)
2019-05-31 18:53 PDT, Myles C. Maxfield
no flags
indexer-ander-abstract-lvalue crashes (124.01 KB, patch)
2019-05-31 23:59 PDT, Myles C. Maxfield
no flags
WIP (130.99 KB, patch)
2019-06-01 23:38 PDT, Myles C. Maxfield
no flags
Patch (165.12 KB, patch)
2019-06-02 00:54 PDT, Myles C. Maxfield
saam: review+
Try again (164.69 KB, patch)
2019-06-11 11:12 PDT, Myles C. Maxfield
ews-watchlist: commit-queue-
Archive of layout-test-results from ews114 for mac-highsierra (3.01 MB, application/zip)
2019-06-11 13:18 PDT, EWS Watchlist
no flags
Myles C. Maxfield
Comment 1 2019-05-30 17:23:54 PDT
Myles C. Maxfield
Comment 2 2019-05-30 17:27:00 PDT
Myles C. Maxfield
Comment 3 2019-05-30 17:29:13 PDT
Comment on attachment 371003 [details] WIP View in context: https://bugs.webkit.org/attachment.cgi?id=371003&action=review > Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:782 > + if (additionalArgument) Instead of an additional argument, we can just downcast and call takeIndex() here instead.
Myles C. Maxfield
Comment 4 2019-05-31 00:00:49 PDT
Myles C. Maxfield
Comment 5 2019-05-31 18:53:27 PDT
Myles C. Maxfield
Comment 6 2019-05-31 23:59:41 PDT
Created attachment 371110 [details] indexer-ander-abstract-lvalue crashes
Myles C. Maxfield
Comment 7 2019-06-01 23:38:13 PDT
Myles C. Maxfield
Comment 8 2019-06-02 00:54:17 PDT
Saam Barati
Comment 9 2019-06-03 09:50:26 PDT
Comment on attachment 371139 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=371139&action=review r=me. Awesome! Just a couple nits below. > Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:56 > + bool isReferenceType() const override { return true; } 👍🏼 > Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp:358 > + argumentTypes.append((*functionDefinition.parameters()[i]->type())->clone()); 👍🏼 > Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:98 > + auto variableReference = makeUniqueRef<AST::VariableReference>(AST::VariableReference::wrap(*indexVariable)); > + ASSERT(indexVariable->type()); > + variableReference->setType(indexVariable->type()->clone()); > + variableReference->setTypeAnnotation(AST::LeftValue { AST::AddressSpace::Thread }); // FIXME: https://bugs.webkit.org/show_bug.cgi?id=198169 Is this right? > + arguments.append(WTFMove(variableReference)); nit: You do this both along the "relevantAnder" path and the "!relevantAnder" path. Maybe you can move it above the "if" > Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:154 > + auto variableReference = makeUniqueRef<AST::VariableReference>(AST::VariableReference::wrap(*indexVariable)); > + ASSERT(indexVariable->type()); > + variableReference->setType(indexVariable->type()->clone()); > + variableReference->setTypeAnnotation(AST::LeftValue { AST::AddressSpace::Thread }); // FIXME: https://bugs.webkit.org/show_bug.cgi?id=198169 Is this right? > + arguments.append(WTFMove(variableReference)); nit: ditto > Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:247 > + intermediateVariables.uncheckedAppend(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(propertyAccessExpression.origin()), AST::Qualifiers(), propertyAccessExpression.resolvedType().clone(), String(), WTF::nullopt, WTF::nullopt)); nit: You no longer need to wrap calls to origin() in copy constructor, since AST::Value::origin() returns Lexer::Token. This nit applies to a bunch of other places in this patch too. > Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:259 > + // However, if we did this, we would have to run foo() twice, which would be incorrect. > + // Instead, we need to save foo() and b into more temporary variables. > + // These temporary variables are parallel to "chain" above, with nullopt referring to a DotExpression (which doesn't have an index value to save to a variable). nit: maybe just for super-duper clarity, write out what the above will turn into w/ temps? (I know you do this in the changelog, but might also be nice to have here since you say above what *it should not* be.) > Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:333 > + auto appendIndexAssignment = [&](AST::PropertyAccessExpression& propertyAccessExpression, Optional<UniqueRef<AST::VariableDeclaration>>& indexVariable) { nit: "const Optional<UniqueRef<AST::VariableDeclaration>>&" instead of "Optional<UniqueRef<AST::VariableDeclaration>>&"?
Myles C. Maxfield
Comment 10 2019-06-05 12:18:39 PDT
Comment on attachment 371139 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=371139&action=review >> Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:247 >> + intermediateVariables.uncheckedAppend(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(propertyAccessExpression.origin()), AST::Qualifiers(), propertyAccessExpression.resolvedType().clone(), String(), WTF::nullopt, WTF::nullopt)); > > nit: You no longer need to wrap calls to origin() in copy constructor, since AST::Value::origin() returns Lexer::Token. This nit applies to a bunch of other places in this patch too. Good idea, but doing this consistently would pollute this patch. I'll do it in a follow-up. >> Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:333 >> + auto appendIndexAssignment = [&](AST::PropertyAccessExpression& propertyAccessExpression, Optional<UniqueRef<AST::VariableDeclaration>>& indexVariable) { > > nit: "const Optional<UniqueRef<AST::VariableDeclaration>>&" instead of "Optional<UniqueRef<AST::VariableDeclaration>>&"? We take the index expression from it, so it gets mutated.
Myles C. Maxfield
Comment 11 2019-06-05 19:17:24 PDT
Radar WebKit Bug Importer
Comment 12 2019-06-05 19:18:21 PDT
Truitt Savell
Comment 13 2019-06-07 17:04:02 PDT
Reverted r246138 for reason: Broke internal builds Committed r246225: <https://trac.webkit.org/changeset/246225>
Myles C. Maxfield
Comment 14 2019-06-11 11:12:17 PDT
Created attachment 371857 [details] Try again
EWS Watchlist
Comment 15 2019-06-11 13:18:19 PDT
Comment on attachment 371857 [details] Try again Attachment 371857 [details] did not pass mac-debug-ews (mac): Output: https://webkit-queues.webkit.org/results/12445966 New failing tests: compositing/repaint/scroller-with-foreground-layer-repaints.html
EWS Watchlist
Comment 16 2019-06-11 13:18:21 PDT
Created attachment 371872 [details] Archive of layout-test-results from ews114 for mac-highsierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews114 Port: mac-highsierra Platform: Mac OS X 10.13.6
Myles C. Maxfield
Comment 17 2019-06-12 15:59:45 PDT
Myles C. Maxfield
Comment 18 2019-06-12 20:44:30 PDT
Note You need to log in before you can comment on or make changes to this bug.