[clang] [llvm] [OpenMP] Adds omp_target_is_accessible routine (PR #138294)

Michael Klemm via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 16 02:09:45 PDT 2025


================
@@ -3027,6 +3027,29 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
     return ((IsAPU || OMPX_ApuMaps) && IsXnackEnabled);
   }
 
+  bool isAccessiblePtrImpl(const void *Ptr, size_t Size) override {
+    hsa_amd_pointer_info_t Info;
+    Info.size = sizeof(hsa_amd_pointer_info_t);
+
+    hsa_agent_t *Agents = nullptr;
+    uint32_t Count = 0;
+    hsa_status_t Status =
+        hsa_amd_pointer_info(Ptr, &Info, malloc, &Count, &Agents);
+
+    if (Status != HSA_STATUS_SUCCESS)
----------------
mjklemm wrote:

As discussed on the phone, I would argue for detecting why the status was reporting "not successful" and see if the reason is related to the actual test of the routine (so, unknown pointer, which is therefore not accessible). Or it may fail for some other HSA-internal reason that causes `hsa_amd_pointer_info` to fail.  The latter should be logged and may even warrant causing an abort of the process.

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


More information about the cfe-commits mailing list