-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[mlir][EmitC]Expand the MemRefToEmitC pass - Adding scalars #148055
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
Changes from all commits
a86bd7a
d62dd8d
263d6e0
5612d99
2950fd0
82bd2b4
1dc0e63
bc7b8e2
40e80d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -41,6 +41,8 @@ func.func @memref_load(%buff : memref<4x8xf32>, %i: index, %j: index) -> f32 { | |||
module @globals { | ||||
memref.global "private" constant @internal_global : memref<3x7xf32> = dense<4.0> | ||||
// CHECK-NEXT: emitc.global static const @internal_global : !emitc.array<3x7xf32> = dense<4.000000e+00> | ||||
memref.global "private" constant @__constant_xi32 : memref<i32> = dense<-1> | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was expecting to see a corresponding change to
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not yet. This would require changing those particular ops. I could circle back to this once we can completely lower the inliner model. |
||||
// CHECK-NEXT: emitc.global static const @__constant_xi32 : i32 = -1 | ||||
memref.global @public_global : memref<3x7xf32> | ||||
// CHECK-NEXT: emitc.global extern @public_global : !emitc.array<3x7xf32> | ||||
memref.global @uninitialized_global : memref<3x7xf32> = uninitialized | ||||
|
@@ -50,6 +52,9 @@ module @globals { | |||
func.func @use_global() { | ||||
// CHECK-NEXT: emitc.get_global @public_global : !emitc.array<3x7xf32> | ||||
%0 = memref.get_global @public_global : memref<3x7xf32> | ||||
// CHECK-NEXT: emitc.get_global @__constant_xi32 : !emitc.lvalue<i32> | ||||
// CHECK-NEXT: emitc.apply "&"(%1) : (!emitc.lvalue<i32>) -> !emitc.ptr<i32> | ||||
%1 = memref.get_global @__constant_xi32 : memref<i32> | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to check, so previously There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes! |
||||
return | ||||
} | ||||
} |
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.
What is the initialValue before this vs splat value returned?
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.
Without using getSplatValue, we have the initial value as:
initial_value = dense<-1> : tensor<i32>
After getting the splat value, we have
emitc.global static const @__constant_xi32 : i32 = -1