Skip to content

Bootstrap loop iter args (Halo Solution A-2)#2536

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

Bootstrap loop iter args (Halo Solution A-2)#2536
copybara-service[bot] merged 1 commit intogoogle:mainfrom
j2kun:loop-support-2

Conversation

@j2kun
Copy link
Collaborator

@j2kun j2kun commented Jan 16, 2026

From 4.2 of https://dl.acm.org/doi/10.1145/3669940.3707275

Solution A-2: Bootstrapping all the loop-carried variables at the beginning of each iteration. Regardless of consumed levels of ciphertexts, bootstrapping reinitializes their level. Therefore, inserting the bootstrap operation at the beginning of the loop iteration can resolve the level type mismatch problem. Figure 2: Solution A-2 depicts the level matching process of the input and output of the loop body. Before entering the loop body, HALO reduces each level of y and a to the minimum level using modswitch for live-in and loop-carried variables. Then, HALO recovers the levels of the loop inputs to 10 by bootstrapping all loop inputs at the beginning of the loop. After type matching process, the loop is transformed to a type-matched loop (repeatable). However, the type-matched loops are inefficient. For efficient loop execution, bootstrap-based loop restructuring is required.

For this PR I introduced a new mgmt op: mgmt.level_reduce_min which corresponds to "reducing the level to the minimum allowable level." I suspect we need this op in this situation because we will be inserting this level_reduce_min before knowing what the actual level budget is, and this ensures that our level analysis can reach a fixpoint when processing the loops that will be present after the HALO implementation is integrated.

Rebased over #2534, and similar to that PR, I just created a pattern to handle the core operation, wrapped it in a dedicated pass for testing, and will figure out how to integrate it into the mgmt pipeline once all the remaining pieces of the Halo paper are implemented.

@j2kun j2kun marked this pull request as draft January 16, 2026 00:56
@google-cla
Copy link

google-cla bot commented Jan 16, 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.

@j2kun j2kun requested a review from asraa January 16, 2026 06:06
@j2kun j2kun marked this pull request as ready for review January 16, 2026 06:18
@j2kun
Copy link
Collaborator Author

j2kun commented Jan 16, 2026

The CI failure was due to llvm/llvm-project#175056 (comment) which will be fixed in the next LLVM integrate.

@j2kun j2kun added the pull_ready Indicates whether a PR is ready to pull. The copybara worker will import for internal testing label Jan 20, 2026
@copybara-service copybara-service bot merged commit bf8aa53 into google:main Jan 21, 2026
8 of 10 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.

2 participants