From e72105b2e62cd041464f4c2099a89cbbfef82e4b Mon Sep 17 00:00:00 2001 From: Gyula Zakor Date: Fri, 1 Mar 2024 16:16:37 +0000 Subject: [PATCH] Fiy type check in find_pow2_div --- src/rewrite_low_precision.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/rewrite_low_precision.cpp b/src/rewrite_low_precision.cpp index 5bd82442956..dc1bb0ee328 100644 --- a/src/rewrite_low_precision.cpp +++ b/src/rewrite_low_precision.cpp @@ -54,8 +54,7 @@ struct find_pow2_div auto n = r.instructions["n"]; auto x = r.instructions["x"]; - // sqrt(n) with integral numbers can cause huge accuracy loss due to float->int rounding - if(n->get_shape().type() != migraphx::shape::half_type) + if(x->get_shape().type() != migraphx::shape::half_type) return; auto n_sqrt = m.insert_instruction(ins, make_op("sqrt"), n); auto x_div_n_rsqrt = m.insert_instruction(ins, make_op("div"), {x, n_sqrt});