8000 [FIRRTL] default layer specialization by youngar · Pull Request #7401 · llvm/circt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[FIRRTL] default layer specialization #7401

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

Merged
merged 4 commits into from
Jul 30, 2024

Conversation

youngar
Copy link
Member
@youngar youngar commented Jul 29, 2024

No description provided.

@youngar youngar added the FIRRTL Involving the `firrtl` dialect label Jul 29, 2024
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.

The one thing that may be weird about this is that there are now a lot of different ways to do the same thing given that the options include both the ability to enable and disable layers as well as to set the default behavior. Use of mutually exclusive options instead of composable options may be simpler for users: (1) enable all, (2) disable all, and (3) enable specific.

Comment on lines +32 to +39
// CHECK-LABEL: firrtl.circuit "DefaultSpecialization"
firrtl.circuit "DefaultSpecialization" attributes {
// This option does not get removed - it is idempotent to leave it.
// CHECK: default_layer_specialization = #firrtl<layerspecialization enable>
default_layer_specialization = #firrtl<layerspecialization enable>
} {
firrtl.extmodule @DefaultSpecialization()
}
Copy link
Member

Choose a reason for hiding this comment

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

I agree with this. It originally seemed incongruous to remove the attributes for enabling/disabling, but leave this one. However, this one does make sense to leave in.

@youngar youngar force-pushed the firrtl-default-layer-specialization branch from a3fe29e to b66df64 Compare July 30, 2024 00:59
Copy link
Contributor
@dtzSiFive dtzSiFive left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -35,7 +35,8 @@ def CircuitOp : FIRRTLOp<"circuit",
StrAttr:$name,
DefaultValuedAttr<AnnotationArrayAttr, "{}">:$annotations,
OptionalAttr<SymbolRefArrayAttr>:$enable_layers,
OptionalAttr<SymbolRefArrayAttr>:$disable_layers
OptionalAttr<SymbolRefArrayAttr>:$disable_layers,
OptionalAttr<LayerSpecializationAttr>:$default_layer_specialization
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor consideration:

Does it make sense for this to be DefaultValuedAttr defaulting to, "none"? This is (maybe) simpler to store (value, not optional<value>) and means you can just get the behavior directly instead of interpreting no setting as "none" anyway?

Especially since it's never removed. Just a thought.

Copy link
Member Author
@youngar youngar Jul 30, 2024

Choose a reason for hiding this comment

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

I made the attribute only have two cases, enable and disable, and kept it optional on the circuit. I made the command line argument use a different 3 value enum, with None, Enable, Disable. Unfortunately the cl framework doesn't seem to have magical handling for std::optional, and I would have had to use a custom parser to make std::optional<LayerSpecialization> work - and using a new 3 value enum value gives better help descriptions.

youngar added 3 commits July 30, 2024 12:10
This adds a new LayerSpecialization attribute, which will eventually be
used to specify the default mode of specialization on a circuit.
This adds a default layer specialization mode attribute to the FIRRTL
CircuitOp.  This will be used by the layer specialization pass to
specialize layers that were not explitly enabled or disabled.
This adds a command line option to specify the default layer
specialization mode.
@youngar youngar force-pushed the firrtl-default-layer-specialization branch from b66df64 to 32ef764 Compare July 30, 2024 19:10
This modifies the SpecializeLayers pass to understand the default layer
specialization mode specified on a circuit.
@youngar youngar force-pushed the firrtl-default-layer-specialization branch from 32ef764 to b3104c9 Compare July 30, 2024 19:51
@youngar youngar merged commit 7ef4108 into llvm:main Jul 30, 2024
4 checks passed
@youngar youngar deleted the firrtl-default-layer-specialization branch July 30, 2024 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FIRRTL Involving the `firrtl` dialect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
@youngar 338A @seldridge @dtzSiFive
0