[clang] [CIR] Introduce `cir-offload-merge` tool with a combine mode (PR #240322)

David Rivera via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 10 21:14:42 PST 2026


================
@@ -78,3 +78,44 @@ module attributes {cir.offload.container = 0 : i32} {
   module @device_0 attributes {cir.offload.kind = #cir.offload<device>} {
   }
 }
+
+// -----
+
+module attributes {cir.offload.container} {
+  module @host attributes {cir.offload.bundle_id = "host-x86_64-unknown-linux-gnu", cir.offload.kind = #cir.offload<host>} {
+  }
+  module @device_0 attributes {cir.offload.bundle_id = "cuda-nvptx64-nvidia-cuda--sm_80", cir.offload.kind = #cir.offload<device>} {
+  }
+  module @device_1 attributes {cir.offload.bundle_id = "cuda-nvptx64-nvidia-cuda--sm_80", cir.offload.kind = #cir.offload<device>} { // expected-error {{duplicate 'cir.offload.bundle_id' value 'cuda-nvptx64-nvidia-cuda--sm_80'}}
----------------
RiverDave wrote:

Good point. The uniqueness rule came from clang-offload-bundler, which routes each section by its bundle ID. CIR modules already carry their own target information, though, [so I dropped the cir.offload.bundle_id](https://github.com/llvm/llvm-project/pull/240322/changes/facc70f105f6c42e0ca05b4ff402a9e6e3f6c377) attribute, and the rule and this test went with it. Several device modules for the same target should be accepted now.

https://github.com/llvm/llvm-project/pull/240322


More information about the cfe-commits mailing list