[libc-commits] [libc] [openmp] [amdgpu][openmp] Treat missing TIMESTAMP_FREQUENCY as non-fatal (PR #70987)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed Nov 1 15:40:54 PDT 2023


================
@@ -1810,10 +1810,12 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
       return Err;
     GridValues.GV_Warp_Size = WavefrontSize;
 
-    // Get the frequency of the steady clock.
-    if (auto Err = getDeviceAttr(HSA_AMD_AGENT_INFO_TIMESTAMP_FREQUENCY,
-                                 ClockFrequency))
-      return Err;
+    // Get the frequency of the steady clock. If the attribute is missing
+    // assume running on an older libhsa and default to 0, omp_get_wtime
+    // will be inaccurate but otherwise programs can still run.
+    if (auto Err = getDeviceAttrRaw(HSA_AMD_AGENT_INFO_TIMESTAMP_FREQUENCY,
----------------
jhuber6 wrote:

Was assuming there'd be some version field in HSA that indicates it, but I don't know. This should be better than nothing for now.

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


More information about the libc-commits mailing list