Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pipeline] add 'go' signal to pipeline #5455

Merged
merged 8 commits into from
Jun 26, 2023
Merged

Conversation

mortbopet
Copy link
Contributor

This commit adds an explicit 'go' signal to the pipeline abstraction. This signal is used to indicate when the pipeline should start. The signal will propagate through each stage as the stage valid signal. As a result of this, each stage now has a s#_valid : i1 signal as the last value in its block argument list. This value can be used within each stage for any operations which requires access to the pipeline control circuitry.
Given that pipeline stage validity is now explicit within the block arguments of a stage, a pipeline.stage operation no longer has an enable signal. As a small 'bugfix' here, a seq.clock_gate is emitted to gate the pipeline stage separating registers on the pipeline stage valid signal.

@mortbopet
Copy link
Contributor Author

CI failing due to lack of clock gate lowering which doesn't lower to an external module.

@mortbopet mortbopet force-pushed the dev/mpetersen/pipeline_go branch 2 times, most recently from e735b54 to 5e4035b Compare June 23, 2023 08:13
@mortbopet
Copy link
Contributor Author

Reverted back to a seq.compreg.ce implementation instead of seq.clock_gate.

Copy link
Contributor

@teqdruid teqdruid left a comment

Choose a reason for hiding this comment

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

Looks sane.

If I'm way off base about stall interactions, feel free to merge.

include/circt/Dialect/Pipeline/Pipeline.td Outdated Show resolved Hide resolved
auto reg = builder.create<seq::CompRegOp>(
stageTerminator->getLoc(), regIn.getType(), regIn, clock, regName,
reset, Value(), StringAttr());
auto reg = builder.create<seq::CompRegClockEnabledOp>(
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably don't want the CE on FPGAs. Unless it's being used to respond to backpressure (which I don't think it is), it is just a power optimization for ASICs. On FPGAs, it just adds fan-out and routing congestion.

Copy link
Contributor Author

@mortbopet mortbopet Jun 26, 2023

Choose a reason for hiding this comment

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

Good point. I'll change this to an input mux, and add the clock gating as a flag.

// Build valid register. The valid register is always reset to 0.
auto validRegName =
builder.getStringAttr(stageRegPrefix.strref() + "_valid");
rets.valid = builder.create<seq::CompRegOp>(
Copy link
Contributor

Choose a reason for hiding this comment

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

How does this interact with stall? It has to just stay in place, right?

This looks fine for non-stalled pipelines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lib/Dialect/Pipeline/PipelineOps.cpp Outdated Show resolved Hide resolved
@@ -262,34 +323,23 @@ LogicalResult ReturnOp::verify() {
// StageOp
//===----------------------------------------------------------------------===//

SuccessorOperands StageOp::getSuccessorOperands(unsigned index) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this have anything to do with adding go? Doesn't look like it...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implicitly, it does. StageOp no longer can comply with the getSuccessorOperands since it doesn't provide an operand for the s#_valid block argument to a given block - hence the removal.

This commit adds an explicit 'go' signal to the pipeline abstraction.
This signal is used to indicate when the pipeline should start. The
signal will propagate through each stage as the stage valid signal.
As a result of this, each stage now has a `s#_valid : i1` signal as the
last value in its block argument list. This value can be used within
each stage for any operations which requires access to the pipeline
control circuitry.
Given that pipeline stage validity is now explicit within the block
arguments of a stage, a `pipeline.stage` operation no longer has an
`enable` signal. As a small 'bugfix' here, a `seq.clock_gate` is emitted
to gate the pipeline stage separating registers on the pipeline stage
valid signal.
@mortbopet mortbopet merged commit e290fcd into main Jun 26, 2023
@darthscsi darthscsi deleted the dev/mpetersen/pipeline_go branch June 4, 2024 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants