-
Notifications
You must be signed in to change notification settings - Fork 771
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
Add pass to instrument memory.grow instructions #7388
base: main
Are you sure you want to change the base?
Conversation
0ee3162
to
68f0669
Compare
Those use cases make sense to me. How about this?
|
Thanks @kripken for feedback. I don't mind updating the I don't insist on any of the options though, and I'd be happy to leave the decision to you. |
@loganek A pass argument is a nice idea. So by default it instruments everything, but you can pick an explicit subset? That sounds good to me. |
Yes, that's exactly what I meant. I'll update the PR soon. |
68f0669
to
b9bf2ee
Compare
;; NOTE: This test was ported using port_passes_tests_to_lit.py and could be cleaned up. | ||
|
||
;; RUN: foreach %s %t wasm-opt --instrument-memory="i32.load,memory.grow" -S -o - | filecheck %s | ||
|
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.
Please add a comment explaining that only i32.load
and memory.grow
should be instrumented below.
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.
I don't see the comment - where is it?
The first function should have a comment "we instrument grow and loads because we were asked to by the flags. The second, "we do not instrument store since we were not asked to by the flags".
93f551c
to
2dc6c17
Compare
;; NOTE: This test was ported using port_passes_tests_to_lit.py and could be cleaned up. | ||
|
||
;; RUN: foreach %s %t wasm-opt --instrument-memory="i32.load,memory.grow" -S -o - | filecheck %s | ||
|
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.
I don't see the comment - where is it?
The first function should have a comment "we instrument grow and loads because we were asked to by the flags. The second, "we do not instrument store since we were not asked to by the flags".
Also added instruction filter that allows to limit instrumented instructions.
2dc6c17
to
fadb6f2
Compare
I've implemented this functionality as a new pass, however, it could also be an extension of the existing instrument-memory pass. The main reason for that is because I'd like to be able to use this instrumentation in production code, not just for debugging - the instrument-memory pass adds lot more instrumentation which would impact the performance of my code.
Alternatively, I could extend the instrument-memory pass and add a parameter to select instructions that should be instrumented - I'm open for feedback; if that's preferred approach, I'd be happy to update the PR.