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

Jon Chesterfield via libc-commits libc-commits at lists.llvm.org
Wed Nov 1 15:43:33 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,
----------------
JonChesterfield wrote:

There is no version in the HSA library, it's on the wishlist. There is one in the header, but as the header may bear little relation to the shared library, that is a partial help.

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


More information about the libc-commits mailing list