-
Notifications
You must be signed in to change notification settings - Fork 83
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
Remove zero point parameter for dequantizelinear when its zero #3531
base: develop
Are you sure you want to change the base?
Conversation
@@ -162,7 +165,7 @@ TEST_CASE(qdq_different_scales) | |||
auto t2 = m1.add_parameter("t2", sh2); | |||
auto scale1 = m1.add_literal(0.5f); | |||
auto scale2 = m1.add_literal(0.4f); | |||
auto zero = m1.add_literal(std::int8_t{0}); | |||
auto zero = m1.add_literal(std::int8_t{1}); |
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.
This is no longer a variable called zero
. It is initialized to a 1
. Maybe it should be called zp
? Also, are you changing its value so it doesn't get eliminated?
{ | ||
for(auto ins : iterator_for(m)) | ||
{ | ||
if(ins->name() != "dequantizelinear") |
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.
For case of quantizelinear
, could this not replace a bunch of 0
s with a scalar broadcast..? Thanks.
auto a = zp->eval(); | ||
bool is_zero = false; | ||
a.visit([&](auto t) { | ||
is_zero = std::all_of(t.begin(), t.end(), [](auto x) { return float_equal(x, 0); }); |
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.
Isn't zero point based on the input type here for dequantize? If so why are we using float_equal then? Is this more to cover the case of say fp8 as well as int8, int4, etc?
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.
The visitor will visit all data types, so we need the float_equal
if the zero point is a floating point(which is the case for fp8).
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.
One question, otherwise I get what you're doing here
Fix CI but I think this is fine with what you're doing here |
This build is not recommended to merge 🔴 |
🔴bert_large_uncased_fp16: FAILED: MIGraphX is not within tolerance - check verbose output |
This removes the zero point from dequantizelinear when its zero. We dont do this for quantizelinear since its necessary for deducing the output type.