-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[JSC] JITWorklist: consider size when determining a JITPlan's expected load #47380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
webkit-commit-queue
merged 1 commit into
WebKit:main
from
dhecht:eng/JSC-JITWorklist-consider-size-when-determining-a-JITPlan-s-expected-load
Jun 30, 2025
Merged
[JSC] JITWorklist: consider size when determining a JITPlan's expected load #47380
webkit-commit-queue
merged 1 commit into
WebKit:main
from
dhecht:eng/JSC-JITWorklist-consider-size-when-determining-a-JITPlan-s-expected-load
Jun 30, 2025
+53
−9
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EWS run on current version of this PR (hash de351c5) |
Constellation
approved these changes
Jun 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me
Safe-Merge-Queue: Build #61888. |
…d load https://bugs.webkit.org/show_bug.cgi?id=295209 rdar://154678309 Reviewed by Yusuke Suzuki. Currently, a JITPlan's load is determined solely by the tier. But for really large codeBlocks, the compilation time can be on the same order as higher tiers. Let's avoid mispredicting the load for these these outliers by bumping the load for large codeBlocks. This requires more bookkeeping since each plan in a particular queue can have a different load, and so total load can no longer be inferred by queue length. To handle this, maintain a running total load which is incremented when JITPlans are enqueued and decremented when they complete compilation or are canceled. The cancellation case complicates the bookkeeping in a couple of ways: 1. Need to coordinate which thread decrements in the case of cancellation. a. If the cancellation occurs while the JITPlan is still waiting in a queue, then the thread driving the cancellation needs to handle the bookkeeping. b. Otherwise, cancellation occurred after a compile thread dequeued the plan and is about to or is compiling the plan. In this case, the compile thread decrements the load once the cancellation is processed. 2. Once a JITPlan is canceled, the codeBlock can be dead so cannot be accessed after that point. But since case 1b occurs asynchronously some time later, the load cannot be computed at this point. To handle this, the compiler thread remembers the JITPlan before dropping the worklist lock during poll, which is the handoff point described in 1a-b. The size threshold for outliers is chosen as follows: Median compilation time and size for each tier: Baseline: ~15 usec / 90 bytecode instructions DFG: ~100 usec / 90 bytecode instructions FTL: ~800-1000 usec / 114 bytecode instructions At 2000 bytecode instructions, baseline compiles take around 100-200 usec, which is similar to DFG median. At 12000 bytecode instructions, baseline compiles take 500+ usec which is similar to FTL. At 2000 bytecode instructions, DFG compiles are around 1000 usec, which is similar to FTL. FTL load is always set to 1 thread unit and since a compile of a JITPlan is single threaded, there's no benefit to adjusting them. * Source/JavaScriptCore/jit/JITWorklist.cpp: (JSC::JITWorklist::planLoad): (JSC::JITWorklist::wakeThreads): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::totalOngoingCompilations const): (JSC::JITWorklist::removeMatchingPlansForVM): * Source/JavaScriptCore/jit/JITWorklist.h: * Source/JavaScriptCore/jit/JITWorklistThread.cpp: (JSC::JITWorklistThread::poll): * Source/JavaScriptCore/jit/JITWorklistThread.h: Canonical link: https://commits.webkit.org/296834@main
de351c5
to
1656e50
Compare
Committed 296834@main (1656e50): https://commits.webkit.org/296834@main Reviewed commits have been landed. Closing PR #47380 and removing active labels. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
JavaScriptCore
For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1656e50
de351c5