[Openmp-commits] [llvm] [openmp] [OpenMP][Offload] Add `LIBOMPTARGET_TREAT_ATTACH_AUTO_AS_ALWAYS` to treat `attach(auto)` as `attach(always)`. (PR #172382)

Alex Duran via Openmp-commits openmp-commits at lists.llvm.org
Tue Dec 16 05:54:20 PST 2025


================
@@ -798,7 +798,15 @@ int processAttachEntries(DeviceTy &Device, AttachInfoTy &AttachInfo,
                       << ", PtrSize=" << PtrSize << ", MapType=0x"
                       << llvm::utohexstr(MapType);
 
-    const bool IsAttachAlways = MapType & OMP_TGT_MAPTYPE_ALWAYS;
+    bool IsAttachAlways = MapType & OMP_TGT_MAPTYPE_ALWAYS;
+
+    // Treat ATTACH(auto) as ATTACH(always) if environment variable is set
+    if (!IsAttachAlways && MappingConfig::get().TreatAttachAutoAsAlways) {
+      IsAttachAlways = true;
+      ODBG(ODT_Mapping) << "ATTACH(auto) will be treated as ATTACH(always) "
----------------
adurang wrote:

Won't this happen at every single attach? Isn't that too verbose? Maybe it's better to do just print it once when TreatAttachAutoAsAlways is set to true?

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


More information about the Openmp-commits mailing list