Skip to content

Conversation

@christopherngutierrez
Copy link
Contributor

Proposed changes

  • Adds an optional command line parameter to modify output to match kerngen legacy mode.

Types of changes

What types of changes does your code introduce to the Encrypted Computing SDK project?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating
the PR. If you are unsure about any of them, do not hesitate to ask. We are
here to help! This is simply a reminder of what we are going to look for before
merging your code.

  • I have read the CONTRIBUTING agreement
  • Current formatting and unit tests / base functionality passes locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Further comments

NA

@kylanerace
Copy link
Collaborator

Just for visibility, can you provide an example of standard output versus legacy output?

@christopherngutierrez
Copy link
Contributor Author

Just for visibility, can you provide an example of standard output versus legacy output?

Sure thing, for instance:
Normal output for NTT (scheme='BGV' poly_order=16384 key_rns=3 current_rns=2 ):

0, mul, output_0_0_0, input_0_0_0, psi_0_0_0, 0
0, mul, output_1_0_0, input_1_0_0, psi_0_0_0, 0
0, mul, output_0_1_0, input_0_1_0, psi_0_1_0, 1
0, mul, output_1_1_0, input_1_1_0, psi_0_1_0, 1
0, mul, output_0_0_1, input_0_0_1, psi_0_0_1, 0
0, mul, output_1_0_1, input_1_0_1, psi_0_0_1, 0
0, mul, output_0_1_1, input_0_1_1, psi_0_1_1, 1
0, mul, output_1_1_1, input_1_1_1, psi_0_1_1, 1
0, ntt, outtmp_0_0_0, outtmp_0_0_1, output_0_0_0, output_0_0_1, 0, 0, 0
0, ntt, outtmp_0_1_0, outtmp_0_1_1, output_0_1_0, output_0_1_1, 0, 0, 1
0, ntt, output_0_0_0, output_0_0_1, outtmp_0_0_0, outtmp_0_0_1, 1, 0, 0
# ...

Legacy output gives us:

14, mul, output_0_0_0, input_0_0_0, psi_0_0_0, 0
14, mul, output_1_0_0, input_1_0_0, psi_0_0_0, 0
14, mul, output_0_1_0, input_0_1_0, psi_0_1_0, 1
14, mul, output_1_1_0, input_1_1_0, psi_0_1_0, 1
14, mul, output_0_0_1, input_0_0_1, psi_0_0_1, 0
14, mul, output_1_0_1, input_1_0_1, psi_0_0_1, 0
14, mul, output_0_1_1, input_0_1_1, psi_0_1_1, 1
14, mul, output_1_1_1, input_1_1_1, psi_0_1_1, 1
14, ntt, outtmp_0_0_0, outtmp_0_0_1, output_0_0_0, output_0_0_1, w_0_0_0, 0
14, ntt, outtmp_0_1_0, outtmp_0_1_1, output_0_1_0, output_0_1_1, w_1_0_0, 1
14, ntt, output_0_0_0, output_0_0_1, outtmp_0_0_0, outtmp_0_0_1, w_0_1_0, 0
# ...

Note that the last few columns for the columns for ntt butterflies.

@kylanerace
Copy link
Collaborator

Just for visibility, can you provide an example of standard output versus legacy output?

Sure thing, for instance: Normal output for NTT (scheme='BGV' poly_order=16384 key_rns=3 current_rns=2 ):

0, mul, output_0_0_0, input_0_0_0, psi_0_0_0, 0
0, mul, output_1_0_0, input_1_0_0, psi_0_0_0, 0
0, mul, output_0_1_0, input_0_1_0, psi_0_1_0, 1
0, mul, output_1_1_0, input_1_1_0, psi_0_1_0, 1
0, mul, output_0_0_1, input_0_0_1, psi_0_0_1, 0
0, mul, output_1_0_1, input_1_0_1, psi_0_0_1, 0
0, mul, output_0_1_1, input_0_1_1, psi_0_1_1, 1
0, mul, output_1_1_1, input_1_1_1, psi_0_1_1, 1
0, ntt, outtmp_0_0_0, outtmp_0_0_1, output_0_0_0, output_0_0_1, 0, 0, 0
0, ntt, outtmp_0_1_0, outtmp_0_1_1, output_0_1_0, output_0_1_1, 0, 0, 1
0, ntt, output_0_0_0, output_0_0_1, outtmp_0_0_0, outtmp_0_0_1, 1, 0, 0
# ...

Legacy output gives us:

14, mul, output_0_0_0, input_0_0_0, psi_0_0_0, 0
14, mul, output_1_0_0, input_1_0_0, psi_0_0_0, 0
14, mul, output_0_1_0, input_0_1_0, psi_0_1_0, 1
14, mul, output_1_1_0, input_1_1_0, psi_0_1_0, 1
14, mul, output_0_0_1, input_0_0_1, psi_0_0_1, 0
14, mul, output_1_0_1, input_1_0_1, psi_0_0_1, 0
14, mul, output_0_1_1, input_0_1_1, psi_0_1_1, 1
14, mul, output_1_1_1, input_1_1_1, psi_0_1_1, 1
14, ntt, outtmp_0_0_0, outtmp_0_0_1, output_0_0_0, output_0_0_1, w_0_0_0, 0
14, ntt, outtmp_0_1_0, outtmp_0_1_1, output_0_1_0, output_0_1_1, w_1_0_0, 1
14, ntt, output_0_0_0, output_0_0_1, outtmp_0_0_0, outtmp_0_0_1, w_0_1_0, 0
# ...

Note that the last few columns for the columns for ntt butterflies.

Ah got it. That makes a lot of sense.

Copy link
Collaborator

@kylanerace kylanerace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, fixes issue

@christopherngutierrez christopherngutierrez merged commit b38497e into main Jul 3, 2025
6 checks passed
@christopherngutierrez christopherngutierrez deleted the christopherngutierrez/kerngraph-legacy-mode branch July 3, 2025 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants