-
Notifications
You must be signed in to change notification settings - Fork 347
[OM] Create OM Nodes for metadata #5224
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
Conversation
Make the `CreateSiFiveMetadata` a `mlir::ModuleOp` pass. This is required to generate `om` Dialect operations (#5224). The `om::ClassOp` must have `mlir::ModuleOp` as the parent. This PR updates the Pass infrastructure and also the lit tests.
d5ec402
to
efe851e
Compare
@mikeurbach , @uenoku , this PR is ready for review. Please take a look. |
.Case<om::ClassOp>([&](auto op) { | ||
symbolCache.addDefinition(op.getSymNameAttr(), op); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output looks good to me in the tests, just some minor comments.
7dc92e4
to
f039d37
Compare
f039d37
to
3a76056
Compare
Refactor implementation
3a76056
to
c6002c1
Compare
Thanks for the review, @mikeurbach and @uenoku. |
; MLIR_OUT: om.class @SitestBlackBoxModulesSchema(%moduleName: !om.sym_ref) { | ||
; MLIR_OUT: om.class.field @moduleName, %moduleName : !om.sym_ref | ||
; MLIR_OUT: } | ||
|
||
; MLIR_OUT: om.class @SitestBlackBoxMetadata() { | ||
; MLIR_OUT: %0 = om.constant #om.sym_ref<@Foo_BlackBox> : !om.sym_ref | ||
; MLIR_OUT: %1 = om.object @SitestBlackBoxModulesSchema(%0) : (!om.sym_ref) -> !om.class.type<@SitestBlackBoxModulesSchema> | ||
; MLIR_OUT: om.class.field @exterMod_Foo_BlackBox, %1 : !om.class.type<@SitestBlackBoxModulesSchema> | ||
; MLIR_OUT: %2 = om.constant #om.sym_ref<@Bar_BlackBox> : !om.sym_ref | ||
; MLIR_OUT: %3 = om.object @SitestBlackBoxModulesSchema(%2) : (!om.sym_ref) -> !om.class.type<@SitestBlackBoxModulesSchema> | ||
; MLIR_OUT: om.class.field @exterMod_Bar_BlackBox, %3 : !om.class.type<@SitestBlackBoxModulesSchema> | ||
; MLIR_OUT: %4 = om.constant #om.sym_ref<@Baz_BlackBox> : !om.sym_ref | ||
; MLIR_OUT: %5 = om.object @SitestBlackBoxModulesSchema(%4) : (!om.sym_ref) -> !om.class.type<@SitestBlackBoxModulesSchema> | ||
; MLIR_OUT: om.class.field @exterMod_Baz_BlackBox, %5 : !om.class.type<@SitestBlackBoxModulesSchema> | ||
; MLIR_OUT: } | ||
|
||
; MLIR_OUT: om.class @MemorySchema(%name: !om.sym_ref, %depth: ui64, %width: ui32, %maskBits: ui32, %readPorts: ui32, %writePorts: ui32, %readwritePorts: ui32, %writeLatency: ui32, %readLatency: ui32) { | ||
; MLIR_OUT: om.class.field @name, %name : !om.sym_ref | ||
; MLIR_OUT: om.class.field @depth, %depth : ui64 | ||
; MLIR_OUT: om.class.field @width, %width : ui32 | ||
; MLIR_OUT: om.class.field @maskBits, %maskBits : ui32 | ||
; MLIR_OUT: om.class.field @readPorts, %readPorts : ui32 | ||
; MLIR_OUT: om.class.field @writePorts, %writePorts : ui32 | ||
; MLIR_OUT: om.class.field @readwritePorts, %readwritePorts : ui32 | ||
; MLIR_OUT: om.class.field @writeLatency, %writeLatency : ui32 | ||
; MLIR_OUT: om.class.field @readLatency, %readLatency : ui32 | ||
; MLIR_OUT: } | ||
; MLIR_OUT: om.class @MemoryMetadata() { | ||
; MLIR_OUT: om.constant #om.sym_ref<@foo_m_ext> : !om.sym_ref | ||
; MLIR_OUT: om.object @MemorySchema | ||
; MLIR_OUT: om.constant #om.sym_ref<@bar_m_ext> : !om.sym_ref | ||
; MLIR_OUT: om.object @MemorySchema | ||
; MLIR_OUT: om.constant #om.sym_ref<@baz_m_ext> : !om.sym_ref | ||
; MLIR_OUT: om.object @MemorySchema | ||
; MLIR_OUT: } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very late review! Can you move this to a separate test?
This test is mega-focused on testing directory output directory behavior and I was surprised to see om.class lowering added to it. 😅
Create
OM
nodes to represent thejson
metadata inCreateSifiveMetadata
.This adds the required infrastructure for including the
om
dialect, toFIRRTL
.The
emit-metadata
pass now generates the metadata asom.class
in the IR, in addition to theverbatim
.The lit tests also check that the om dialect is generated and preserved in the
mlir
afterExportVerilog
.Example IR:
Memory metadata:
BlackBox metadata