Skip to content

Peel first iteration of loops with ciphertext iter-args (Halo Solution A-1)#2534

Merged
copybara-service[bot] merged 1 commit intogoogle:mainfrom
j2kun:loop-support
Jan 16, 2026
Merged

Peel first iteration of loops with ciphertext iter-args (Halo Solution A-1)#2534
copybara-service[bot] merged 1 commit intogoogle:mainfrom
j2kun:loop-support

Conversation

@j2kun
Copy link
Collaborator

@j2kun j2kun commented Jan 15, 2026

Adds patterns to peel the first iteration of an affine.for or scf.for loop when the secretness of the init value and the yielded iter-arg disagree.

This is intended to be used at the secret + arith level, possibly with mgmt ops in the mix. I think this pattern will ultimately be used as part of the insert-mgmt pipeline, since that is where the bootstrap and level analysis occurs. But for now it's an independent pattern with a thin wrapper pass for testing.

@google-cla
Copy link

google-cla bot commented Jan 15, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@asraa
Copy link
Collaborator

asraa commented Jan 16, 2026

if this pass is primarily for reconciling types (secret/plaintext), then why would it need to be part of the mgmt pipelines? those will change the level attrs and add new mgmt ops but I don't think at that point it would be changing types

Copy link
Collaborator

@asraa asraa left a comment

Choose a reason for hiding this comment

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

very neat

@asraa asraa added the pull_ready Indicates whether a PR is ready to pull. The copybara worker will import for internal testing label Jan 16, 2026
@j2kun
Copy link
Collaborator Author

j2kun commented Jan 16, 2026

if this pass is primarily for reconciling types (secret/plaintext), then why would it need to be part of the mgmt pipelines? those will change the level attrs and add new mgmt ops but I don't think at that point it would be changing types

You're right about this pattern: it is a prerequisite to insert-mgmt because the level analysis would not converge otherwise, but not needed as "part" of insert-mgmt. But the later HALO passes definitely need to be part of insert-mgmt (or some alternative pipeline) because you need a level analysis to determine how much to unroll the loop.

@j2kun
Copy link
Collaborator Author

j2kun commented Jan 16, 2026

I will squash this PR with joint authorship once Sara signs the CLA

Co-authored-by: sararv <saras.vanch@gmail.com>
Co-authored-by: Jeremy Kun <j2kun@users.noreply.github.com>
@j2kun j2kun changed the title Add HALO loop peeling pattern Peel first iteration of loops with ciphertext iter-args (Halo Solution A-1) Jan 16, 2026
@copybara-service copybara-service bot merged commit 0e0ee63 into google:main Jan 16, 2026
4 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pull_ready Indicates whether a PR is ready to pull. The copybara worker will import for internal testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants