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

[PipelineToHW] Don't CE pipeline regs in non-stallable pipelines #5567

Merged
merged 1 commit into from
Jul 13, 2023

Conversation

mortbopet
Copy link
Contributor

Will emit CompRegOp instead of CompRegClockEnabledOps for pipelines without stall signals.

In cases where a register has hierarchical clock gates specified (as in test_clockgates.mlir) but the "clock-gate-regs" option for lower-pipeline-to-hw is NOT set, then these hierarchical clock gates will be ignored.

Will emit `CompRegOp` instead of `CompRegClockEnabledOp`s for pipelines without stall signals.

In cases where a register has hierarchical clock gates specified (as in `test_clockgates.mlir`) but the `"clock-gate-regs"` option for `lower-pipeline-to-hw` is **NOT** set, then these hierarchical clock gates will be ignored.
@mortbopet
Copy link
Contributor Author

This is where the option selection matrix is located:

if (this->clockGateRegs) {
// Use the clock gate instead of clock enable.
Value currClockGate = notStalledClockGate;
for (auto hierClockGateEnable :
stageTerminator.getClockGatesForReg(regIdx)) {
// Create clock gates for any hierarchically nested clock gates.
currClockGate = builder.create<seq::ClockGateOp>(
loc, currClockGate, hierClockGateEnable, /*test_enable=*/Value());
}
dataReg = builder.create<seq::CompRegOp>(stageTerminator->getLoc(),
regIn, currClockGate, regName);
} else {
// Only clock-enable the register if the pipeline is stallable.
// For non-stallable pipelines, a data register can always be clocked.
if (hasStall) {
dataReg = builder.create<seq::CompRegClockEnabledOp>(
stageTerminator->getLoc(), regIn, args.clock,
stageValidAndNotStalled, regName);
} else {
dataReg = builder.create<seq::CompRegOp>(stageTerminator->getLoc(),
regIn, args.clock, regName);
}
}
rets.regs.push_back(dataReg);
}

Copy link
Contributor

@blakep-msft blakep-msft left a comment

Choose a reason for hiding this comment

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

Looks good to me.

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.

lgtm

@mortbopet mortbopet merged commit d5b6b75 into main Jul 13, 2023
@darthscsi darthscsi deleted the dev/mpetersen/pipeline_unstallable branch June 4, 2024 14:50
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.

3 participants