Skip to content

Commit d3d79d9

Browse files
committed
add test for root equality
1 parent a6b8f6f commit d3d79d9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

mlir/test/Dialect/Polynomial/canonicalization.mlir

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,17 @@ func.func @test_canonicalize_fold_sub_through_intt(
101101
%out = polynomial.ntt %a_plus_b {root=#root} : !ntt_poly_ty -> !tensor_ty
102102
return %out : !tensor_ty
103103
}
104+
105+
106+
// CHECK-LABEL: test_canonicalize_do_not_fold_different_roots
107+
// CHECK: arith.addi
108+
func.func @test_canonicalize_do_not_fold_different_roots(
109+
%poly0 : !ntt_poly_ty,
110+
%poly1 : !ntt_poly_ty) -> !ntt_poly_ty {
111+
%0 = polynomial.ntt %poly0 {root=#polynomial.primitive_root<value=31:i32, degree=8:index>} : !ntt_poly_ty -> !tensor_ty
112+
%1 = polynomial.ntt %poly1 {root=#polynomial.primitive_root<value=33:i32, degree=8:index>} : !ntt_poly_ty -> !tensor_ty
113+
%a_plus_b = arith.addi %0, %1 : !tensor_ty
114+
%out = polynomial.intt %a_plus_b {root=#root} : !tensor_ty -> !ntt_poly_ty
115+
return %out : !ntt_poly_ty
116+
}
117+

0 commit comments

Comments
 (0)