Skip to content

[FIRRTL] Dedup: missing symbol fixups #9697

@youngar

Description

@youngar
firrtl.circuit "Baz" {
  firrtl.class private @Foo() {}
  firrtl.class private @Bar() {}
  firrtl.module @Baz() attributes {annotations = [{class = "firrtl.transforms.NoDedupAnnotation"}]} {
    %wire1 = firrtl.wire : !firrtl.class<@Foo()>
    %wire2 = firrtl.wire : !firrtl.class<@Bar()>
  }
}

running ./bin/circt-opt dedup.mlir --pass-pipeline='builtin.module(firrtl.circuit(firrtl-dedup))' --mlir-print-ir-after-all --debug-only=firrtl-dedup

gives

===- Dedup circuit "Baz" ----------------------------------------------------===

Found 3 modules
Computing module information
- Hash 8cc8baf9fff66ade809f06bd206e72e4bcc90a72d187914f69343313e9762e35 for "Foo"
- Hash 8cc8baf9fff66ade809f06bd206e72e4bcc90a72d187914f69343313e9762e35 for "Bar"
- Hash ---------------------------------------------------------------- for "Baz"
Update modules
- Replace "Bar" with "Foo"
Update annotations
// -----// IR Dump After Dedup (firrtl-dedup) //----- //
firrtl.circuit "Baz" {
  firrtl.class private @Foo() {
  }
  firrtl.module @Baz() attributes {annotations = [{class = "firrtl.transforms.NoDedupAnnotation"}]} {
    %wire1 = firrtl.wire : !firrtl.class<@Foo()>
    %wire2 = firrtl.wire : !firrtl.class<@Bar()>
  }
}

I expect that wire2 should have had its type updated from @Bar to @Foo. I believe this is happening due to the NoDedup annotation preventing the calculation of ModuleInfo for this module, which later prevents us from fixing up operations in the body of Baz during fixupSymbolSensitiveOps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FIRRTLInvolving the `firrtl` dialect

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions