RESOLVED FIXED Bug 181409
Reduce graph size by replacing terminal nodes in blocks that have a ForceOSRExit with Unreachable
https://bugs.webkit.org/show_bug.cgi?id=181409
Summary Reduce graph size by replacing terminal nodes in blocks that have a ForceOSRE...
Saam Barati
Reported 2018-01-08 15:45:56 PST
The function that runs most in speedometer has about 1100 bytecodes in it (not CodeBlock::instructionCount(), but 1100 bytecode ops). Only about 100 of these bytecode ops ever run. We end up doing a of extra compilation work by keeping control flow after ForceOSRExit. I've hacked up a patch locally that does this: - Blocks that have forceOSRExit remove their terminal and replace it with Unreachable - Place PhantomLocal's for all live-in variables to the ForceOSRExit semantic origin This is quite a hack, but it reduces the total sum of number of basic blacks in the IR after bytecode parsing by ~17% in Speedometer. It seems to reduce compile time by about 3-4%.
Attachments
WIP (3.61 KB, patch)
2018-01-08 17:05 PST, Saam Barati
no flags
WIP (3.63 KB, patch)
2018-01-08 17:16 PST, Saam Barati
no flags
WIP (6.97 KB, patch)
2018-01-08 18:33 PST, Saam Barati
no flags
patch (6.21 KB, patch)
2018-01-08 19:50 PST, Saam Barati
no flags
WIP (6.76 KB, patch)
2018-06-08 13:31 PDT, Saam Barati
ews-watchlist: commit-queue-
Archive of layout-test-results from ews200 for win-future (12.80 MB, application/zip)
2018-06-08 19:03 PDT, EWS Watchlist
no flags
patch (10.48 KB, patch)
2018-06-11 18:53 PDT, Saam Barati
no flags
Saam Barati
Comment 1 2018-01-08 17:05:21 PST
Created attachment 330759 [details] WIP running into some validation errors WRT liveness. Looking into it.
Saam Barati
Comment 2 2018-01-08 17:12:27 PST
(In reply to Saam Barati from comment #1) > Created attachment 330759 [details] > WIP > > running into some validation errors WRT liveness. Looking into it. I think I spot the bug.
Saam Barati
Comment 3 2018-01-08 17:16:25 PST
Saam Barati
Comment 4 2018-01-08 18:33:12 PST
Created attachment 330772 [details] WIP test EWS
Saam Barati
Comment 5 2018-01-08 19:50:44 PST
Saam Barati
Comment 6 2018-01-08 19:55:21 PST
(In reply to Saam Barati from comment #5) > Created attachment 330785 [details] > patch Some alternatives that we could do: We can factor out the code into a helper function on Graph that does the transformation. We could then call it from elsewhere since there are other phases that introduce ForceOSRExit nodes. I didn't do this just because it seemed less profitable. We probably introduce the most ForceOSRExit nodes inside the BytecodeParser.
Keith Miller
Comment 7 2018-01-09 12:38:01 PST
Comment on attachment 330785 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=330785&action=review r=me. > Source/JavaScriptCore/ChangeLog:27 > + it, we could use additional inputs into this mechanism. For example, we could > + profile if a basic block ever executes inside the LLInt/Baseline, and > + remove parts of the CFG based on that. File a bug?
Saam Barati
Comment 8 2018-01-09 12:52:45 PST
(In reply to Keith Miller from comment #7) > Comment on attachment 330785 [details] > patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=330785&action=review > > r=me. > > > Source/JavaScriptCore/ChangeLog:27 > > + it, we could use additional inputs into this mechanism. For example, we could > > + profile if a basic block ever executes inside the LLInt/Baseline, and > > + remove parts of the CFG based on that. > > File a bug? Filed: https://bugs.webkit.org/show_bug.cgi?id=181447
WebKit Commit Bot
Comment 9 2018-01-09 13:13:39 PST
Comment on attachment 330785 [details] patch Clearing flags on attachment: 330785 Committed r226655: <https://trac.webkit.org/changeset/226655>
WebKit Commit Bot
Comment 10 2018-01-09 13:13:41 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 11 2018-01-09 13:14:24 PST
Yusuke Suzuki
Comment 12 2018-01-11 19:30:51 PST
(In reply to Radar WebKit Bug Importer from comment #11) > <rdar://problem/36383749> Not sure why, but it seems that this cause some regression in assorted-test. https://arewefastyet.com/#machine=29&view=single&suite=misc&subtest=typedobj-write-struct-field-standard It would be good if this can fix some minor issues in this patch.
Saam Barati
Comment 13 2018-01-11 21:11:53 PST
(In reply to Yusuke Suzuki from comment #12) > (In reply to Radar WebKit Bug Importer from comment #11) > > <rdar://problem/36383749> > > Not sure why, but it seems that this cause some regression in assorted-test. > https://arewefastyet.com/#machine=29&view=single&suite=misc&subtest=typedobj- > write-struct-field-standard > It would be good if this can fix some minor issues in this patch. It might be worth looking into. What does the test to? It seems really surprising TBH though.
Saam Barati
Comment 14 2018-06-08 11:02:09 PDT
This got rolled out in: https://trac.webkit.org/changeset/230928/webkit But, our bots show rolling this out was a Speedometer 2 regression. Phil showed that rolling it out was a *progression* on certain tests w.r.t OSR entry. I'm going to reland a version of this that's both good for OSR entry and good for Speedometer.
Saam Barati
Comment 15 2018-06-08 13:31:52 PDT
Created attachment 342315 [details] WIP Haven't had time to test it really, but this may be the patch
EWS Watchlist
Comment 16 2018-06-08 14:11:14 PDT
Attachment 342315 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:6867: One line control clauses should not use braces. [whitespace/braces] [4] Total errors found: 1 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
EWS Watchlist
Comment 17 2018-06-08 19:03:18 PDT
Comment on attachment 342315 [details] WIP Attachment 342315 [details] did not pass win-ews (win): Output: http://webkit-queues.webkit.org/results/8093817 New failing tests: storage/domstorage/storage-close-database-on-idle.html
EWS Watchlist
Comment 18 2018-06-08 19:03:30 PDT
Created attachment 342352 [details] Archive of layout-test-results from ews200 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews200 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Saam Barati
Comment 19 2018-06-11 18:53:15 PDT
EWS Watchlist
Comment 20 2018-06-11 18:56:30 PDT
Attachment 342499 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/dfg/DFGGraph.cpp:933: Multi line control clauses should use braces. [whitespace/braces] [4] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Keith Miller
Comment 21 2018-06-11 19:21:39 PDT
Comment on attachment 342499 [details] patch r=me.
WebKit Commit Bot
Comment 22 2018-06-11 22:05:55 PDT
Comment on attachment 342499 [details] patch Clearing flags on attachment: 342499 Committed r232742: <https://trac.webkit.org/changeset/232742>
WebKit Commit Bot
Comment 23 2018-06-11 22:05:57 PDT
All reviewed patches have been landed. Closing bug.
Saam Barati
Comment 25 2018-06-12 19:04:13 PDT
(In reply to Saam Barati from comment #24) > This caused crashes: > https://build.webkit.org/results/ > Apple%20High%20Sierra%20Debug%20WK2%20(Tests)/r232756%20(3650)/js/dom/JSON- > stringify-stderr.txt actually, it seems more likely that this broke it: https://trac.webkit.org/changeset/232741/webkit
Saam Barati
Comment 26 2018-06-19 12:06:36 PDT
This is a 2% ARES-6 progression
Note You need to log in before you can comment on or make changes to this bug.