[FTD] Implement robust Fast Token Delivery#966
Open
QinYuan2000 wants to merge 101 commits into
Open
Conversation
The previous fast token delivery crashed when running into loops with multiple exits (see example CFG below). This happened because gates (Mu gates in this case) stored only one block as their condition block, which fails when multiple blocks are needed as conditions. <img width="200" height="388" alt="linear_search_CFG" src="https://github.com/user-attachments/assets/d2b59e5e-a8b1-42a9-b51a-141755eeb216" /> To fix this, two new attributes were added to `Gate`: - a boolean expression for the condition - a list of cofactors, representing the variables used in the condition expression. For each Mu gate, the loop exit condition is computed by OR-ing the exit conditions of all exiting blocks. The condition of the Mu is then set as the negation of this exit condition (i.e., the loop iteration condition). For Gamma gates, the condition remains the same as before, taken from the condition block. In `FtdImplementation.cpp`, whenever the condition value of a gate/loop is needed: - If there is a single cofactor, the same process as before is used, - If there are multiple cofactors, a Binary Decision Diagram (BDD) is built, translated into a circuit, and used as the condition value. In addition, in `boolVariableToCircuit` function, conditions generated for gates with multiple exiting blocks do not require channelification.
When compiling with the `ftd` feature, the default HDL is `vhdl`. If the HDL is changed to `verilog`, compilation fails due to a missing `noti` unit. This commit adds support for the `noti` unit to the `verilog-beta` unit generator.
…-ftd-smart-buffer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the robust Fast Token Delivery procedure developed in the thesis.
The original FTD work delivers tokens directly from producers to consumers and uses regeneration and suppression to preserve the token-matching invariant. However, suppression conditions are themselves computed from condition tokens, so building a suppression circuit creates new internal deliveries. The original procedure does not fully resolve these internal deliveries in complex control flow.
This PR implements a suppression construction that resolves these internal deliveries during circuit construction. For each producer-consumer delivery, it reconstructs the relevant control-flow relation, builds a decision graph, derives the Boolean condition under which the consumer is reached, lowers the condition through MUX trees, distributes condition tokens only along paths where they are available, and demotes condition tokens across loop levels when needed.
Main changes
Refactor the FTD implementation into:
Implement the new suppression pipeline:
Integrate the same post-flattening FTD flow with Straight-to-Queue.