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

[Emit] Group file header ops into emit.fragment #6789

Merged
merged 1 commit into from
Mar 14, 2024
Merged

Conversation

nandor
Copy link
Contributor

@nandor nandor commented Mar 6, 2024

Instead of using the replicated op mechanism, fragments of SV code which must precede certain modules are grouped into fragment ops. Modules which rely on them reference them through a emit.fragment attribute. The fragments are printed through ExportVerilog.

Subsequent PRs will fully replace replicated ops using fragments.

@nandor nandor force-pushed the dev/nandor/fragment branch 2 times, most recently from e935c73 to e37736d Compare March 6, 2024 18:23
Copy link
Member

@maerhart maerhart left a comment

Choose a reason for hiding this comment

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

Just some drive-by comments

include/circt/Conversion/Passes.td Outdated Show resolved Hide resolved
include/circt/Dialect/Emit/EmitOps.td Outdated Show resolved Hide resolved
include/circt/Dialect/Emit/EmitOps.td Outdated Show resolved Hide resolved
include/circt/Dialect/Emit/EmitOps.td Outdated Show resolved Hide resolved
include/circt/Dialect/Emit/EmitOps.td Outdated Show resolved Hide resolved
test/Conversion/ExportVerilog/emit-fragment.mlir Outdated Show resolved Hide resolved
@nandor
Copy link
Contributor Author

nandor commented Mar 11, 2024

Thanks for the comments, addressed.

auto it = fragmentMapping.find(sym.getAttr());
if (it == fragmentMapping.end()) {
encounteredError = true;
op->emitError("cannot find referenced fragment ") << sym;
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be caught during validation?

Copy link
Contributor

Choose a reason for hiding this comment

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

Specifically the generic symbol use verifier from SymbolUserOpInterface

Copy link
Contributor

@darthscsi darthscsi left a comment

Choose a reason for hiding this comment

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

Is there a reason not to make a dialect attribute declared in the td files for the fragment referencing array?

@nandor
Copy link
Contributor Author

nandor commented Mar 12, 2024

This is a stopgap measure that improves replicated ops a bit to better group them until we sanitize the downstream flows sufficiently to be able to include them from a header, so I wouldn't want to make it a first-class attribute on modules, similarly to the output_file attribute which isn't specified either.

@nandor nandor requested a review from darthscsi March 13, 2024 11:23
Copy link
Member

@seldridge seldridge left a comment

Choose a reason for hiding this comment

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

Let's get this unblocked. Sorry for the delay.

How is this being tested for the LowerToHW changes? Is there enough coverage already with end-to-end tests? I was surprised that this did not need changes to existing LowerToHW tests. Can you include some tests of this if it is not already covered.

include/circt/Conversion/Passes.td Outdated Show resolved Hide resolved
llvm Outdated Show resolved Hide resolved
lib/Conversion/FIRRTLToHW/LowerToHW.cpp Outdated Show resolved Hide resolved
@nandor nandor force-pushed the dev/nandor/fragment branch 3 times, most recently from ecf647d to dd122d7 Compare March 13, 2024 22:25
Instead of using the replicated op mechanism, fragments of SV code
which must precede certain modules are grouped into fragment ops.
Modules which rely on them reference them through a `emit.fragment`
attribute. The fragments are printed through ExportVerilog.

Subsequent PRs will fully replace replaced ops using fragments.
@nandor nandor merged commit 9c4f721 into main Mar 14, 2024
4 checks passed
@nandor nandor deleted the dev/nandor/fragment branch March 14, 2024 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants