Internal/external test difference for ntt placement
- Dominant language
- MLIR
- Stars
- 906
- Forks
- 171
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 32
Description
Followup from https://github.com/google/heir/pull/2671
```mlir
// RUN: heir-opt --convert-polynomial-mul-to-ntt %s | FileCheck %s
// CHECK-DAG: [[ZQ0:![^ ]+]] = !mod_arith.int<1095233372161 : i64>
!Zq0 = !mod_arith.int<1095233372161 : i64>
// CHECK-DAG: [[ZQ1:![^ ]+]] = !mod_arith.int<1032955396097 : i64>
!Zq1 = !mod_arith.int<1032955396097 : i64>
// CHECK-DAG: [[RNS2:![^ ]+]] = !rns.rns<[[ZQ0]], [[ZQ1]]>
// CHECK-DAG: [[ring_2:#[^ ]+]] = #polynomial.ring>
#ring_2 = #polynomial.ring, polynomialModulus = <1 + x**1024>>
// CHECK-DAG: [[poly_ty_2:![^ ]+]] = !polynomial.polynomial
!poly_ty_2 = !polynomial.polynomial
// Covers: flexible-op-only pipeline (Add/Sub) without mandatory coeff/eval-only consumers.
// CHECK: func.func @test_ntt_insertion5([[x5:%.+]]: [[poly_ty_2]]) -> [[poly_ty_2]] {
// CHECK: [[a5:%.+]] = polynomial.add [[x5]], [[x5]] : [[poly_ty_2]]
// CHECK: [[b5:%.+]] = polynomial.sub [[a5]], [[x5]] : [[poly_ty_2]]
// CHECK: return [[b5]] : [[poly_ty_2]]
func.func @test_ntt_insertion5(%x: !poly_ty_2) -> !poly_ty_2 {
%a = polynomial.add %x, %x : !poly_ty_2
%b = polynomial.sub %a, %x : !poly_ty_2
return %b : !poly_ty_2
}
```
produces
```mlir
!Z1032955396097_i64 = !mod_arith.int<1032955396097 : i64>
!Z1095233372161_i64 = !mod_arith.int<1095233372161 : i64>
!rns_L1 = !rns.rns
#ring_rns_L1_1_x1024 = #polynomial.ring>
!poly = !polynomial.polynomial
!poly1 = !polynomial.polynomial
module {
func.func @test_ntt_insertion5(%arg0: !poly) -> !poly1 {
%0 = polynomial.ntt %arg0 : !poly. // <--- should not be here
%1 = polynomial.add %0, %0 : !poly1
%2 = polynomial.sub %1, %0 : !poly1
return %2 : !poly1
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.