-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[MLIR][DLTI] Add mangling style #125875
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
[MLIR][DLTI] Add mangling style #125875
Changes from all commits
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 |
---|---|---|
|
@@ -25,6 +25,8 @@ constexpr static llvm::StringLiteral kAttrName = "dltest.layout"; | |
constexpr static llvm::StringLiteral kEndiannesKeyName = "dltest.endianness"; | ||
constexpr static llvm::StringLiteral kAllocaKeyName = | ||
"dltest.alloca_memory_space"; | ||
constexpr static llvm::StringLiteral kManglingModeKeyName = | ||
"dltest.mangling_mode"; | ||
constexpr static llvm::StringLiteral kProgramKeyName = | ||
"dltest.program_memory_space"; | ||
constexpr static llvm::StringLiteral kGlobalKeyName = | ||
|
@@ -83,6 +85,9 @@ struct CustomDataLayoutSpec | |
StringAttr getAllocaMemorySpaceIdentifier(MLIRContext *context) const { | ||
return Builder(context).getStringAttr(kAllocaKeyName); | ||
} | ||
StringAttr getManglingModeIdentifier(MLIRContext *context) const { | ||
return Builder(context).getStringAttr(kManglingModeKeyName); | ||
} | ||
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. Can you also add checks in the actual unit tests below (such as the FallbackDefault etc). |
||
StringAttr getProgramMemorySpaceIdentifier(MLIRContext *context) const { | ||
return Builder(context).getStringAttr(kProgramKeyName); | ||
} | ||
|
@@ -474,6 +479,7 @@ module {} | |
EXPECT_EQ(layout.getProgramMemorySpace(), Attribute()); | ||
EXPECT_EQ(layout.getGlobalMemorySpace(), Attribute()); | ||
EXPECT_EQ(layout.getStackAlignment(), 0u); | ||
EXPECT_EQ(layout.getManglingMode(), Attribute()); | ||
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. Can you add this to the following tests as well: EmptySpec, NullSpec And add an actuel entry in SpecWithEntries ? PS I know we test certain things twice but the unit test really covers all the different paths to get to a default / actual value. 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. tests added. Let me know anything more we add. 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. LGTM feel free to land! |
||
} | ||
|
||
TEST(DataLayout, NullSpec) { | ||
|
@@ -506,6 +512,7 @@ TEST(DataLayout, NullSpec) { | |
EXPECT_EQ(layout.getProgramMemorySpace(), Attribute()); | ||
EXPECT_EQ(layout.getGlobalMemorySpace(), Attribute()); | ||
EXPECT_EQ(layout.getStackAlignment(), 0u); | ||
EXPECT_EQ(layout.getManglingMode(), Attribute()); | ||
|
||
EXPECT_EQ(layout.getDevicePropertyValue( | ||
Builder(&ctx).getStringAttr("CPU" /* device ID*/), | ||
|
@@ -546,6 +553,7 @@ TEST(DataLayout, EmptySpec) { | |
EXPECT_EQ(layout.getProgramMemorySpace(), Attribute()); | ||
EXPECT_EQ(layout.getGlobalMemorySpace(), Attribute()); | ||
EXPECT_EQ(layout.getStackAlignment(), 0u); | ||
EXPECT_EQ(layout.getManglingMode(), Attribute()); | ||
|
||
EXPECT_EQ(layout.getDevicePropertyValue( | ||
Builder(&ctx).getStringAttr("CPU" /* device ID*/), | ||
|
@@ -567,7 +575,8 @@ TEST(DataLayout, SpecWithEntries) { | |
#dlti.dl_entry<"dltest.alloca_memory_space", 5 : i32>, | ||
#dlti.dl_entry<"dltest.program_memory_space", 3 : i32>, | ||
#dlti.dl_entry<"dltest.global_memory_space", 2 : i32>, | ||
#dlti.dl_entry<"dltest.stack_alignment", 128 : i32> | ||
#dlti.dl_entry<"dltest.stack_alignment", 128 : i32>, | ||
#dlti.dl_entry<"dltest.mangling_mode", "o"> | ||
> } : () -> () | ||
)MLIR"; | ||
|
||
|
@@ -604,6 +613,7 @@ TEST(DataLayout, SpecWithEntries) { | |
EXPECT_EQ(layout.getProgramMemorySpace(), Builder(&ctx).getI32IntegerAttr(3)); | ||
EXPECT_EQ(layout.getGlobalMemorySpace(), Builder(&ctx).getI32IntegerAttr(2)); | ||
EXPECT_EQ(layout.getStackAlignment(), 128u); | ||
EXPECT_EQ(layout.getManglingMode(), Builder(&ctx).getStringAttr("o")); | ||
} | ||
|
||
TEST(DataLayout, SpecWithTargetSystemDescEntries) { | ||
|
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.
ultra nit: newline missing before the check line.