-
Notifications
You must be signed in to change notification settings - Fork 385
support int8 scaled embedding bag pattern match #3463
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?
support int8 scaled embedding bag pattern match #3463
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/3463
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Xia-Weiwen
left a comment
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.
Thanks.
| ) | ||
| return res | ||
|
|
||
| def _q(self, x): |
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.
| def _q(self, x): | |
| def _quantize(self, x): |
| def test_fp8_scaled_embedding_bag(self): | ||
| dtype = torch.float8_e4m3fn | ||
|
|
||
| def _test_scaled_embedding_bag_helper(self, dtype, with_quant=False): |
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.
| def _test_scaled_embedding_bag_helper(self, dtype, with_quant=False): | |
| def _test_scaled_embedding_bag_helper(self, dtype, with_output_quant=False): |
| counters["inductor"]["scaled_embedding_bag_matcher_nodes"] += len(match.nodes) | ||
| counter_name = "scaled_embedding_bag" | ||
| if "o_dtype" in kwargs: | ||
| counter_name += "_with_quant" |
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.
| counter_name += "_with_quant" | |
| counter_name += "_with_output_quant" |
| def matcher_check_fn(): | ||
| counter_name = "scaled_embedding_bag" | ||
| if with_quant: | ||
| counter_name += "_with_quant" |
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.
| counter_name += "_with_quant" | |
| counter_name += "_with_output_quant" |
| self.weight_scale = 2.0 | ||
| self.output_scale = 3.0 | ||
|
|
||
| def _dq(self, weight): |
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.
| def _dq(self, weight): | |
| def _dequantize(self, weight): |
Fuse dq + embeddingbag => _scaled_embedding_bag
Blocked by #3406