WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
200352
[WHLSL] Do simple nullptr check elimination using basic data flow analysis when generating metal code
https://bugs.webkit.org/show_bug.cgi?id=200352
Summary
[WHLSL] Do simple nullptr check elimination using basic data flow analysis wh...
Saam Barati
Reported
2019-08-01 10:54:37 PDT
...
Attachments
patch
(9.58 KB, patch)
2019-08-01 13:31 PDT
,
Saam Barati
mmaxfield
: review+
Details
Formatted Diff
Diff
patch for landing
(9.90 KB, patch)
2019-08-01 15:32 PDT
,
Saam Barati
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Saam Barati
Comment 1
2019-08-01 13:31:57 PDT
Created
attachment 375341
[details]
patch
EWS Watchlist
Comment 2
2019-08-01 13:33:36 PDT
Attachment 375341
[details]
did not pass style-queue: ERROR: Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:562: Extra space before [. [whitespace/brackets] [5] ERROR: Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:564: Extra space before [. [whitespace/brackets] [5] ERROR: Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:607: Extra space before [. [whitespace/brackets] [5] ERROR: Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:681: Extra space before [. [whitespace/brackets] [5] Total errors found: 4 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
Robin Morisset
Comment 3
2019-08-01 14:27:49 PDT
Comment on
attachment 375341
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=375341&action=review
LGTM overall, just a couple questions inline
> Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:175 > + void appendRightValueWithNullability(AST::Expression&, String value, Nullability nullability)
Is there a reason to make it a separate function instead of just adding an optional parameter "Nullability nullability = Nullability::CanBeNull" to appendRightValue?
> Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:562 > + auto [pointerName, nullability] = takeLastLeftValue();
This is a very sweet syntax, but it seems only allowed in C++17. Have we officially given up support of C++14?
Myles C. Maxfield
Comment 4
2019-08-01 14:37:18 PDT
Comment on
attachment 375341
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=375341&action=review
> Source/WebCore/ChangeLog:9 > + When doing metal code generation, we frequently know whether something > + is null or not. This patch does a basic propagation of this information
Sorry for being dumb, but do you think you could provide an example?
> Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:196 > + std::pair<String, Nullability> takeLastValueAndNullability()
Adding this stuff into a pair seems yucky. I expect in the future we'll be adding more and more data here. Do you think it would be better design to put this into a struct? Or just use StackItem directly?
> Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:668 > + auto lValue = takeLastLeftValue().first;
Again, a struct type would be a better design here. Unclear what "first" means.
Saam Barati
Comment 5
2019-08-01 15:01:20 PDT
Comment on
attachment 375341
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=375341&action=review
>> Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:175 >> + void appendRightValueWithNullability(AST::Expression&, String value, Nullability nullability) > > Is there a reason to make it a separate function instead of just adding an optional parameter "Nullability nullability = Nullability::CanBeNull" to appendRightValue?
I originally did it in the same function. I moved to separate function for grep-ability of it. I don't have a strong preference.
>> Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:196 >> + std::pair<String, Nullability> takeLastValueAndNullability() > > Adding this stuff into a pair seems yucky. I expect in the future we'll be adding more and more data here. Do you think it would be better design to put this into a struct? Or just use StackItem directly?
I'll make a struct.
>> Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:562 >> + auto [pointerName, nullability] = takeLastLeftValue(); > > This is a very sweet syntax, but it seems only allowed in C++17. Have we officially given up support of C++14?
Yeah :-)
Saam Barati
Comment 6
2019-08-01 15:08:59 PDT
Comment on
attachment 375341
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=375341&action=review
>> Source/WebCore/ChangeLog:9 >> + is null or not. This patch does a basic propagation of this information > > Sorry for being dumb, but do you think you could provide an example?
will add an example.
Saam Barati
Comment 7
2019-08-01 15:32:23 PDT
Created
attachment 375358
[details]
patch for landing
WebKit Commit Bot
Comment 8
2019-08-01 16:13:43 PDT
Comment on
attachment 375358
[details]
patch for landing Clearing flags on attachment: 375358 Committed
r248141
: <
https://trac.webkit.org/changeset/248141
>
WebKit Commit Bot
Comment 9
2019-08-01 16:13:45 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 10
2019-08-01 16:14:23 PDT
<
rdar://problem/53837824
>
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