[Mlir-commits] [llvm] [mlir] [mlir][llvmir][OpenMP] Translate affinity clause in task construct to llvmir (PR #182223)

Tom Eccles llvmlistbot at llvm.org
Mon Mar 9 10:24:38 PDT 2026


================
@@ -2303,6 +2370,176 @@ void TaskContextStructManager::freeStructPtr() {
   builder.CreateFree(structPtr);
 }
 
+static void storeAffinityEntry(llvm::IRBuilderBase &builder,
+                               llvm::Value *affinityList, llvm::Value *index,
+                               llvm::Value *addr, llvm::Value *len) {
+  auto &ctx = builder.getContext();
+  // { base_addr (i64), len (i64), flags (i32) }
+  llvm::StructType *kmpTaskAffinityInfoTy = llvm::StructType::get(
+      llvm::Type::getInt64Ty(ctx), llvm::Type::getInt64Ty(ctx),
+      llvm::Type::getInt32Ty(ctx));
----------------
tblah wrote:

The definition in kmp.h defines the base address as `kmp_intptr_t`. This looks like it is always i64 on Windows but is just `long` on other platforms, which could be 32 bits. It is unfortunate that the openmp runtime is defined like this, but as it is I think you will have to figure out the correct width from the module's data layout.

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


More information about the Mlir-commits mailing list