Skip to content

Commit

Permalink
Revert "[FIRRTL] Don't enforce owning module for local ref in LowerCl…
Browse files Browse the repository at this point in the history
…asses. (llvm#6811)"

This reverts commit c12c68d.

This was a quick workaround, but a better solution is being developed.
  • Loading branch information
mikeurbach committed Mar 13, 2024
1 parent 466f6cc commit 52f4828
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
11 changes: 1 addition & 10 deletions lib/Dialect/FIRRTL/Transforms/LowerClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,17 +269,8 @@ LogicalResult LowerClassesPass::processPaths(
if (node->getModule() == owningModule)
break;
// If there are no more parents, then the path op lives in a different
// hierarchy than the HW object it references, which is an error if the
// reference is hierarchical. We allow local targets in this case
// because we intentionally extract some things out of the owning module
// for legacy reasons, and expect to target them with local targets.
// Once that is fixed, we can restore the invariant that the path op
// lives in the same hierarchy as the HW object it references.
// hierarchy than the HW object it references, which is an error.
if (node->noUses()) {
// Local target temporary special case.
if (!hierPathOp)
break;

op->emitError() << "unable to resolve path relative to owning module "
<< owningModule.getModuleNameAttr();
error = true;
Expand Down
8 changes: 0 additions & 8 deletions test/Dialect/FIRRTL/lower-classes.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,13 @@ firrtl.circuit "Component" {

// CHECK-LABEL: firrtl.circuit "PathModule"
firrtl.circuit "PathModule" {
// CHECK: hw.hierpath private [[LOCAL_PATH_NOT_OWNED:@.+]] [@NotOwned::@wire]
// CHECK: hw.hierpath private [[PORT_PATH:@.+]] [@PathModule::[[PORT_SYM:@.+]]]
// CHECK: hw.hierpath private [[WIRE_PATH:@.+]] [@PathModule::[[WIRE_SYM:@.+]]]
// CHECK: hw.hierpath private [[VECTOR_PATH:@.+]] [@PathModule::[[VECTOR_SYM:@.+]]]
// CHECK: hw.hierpath private [[INST_PATH:@.+]] [@PathModule::@child]
// CHECK: hw.hierpath private [[MODULE_PATH:@.+]] [@Child]
// CHECK: hw.hierpath private [[NONLOCAL_PATH:@.+]] [@PathModule::@child, @Child::[[NONLOCAL_SYM:@.+]]]

firrtl.module @NotOwned() {
%wire = firrtl.wire sym @wire {annotations = [{class = "circt.tracker", id = distinct[6]<>}]} : !firrtl.uint<1>
}

// CHECK: firrtl.module @PathModule(in %in: !firrtl.uint<1> sym [[PORT_SYM]]) {
firrtl.module @PathModule(in %in : !firrtl.uint<1> [{class = "circt.tracker", id = distinct[0]<>}]) {
// CHECK: %wire = firrtl.wire sym [[WIRE_SYM]] : !firrtl.uint<8>
Expand Down Expand Up @@ -216,9 +211,6 @@ firrtl.circuit "PathModule" {

// CHECK: om.path_create reference %basepath [[MODULE_PATH]]
%module_path = firrtl.path reference distinct[5]<>

// CHECK: om.path_create reference %basepath [[LOCAL_PATH_NOT_OWNED]]
%local_path_not_owned = firrtl.path reference distinct[6]<>
}
firrtl.module @ListCreate(in %propIn: !firrtl.integer, out %propOut: !firrtl.list<integer>) attributes {convention = #firrtl<convention scalarized>} {
%0 = firrtl.integer 123
Expand Down

0 comments on commit 52f4828

Please sign in to comment.