[Openmp-commits] [openmp] [amdgpu][openmp] Treat missing TIMESTAMP_FREQUENCY as non-fatal (PR #70987)
via Openmp-commits
openmp-commits at lists.llvm.org
Wed Nov 1 14:29:50 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Jon Chesterfield (JonChesterfield)
<details>
<summary>Changes</summary>
If you build with dynamic_hsa, the symbol is known and compilation succeeds. If you then run with a slightly older libhsa, this argument is not recognised and an error returned. I'd rather the program runs with a misleading omp wtime than refuses to run at all.
---
Full diff: https://github.com/llvm/llvm-project/pull/70987.diff
1 Files Affected:
- (modified) openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp (+6-4)
``````````diff
diff --git a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
index 71207f767fdcc60..378cad8f8ca4f15 100644
--- a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
+++ b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
@@ -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,
+ ClockFrequency))
+ ClockFrequency = 0;
// Load the grid values dependending on the wavefront.
if (WavefrontSize == 32)
``````````
</details>
https://github.com/llvm/llvm-project/pull/70987
More information about the Openmp-commits
mailing list