Conversation
There was a problem hiding this comment.
Oh I didn't realize the merge of #552
before this latencies of beta-backend units were fixed, and speculation tests are benchmarked with those old latencies
| if (TailEn = '1') and (HeadEn = '0') then | ||
| -- if new tail index will reach head index | ||
| if ((Tail +1) mod {fifo_depth} = Head) then | ||
| if ((Tail + 2) mod {fifo_depth} = Head) then |
There was a problem hiding this comment.
This was the ring-buffer thing: we cannot fill up all slots to distinguish the empty and full state.
Full is latched so we should compare using Tail + 2, instead of + 1.
There was a problem hiding this comment.
do you mean buffered? A latched value is usually accidental https://vhdlwhiz.com/why-latches-are-bad/
There was a problem hiding this comment.
you're correct, it's buffered (or registered)
| static inline bool canGoThroughOutsideBlocks(Operation *op) { | ||
| return isa<handshake::ForkOp, handshake::ExtUIOp, handshake::ExtSIOp, | ||
| handshake::TruncIOp>(op); | ||
| handshake::TruncIOp, handshake::BufferOp>(op); |
There was a problem hiding this comment.
to call isBackedge after buffering, we should include BufferOp
| let summary = ""; | ||
| let description = [{ | ||
| }]; |
There was a problem hiding this comment.
I'll add these once this design is approved
| for (auto branch : funcOp.getOps<handshake::SpeculatingBranchOp>()) { | ||
| if (branch->getAttr("specv1_branchDiscardCondNonSpec")) { | ||
| unsigned bb = getLogicBB(specOp1).value(); | ||
| ConditionalBranchOp controlBranch = findControlBranch(funcOp, bb); | ||
| if (controlBranch == nullptr) { | ||
| specOp1->emitError() | ||
| << "Could not find backedge within speculation bb.\n"; | ||
| return signalPassFailure(); | ||
| } | ||
| auto conditionOperand = controlBranch.getConditionOperand(); | ||
| branch->setOperand(0, conditionOperand); | ||
| branch->setOperand(1, conditionOperand); | ||
| } | ||
| } |
There was a problem hiding this comment.
The operands of this SpeculatingBranch didn't follow this figure actually.
The loop condition is not necessarily produced by the speculator.
It only becomes definite after placing speculator and save-commit units (because the loop condition may be generated by either of them), so I'm doing this at the end of the pass.
|
Thanks for this Shun! Could you put this into the google test integration tests instead of bringing the python script back? Could you also give an explanation of why we can't just run buffering after the previous spec pass? what is the problem with the save commit control signal? If you could also double check your explanations, they don't quite make sense currently, e.g.
I don't know what this means, is there a incorrect word in it maybe? |
|
also, what does
You are still manually buffering the circuit? |
This might take time because I first need to study what the google test integration tests are like.
Updated the description, this is because buffering requires join-based semantics that speculator doesn't follow.
The problem is mostly the presence of a merge before buffering.
No, these buffers are still placed automatically by the post-buffering speculation pass, but not handled by the buffering algorithm. |
This PR modifies the speculation compilation flow to support automated buffering. To achieve this, the speculation pass has been split into two distinct passes: pre-buffering and post-buffering.
The automated buffering pass strictly assumes join semantics: meaning an elastic unit will only output a token to its output channels once it has joined (received) all input tokens. Because certain channels of speculator violate this timing model, we cannot place the complete speculator in a single pass before buffering.
Pre-Buffering Pass (Placeholder Generation):
SpecPreBuffer1and2) that strictly adhere to join semantics, allowing the buffering pass to run successfully.SCSaveCtrlanddataOutemit a token upon receiving atriggertoken, these channels are encapsulated into an elastic unit.SCCommitCtrlis intentionally omitted because it violates the join-based timing model (it only emits tokens after a misspeculation).Post-Buffering Pass (Finalization):
SCCommitCtrl.I admit this method might not be ideal or optimal. Because of the decomposition of the speculator, the frequency regulation no longer works. This is a quick workaround to make spec v1 comparable with the new speculation and to mitigate the non-deterministic circuit construction.
I also fixed several bugs in the speculator/save-commit implementations and the speculation pass, which are necessary for the speculation integration tests to work.