-
Notifications
You must be signed in to change notification settings - Fork 107
Refactor quantization.py to use TSP #2522
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
base: main
Are you sure you want to change the base?
Refactor quantization.py to use TSP #2522
Conversation
for more information, see https://pre-commit.ci
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 great, thank you @tejapulagam .
I wonder if we can process the additional args a tad more elegantly, other than that it seems great.
thunder/transforms/quantization.py
Outdated
) | ||
|
||
# Add new compute inputs to the trace args before processing | ||
new_computation_trace.args = (*new_computation_trace.args, *new_compute_inputs) |
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 wonder if we can do this before the processing and also add the new bindings.
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.
thunder/transforms/quantization.py
Outdated
else: | ||
new_computation_trace.bound_symbols.append(bsym.from_bsym()) | ||
# Insert the new bindings at the beginning of the trace | ||
new_computation_trace.bound_symbols = new_bindings + new_computation_trace.bound_symbols |
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 would prefer to keep the order of the bindings aligned with the arg order.
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.
not sure if this is what you had in mind
for more information, see https://pre-commit.ci
…m/tejapulagam/lightning-thunder into refactor/traceSubstitionProcessor
for more information, see https://pre-commit.ci
What does this PR do?
Refactors thunder/transforms/quantization.py to build the computation trace using TraceSubstitutionProcessor instead of manual bound-symbol rewriting.
Test test_networks.py::test_quantization is still passing.