-
Notifications
You must be signed in to change notification settings - Fork 52
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
[Profiler] eDSL support for source info table + eDSL-level flame graphs #2397
Open
ayakayorihiro
wants to merge
63
commits into
main
Choose a base branch
from
calyx-py-metadata-fr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
ekiwi
requested changes
Jan 29, 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.
Looks good. I have a couple of questions.
Please also add a test where you generate a source info block and pos
annotations.
ekiwi
reviewed
Jan 31, 2025
ekiwi
reviewed
Jan 31, 2025
…te/relative paths
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.
Continuing fun source-info work from PR #2396 , this PR contains an application of the metadata to the profiler. We have:
builder.py
andpy_ast.py
to produce@pos
attributes and thesourceinfo
metadata blocktools/fileinfo_emitter
: a tool that takes a Calyx with a source-info metadata block and emits ADL-to-Calyx mapping information on components, cells, and groups (which is what the profiler gathers information about right now)profiler.edsl-args
option.The result is that a user can now obtain flame graphs that contain eDSL-level profiling information! Now
<fud2-directory>/profiler-out
contains two new flame graph files if an eDSL program was provided to fud2:mixed-scaled-flame.svg
: A version ofscaled-flame.svg
that contains the Calyx construct (component/cell/group) name along with the associated eDSL file name and line numberadl-scaled-flame.svg
: A version ofscaled-flame.svg
that uses eDSL variable names for Calyx constructs wherever possible. If we couldn't find an appropriate variable name, the Calyx construct name will be given in single quotes.Usage
To obtain eDSL-level flame graphs,
NOTE: To disable source-info metadata, set the environment variable to
""
(the empty string).--through calyx-py-profiler
, and write the fud2 output to a directory. If the eDSL program requires arguments, use theprofiler.edsl-args
option.ex)
The reason why we need to use
--through
is that fud2 would choose to simply compile the eDSL source file to Calyx, and run the profiler on that instead, which wouldn't yield any eDSL-level profiling information.profiler-out
. So in the example above, there should befud2-runs/strict_6flow_test/adl-scaled-flame.svg
andfud2-runs/strict_6flow_test/mixed-scaled-flame.svg
.Issues
Solved! Thanks @EclecticGriffin for the pro-tip of using environment variables. Step 0 above has been updated!
I'd like to be able to make the eDSL source-info metadata configurable, without having to manually change tests as much as possible. (This is partially because I didn't want to mess with all of the tests that usecalyx-py
for this PR). I've added a new function inbuilder.py
that toggles a global variable inpy_ast.py
which controls the metadata emitting, but ideally I wouldn't need the user to change their source file (as in step 0 above). Is there a nice elegant way I can go around this? Sorry for the weird question.