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

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Wed Nov 1 14:43:04 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:

So `Raw` does not emit an error. I thought the issue would be that `HSA_AMD_AGENT_INFO_TIMESTAMP_FREQUENCY` may not be defined at all so it would fail to compile? 

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


More information about the Openmp-commits mailing list