Skip to content

Commit 94fdcf8

Browse files
Bug fix for NTT Kernel generating extra unnecessary P-ISA instructions.
Bug fix for NTT Kernel generating extra unnecessary P-ISA instructions.
1 parent ec39a15 commit 94fdcf8

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

kerngen/pisa_generators/ntt.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,21 +90,20 @@ def to_pisa(self) -> list[PIsaOp]:
9090
# TODO We need to decide whether output symbols need to be defined
9191
outtmp = Polys("outtmp", self.output.parts, self.output.rns)
9292

93-
# control the input for the butterfly method.
93+
# Essentially a scalar mul since psi 1 part
9494
if self.context.ntt_stages % 2 == 0:
95-
# Essentially a scalar mul since psi 1 part
95+
# Even case: butterfly input starts "coeff"
9696
mul = Mul(self.context, self.output, self.input0, psi)
97-
butterfly_input = outtmp
9897
else:
98+
# Odd case: butterfly input stats with "outtmp"
9999
mul = Mul(self.context, outtmp, self.input0, psi)
100-
butterfly_input = self.input0
101100

102101
butterflies = butterflies_ops(
103102
pisa_op.NTT,
104103
context=self.context,
105104
output=self.output,
106105
outtmp=outtmp,
107-
input0=butterfly_input,
106+
input0=self.input0,
108107
)
109108

110109
return mixed_to_pisa_ops(mul, butterflies)

0 commit comments

Comments
 (0)