mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 23:14:13 +01:00
ircd::simt: Add cycles_rtc() intrinsic for s_memrealtime on (AMDGCN).
This commit is contained in:
parent
a53963fc51
commit
1f87668a28
1 changed files with 26 additions and 0 deletions
|
@ -24,3 +24,29 @@ ircd_simt_cycles()
|
|||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__OPENCL_VERSION__)
|
||||
/// Read the realtime-clock cycle counting timestamp `s_memrealtime` otherwise
|
||||
/// falls back to the default cycle counter (which defaults to zero if also not
|
||||
/// supported).
|
||||
///
|
||||
/// This is more consistent than `s_memtime` but slightly less granular; it is
|
||||
/// probably provided by a control unit rather than directly in an SIMD/ALU.
|
||||
inline ulong
|
||||
__attribute__((always_inline))
|
||||
ircd_simt_cycles_rtc()
|
||||
{
|
||||
ulong ret;
|
||||
#if defined(__AMDGCN__)
|
||||
asm volatile
|
||||
(
|
||||
"s_memrealtime %0"
|
||||
: "=s" (ret)
|
||||
);
|
||||
#else
|
||||
ret = ircd_simt_cycles();
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue