Skip to content

[FIRRTL][Inliner] Inlining loses annotation context, from 3374 #10720

Description

@dtzSiFive

This is the input from #3374 .

The issue encountered there will be fixed shortly via PR, but that exposes a new issue that prevents using that input as a test just yet.
This issue tracks the ability of our inliner to produce the correct output for this input.

Here's an XFAIL'd lit test that shows the expected output via CHECK lines but does not pass today.

Today we assert fail as per #3374, and on builds with assertions off we generate broken DictionaryAttr's with n^2 copies of all fields of the annotation (all those processed before it)!

With the pending fix for 3374, baz_0 is used for both NLA's (since we don't yet support tracking renames per context), that is @nla1_0 is the same as @nla1 instead of different.

Here's the test:

// RUN: circt-opt --pass-pipeline='builtin.module(firrtl.circuit(firrtl-inliner))' -allow-unregistered-dialect %s | FileCheck %s
// XFAIL: *

// CHECK-LABEL: circuit "CollidingSymbolsReTop"
firrtl.circuit "CollidingSymbolsReTop" {
  // CHECK-NEXT: hw.hierpath @nla1 [@CollidingSymbolsReTop::@baz, @Baz]
  // CHECK-NEXT: hw.hierpath @nla1_0 [@CollidingSymbolsReTop::@baz_0, @Baz]
  // CHECK-NEXT: hw.hierpath @nla1_1 [@Foo::@baz, @Baz]

  hw.hierpath @nla1 [@Bar::@baz, @Baz]
  firrtl.module private @Baz() {
    // CHECK: firrtl.module private @Baz
    // CHECK-NEXT: wire sym @a
    // CHECK-SAME: {annotations = [{circt.nonlocal = @nla1, class = "hello"}, {circt.nonlocal = @nla1_0, class = "hello"}, {circt.nonlocal = @nla1_1, class = "hello"}]}
    %a = firrtl.wire sym @a {annotations = [{circt.nonlocal = @nla1, class = "hello"}]} : !firrtl.uint<1>
  }
  firrtl.module private @Bar() attributes {annotations = [{class = "firrtl.passes.InlineAnnotation"}]} {
    firrtl.instance baz sym @baz @Baz()
  }
  firrtl.module @Foo() {
    firrtl.instance bar @Bar()
  }
  firrtl.module @CollidingSymbolsReTop() {
    firrtl.instance b @Bar()
    firrtl.instance c @Bar()
  }
}

Metadata

Metadata

Assignees

Labels

FIRRTLInvolving the `firrtl` dialectbugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions