-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[GR-31342] Implemented node object inlining, lock free specialization and other features for Truffle DSL. #5566
Merged
Conversation
This file contains 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
oracle-contributor-agreement
bot
added
the
OCA Verified
All contributors have signed the Oracle Contributor Agreement.
label
Dec 5, 2022
Closed
graalvmbot
force-pushed
the
chumer/GR-31342/dsl-object-inlining
branch
2 times, most recently
from
January 10, 2023 14:42
c136507
to
6b63a92
Compare
graalvmbot
force-pushed
the
chumer/GR-31342/dsl-object-inlining
branch
from
January 10, 2023 22:28
f34a539
to
dc0eb00
Compare
…fore node plugins are invoked.
graalvmbot
force-pushed
the
chumer/GR-31342/dsl-object-inlining
branch
from
January 12, 2023 10:57
bee59ff
to
85dfa56
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes in this PR
@GenerateInline
annotation that allows Truffle nodes to be object-inlined automatically. Object-inlined Truffle nodes become singletons and therefore reduce memory footprint. Please see the tutorial for further details.@GenerateCached
annotation that allows users to control the generation of cached nodes. Use@GenerateCached(false)
to disable cached node generation when all usages of nodes are object-inlined to save code footprint.@Cached(neverDefault=true|false)
option to indicate whether the cache initializer will ever return anull
or primitive default value. Truffle DSL now emits a warning if it is beneficial to set this property. Alternatively, the new@NeverDefault
annotation may be used on the bound method or variable. The generated code layout can benefit from this information and reduce memory overhead. If never default is set totrue
, then the DSL will now use the default value instead internally as a marker for uninitialized values.@Shared
cached values may now use primitive values. Also,@Shared
can now be used for caches contained in specializations with multiple instances. This means that the shared cache will be used across all instances of a specialization.com.oracle.truffle.api.profiles
. The DSL now emits recommendation warnings when inlined profiles should be used instead of the allocated ones.@NeverDefault
. To ease migration work, we added several new ways to suppress the warnings temporarily for a Java package. For a list of possible warnings and further usage instructions, see the new warnings page in the docs."3"
was assumed)@Specialization(...unroll=2)
for further detailsInterpreter Benchmarks
Interpreter-only benchmarks results from NodeInlining benchmark:
Results:
Here are the runnable benchmarks from master:
In summary:
executeFastCached
got slightly faster after this changesexecuteSpecializeCached
improved 2x, because executeAndSpecialize is now lock-free.executeFastInlined
improved 3x over the cached counterpart. likely because of fewer reads that are necessary.executeSpecializeInlined
is 15x faster than the cached counterpart because no nodes need to be allocated anymore. All we do is set the state bit. Interesting this is also faster thanexecuteFastInlined
because due to the changed frequencies here we also inline executeAndSpecialize which can be beneifical for the fast-path.Memory Footprint
The biggest benefit of node object inlining is memory footprint. But for that we need it adopt it in the language first to get real results. Due to the lock-free specialization changes it is sometimes necessary to use specialization classes where we previously didn't.