WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
201251
[WHLSL] Add back a version of the property resolver
https://bugs.webkit.org/show_bug.cgi?id=201251
Summary
[WHLSL] Add back a version of the property resolver
Saam Barati
Reported
2019-08-28 16:53:09 PDT
The goal will be to: - make each property access's base effect free so metal codegen can emit - make the leftmost base of RMW effect free so we can emit the "leftValue()" twice
Attachments
WIP
(9.21 KB, patch)
2019-09-05 14:23 PDT
,
Saam Barati
no flags
Details
Formatted Diff
Diff
WIP
(16.76 KB, patch)
2019-09-05 17:49 PDT
,
Saam Barati
no flags
Details
Formatted Diff
Diff
WIP
(22.13 KB, patch)
2019-09-05 18:59 PDT
,
Saam Barati
no flags
Details
Formatted Diff
Diff
patch
(29.32 KB, patch)
2019-09-06 16:30 PDT
,
Saam Barati
rmorisset
: review+
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Saam Barati
Comment 1
2019-08-28 17:33:18 PDT
and add back all the property resolver tests that make sense in this new world
Saam Barati
Comment 2
2019-08-30 14:10:43 PDT
also we'll want the "high zombie finder" to have some new rules
Saam Barati
Comment 3
2019-09-05 14:23:14 PDT
Created
attachment 378121
[details]
WIP it begins
Saam Barati
Comment 4
2019-09-05 17:49:44 PDT
Created
attachment 378142
[details]
WIP it seems to work.
Saam Barati
Comment 5
2019-09-05 18:59:57 PDT
Created
attachment 378151
[details]
WIP I think it's done, I just want to write some more tests
Saam Barati
Comment 6
2019-09-06 16:30:01 PDT
Created
attachment 378251
[details]
patch
Robin Morisset
Comment 7
2019-09-06 17:21:23 PDT
Comment on
attachment 378251
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=378251&action=review
r=me
> Source/WebCore/ChangeLog:9 > + The goal of the new property resolver phase is two allow two things:
two allow => to allow
> Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:90 > + while (true) {
This pattern of ``` while(true) { .. chain.append(current); if (is<AST::PropertyAccessExpression>(current.base())) continue; Tons of code that only executes once break; } ``` is not super readable. It is probably not worth modifying now, but I am curious, why not just use the loop to accumulate the chain: ``` while (is<AST::PropertyAccessExpression>(current.base())) { append to chain current = *currentPtr; } tons of code that manipulate current but are now outside of the loop ```
> Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:245 > + RELEASE_ASSERT(m_variables.isEmpty());
There is no guarantee that the WTFMove later on will empty-out m_variables. I think you need to either empty it by hand, or more simply to construct a different PropertyResolver for each function definition in resolveProperties.
> Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:63 > + ReadModifyWriteExpression(CodeLocation location, UniqueRef<Expression> leftValue, UniqueRef<VariableDeclaration> oldValue, UniqueRef<VariableDeclaration> newValue)
I am unclear on whether it is better to pass UniqueRef<Expression> or UniqueRef<Expression>&& here.
Saam Barati
Comment 8
2019-09-08 20:12:17 PDT
Comment on
attachment 378251
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=378251&action=review
>> Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:90 >> + while (true) { > > This pattern of > ``` > while(true) { > .. > chain.append(current); > if (is<AST::PropertyAccessExpression>(current.base())) > continue; > Tons of code that only executes once > break; > } > ``` > is not super readable. It is probably not worth modifying now, but I am curious, why not just use the loop to accumulate the chain: > ``` > while (is<AST::PropertyAccessExpression>(current.base())) { > append to chain > current = *currentPtr; > } > tons of code that manipulate current but are now outside of the loop > ```
fixed.
>> Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:245 >> + RELEASE_ASSERT(m_variables.isEmpty()); > > There is no guarantee that the WTFMove later on will empty-out m_variables. > I think you need to either empty it by hand, or more simply to construct a different PropertyResolver for each function definition in resolveProperties.
that's how move constructor of Vector works. It swaps with empty vector, so it should be emptied out.
>> Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:63 >> + ReadModifyWriteExpression(CodeLocation location, UniqueRef<Expression> leftValue, UniqueRef<VariableDeclaration> oldValue, UniqueRef<VariableDeclaration> newValue) > > I am unclear on whether it is better to pass UniqueRef<Expression> or UniqueRef<Expression>&& here.
I prefer what I did here since it expressed the fact that this function now has ownership over the UniqueRef. I'm not a fan of passing around rvalue refs since it doesn't actually guarantee that ownership will be transferred.
Saam Barati
Comment 9
2019-09-08 20:23:50 PDT
thanks for the review. Landed in:
https://trac.webkit.org/changeset/249630/webkit
Saam Barati
Comment 10
2019-09-09 13:55:10 PDT
landed watchOS build fix in:
https://trac.webkit.org/changeset/249664/webkit
Radar WebKit Bug Importer
Comment 11
2019-09-09 13:56:19 PDT
<
rdar://problem/55196672
>
Robin Morisset
Comment 12
2019-09-13 16:29:50 PDT
This patch turns out to create comma expressions on the left-side of assignments. It is not something which could otherwise happen. Do we want to support it, or to change this pass?
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug