[clang] [clang-repl] Emit an AMDGPU object for the HIP device module (PR #234498)
Vassil Vassilev via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 22 02:03:37 PDT 2026
================
@@ -123,6 +123,33 @@ TEST(DeviceOffloadBuilderTest, MultipleOffloadArchsAreRejected) {
"supported. Pass a single --offload-arch"));
}
+TEST(DeviceOffloadHIPTest, DeviceObjectIsGenerated) {
+ llvm::InitializeAllTargets();
+ llvm::InitializeAllTargetMCs();
+ llvm::InitializeAllAsmPrinters();
+ std::string Err;
+ if (!llvm::TargetRegistry::lookupTarget(llvm::Triple("amdgcn-amd-amdhsa"),
+ Err))
+ GTEST_SKIP() << Err;
+
+ IncrementalCompilerBuilder CB;
+ CB.SetCompilerArgs({"--offload-arch=gfx1100", "-nogpulib", "-nogpuinc"});
+ auto DeviceCI = CB.CreateDevice(OffloadType::HIP);
+ ASSERT_THAT_EXPECTED(DeviceCI, llvm::Succeeded());
+ auto HostCI = CB.CreateHost(OffloadType::HIP);
+ ASSERT_THAT_EXPECTED(HostCI, llvm::Succeeded());
+ auto Interp = Interpreter::createWithDevice(
+ std::move(*HostCI), std::move(*DeviceCI), OffloadType::HIP);
+ ASSERT_THAT_EXPECTED(Interp, llvm::Succeeded());
+
+ // FIXME: Replace this with a check of the embedded bundle once the offload
----------------
vgvassilev wrote:
Maybe we should get the lit equivalent of this test. And when we start supporting it we should have a way to check the relevant llvm::Module produced by CodeGen rather than solely relying on execution -- this is a gap in the cuda work, too.
https://github.com/llvm/llvm-project/pull/234498
More information about the cfe-commits
mailing list