================
@@ -568,32 +590,45 @@ void createRegisterFatbinFunction(Module &M, 
GlobalVariable *FatbinDesc,
 
 } // namespace
 
-Error wrapOpenMPBinaries(Module &M, ArrayRef<ArrayRef<char>> Images) {
-  GlobalVariable *Desc = createBinDesc(M, Images);
+Error OffloadWrapper::wrapOpenMPBinaries(
+    Module &M, ArrayRef<ArrayRef<char>> Images,
+    std::optional<EntryArrayTy> EntryArray) const {
+  GlobalVariable *Desc = createBinDesc(
+      M, Images,
+      EntryArray
+          ? *EntryArray
+          : offloading::getOffloadEntryArray(M, "omp_offloading_entries"),
+      Suffix);
   if (!Desc)
     return createStringError(inconvertibleErrorCode(),
                              "No binary descriptors created.");
-  createRegisterFunction(M, Desc);
-  createUnregisterFunction(M, Desc);
+  createRegisterFunction(M, Desc, Suffix);
----------------
fabianmcg wrote:

So, in MLIR we can have multiple binaries, PTX, fatbinaries in a single IR 
module:
```
gpu.binary @binary_sm_70 [#gpu.object<#nvvm.target<chip="sm_70">, "BINARY 
BLOB">]
gpu.binary @binary_gfx90a [#gpu.object<#rocdel.target<chip="gfx90a">, "BINARY 
BLOB">]
...
// Call `kernel_name` in `binary_sm_70`
 gpu.launch_func @binary_sm_70::kernel_name
// Call `kernel_name` in `binary_gfx90a`
 gpu.launch_func @binary_gfx90a::kernel_name
```
I added the suffix field so that in MLIR we can append the binary identifier to 
the descriptor, registration constructor, etc. This makes the IR more readable.

https://github.com/llvm/llvm-project/pull/78057
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to