[Mlir-commits] [mlir] [MLIR][OpenMP] Add OMP Declare Mapper MLIR Op definition (PR #117045)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Nov 26 18:58:39 PST 2024


================
@@ -879,6 +879,14 @@ cleanup {
   omp.yield
 }
 
+// CHECK: %[[DECL_VAR:.*]] = llvm.alloca %{{.*}}
+// CHECK: %[[DECL_MAP_INFO:.*]] = omp.map.info var_ptr(%[[DECL_VAR]] : !llvm.ptr, !llvm.struct<"my_type", (i32)>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+// CHECK: omp.declare_mapper @my_mapper : %[[DECL_VAR]] : !llvm.ptr : !llvm.struct<"my_type", (i32)> map_entries(%[[DECL_MAP_INFO]] : !llvm.ptr)
+%decl_c1 = arith.constant 1 : i64
+%decl_var = llvm.alloca %decl_c1 x !llvm.struct<"my_type", (i32)> : (i64) -> !llvm.ptr
+%decl_map_info = omp.map.info var_ptr(%decl_var : !llvm.ptr, !llvm.struct<"my_type", (i32)>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
+omp.declare_mapper @my_mapper : %decl_var : !llvm.ptr : !llvm.struct<"my_type", (i32)> map_entries(%decl_map_info : !llvm.ptr)
----------------
agozillon wrote:

I think you'd really only have to teach the MapInfoFinalization pass, and only a little, as from what I recall it just works on MapInfoOp's the only case it has to know more about the operation holding it is when it's something that needs BlockArguments inserted, and there is an almost generic way of doing this I think, so it isn't a lot of work I believe. I don't think you'd have to teach the MLIR -> LLVM-IR how to handle the operation much more than you'd have to already for the current approach (if we're just talking about getting the information from the map clause at least, the function generation and embedding is it's own kettle of fish), but I could be wrong.

P.S. feel free to just consider this a comment on the other PR and reply there if you wish to reply, mostly just an informational message though, rather than trying to push things one way or another  :-) 

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


More information about the Mlir-commits mailing list