[Mlir-commits] [mlir] [ROCDL] Pass `amd_code_object_version` when serializing ROCDL gpu module (PR #108874)
Matt Arsenault
llvmlistbot at llvm.org
Tue Sep 17 23:27:52 PDT 2024
================
@@ -104,6 +104,60 @@ TEST_F(MLIRTargetLLVMROCDL, SKIP_WITHOUT_AMDGPU(SerializeROCDLMToLLVM)) {
ASSERT_TRUE((*llvmModule)->getFunction("rocdl_kernel") != nullptr);
}
}
+// Test ROCDL serialization to ISA with default code object version.
+TEST_F(MLIRTargetLLVMROCDL,
+ SKIP_WITHOUT_AMDGPU(SerializeROCDLToISAWithDefaultCOV)) {
+ MLIRContext context(registry);
+
+ OwningOpRef<ModuleOp> module =
+ parseSourceString<ModuleOp>(moduleStr, &context);
+ ASSERT_TRUE(!!module);
+
+ // Create a ROCDL target.
+ ROCDL::ROCDLTargetAttr target = ROCDL::ROCDLTargetAttr::get(&context);
+
+ // Serialize the module.
+ auto serializer = dyn_cast<gpu::TargetAttrInterface>(target);
+ ASSERT_TRUE(!!serializer);
+ gpu::TargetOptions options("", {}, "", gpu::CompilationTarget::Assembly);
+ for (auto gpuModule : (*module).getBody()->getOps<gpu::GPUModuleOp>()) {
+ std::optional<SmallVector<char, 0>> object =
+ serializer.serializeToObject(gpuModule, options);
+ // Check that the serializer was successful.
+ ASSERT_TRUE(object != std::nullopt);
+ ASSERT_TRUE(!object->empty());
+ ASSERT_TRUE(StringRef(object->data(), object->size())
----------------
arsenm wrote:
this can be EXPECT_TRUE
https://github.com/llvm/llvm-project/pull/108874
More information about the Mlir-commits
mailing list