[flang-commits] [flang] [mlir] [flang][OpenMP] Implement HAS_DEVICE_ADDR clause (PR #128568)

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Thu Feb 27 06:31:00 PST 2025


================
@@ -224,10 +224,19 @@ class MapInfoFinalizationPass
   }
 
   /// Adjusts the descriptor's map type. The main alteration that is done
-  /// currently is transforming the map type to `OMP_MAP_TO` where possible.
-  /// This is because we will always need to map the descriptor to device
-  /// (or at the very least it seems to be the case currently with the
-  /// current lowered kernel IR), as without the appropriate descriptor
+  /// currently is transforming the map type to `OMP_MAP_TO` where possible,
+  /// plus adding OMP_MAP_ALWAYS flag. Descriptors will always be copied,
+  /// even if the object was listed on the `has_device_addr` clause.
+  /// This is because the descriptor can be rematerialized by the compiler,
+  /// and so the address of the descriptor for a given object at one place in
+  /// the code may differ from that address in another place. The contents
+  /// of the descriptor (the base address in paticular) will remain unchanged
+  /// though. Non-descriptor objects listed on the `has_device_addr` clause
+  /// can be passed to the kernel by just passing their address without any
+  /// remapping.
+  /// The adding the OMP_MAP_TO flag is done because we will always need to
----------------
skatrak wrote:

```suggestion
  /// The adding of the OMP_MAP_TO flag is done because we will always need to
```

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


More information about the flang-commits mailing list