summaryrefslogtreecommitdiffstats
path: root/Whisper/Utils/GpuProfiler.cpp
diff options
context:
space:
mode:
authorKonstantin <const@const.me>2023-01-21 21:23:08 +0100
committerKonstantin <const@const.me>2023-01-21 21:23:08 +0100
commitcacec67bb649702db7a877de1b6482a46123f175 (patch)
tree07456739a57274cfb8cf6750d2acd480b23d0de1 /Whisper/Utils/GpuProfiler.cpp
parent040281bccc424341c964788aa7ca17876a5ac6a4 (diff)
Experimental, alternative busy wait implementation
Disabled with a `constexpr` flag because on a desktop with discrete GPU this slowed down by about 20%. But the CPU load is about zero. Need to test on iGPUs, thermal shenanigans might make a difference there.
Diffstat (limited to 'Whisper/Utils/GpuProfiler.cpp')
-rw-r--r--Whisper/Utils/GpuProfiler.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/Whisper/Utils/GpuProfiler.cpp b/Whisper/Utils/GpuProfiler.cpp
index 6f19415..f7d8dc3 100644
--- a/Whisper/Utils/GpuProfiler.cpp
+++ b/Whisper/Utils/GpuProfiler.cpp
@@ -45,7 +45,7 @@ HRESULT GpuProfiler::Queue::create()
namespace
{
- static uint64_t getTimestamp( ID3D11Query* query )
+ static uint64_t getTimestamp( ID3D11Query* query, const DelayExecution& delay )
{
ID3D11DeviceContext* const ctx = context();
@@ -56,12 +56,7 @@ namespace
check( hr );
if( S_OK == hr )
return res;
-#if 0
- Sleep( 1 );
-#else
- for( size_t i = 0; i < 1024; i++ )
- _mm_pause();
-#endif
+ delay.delay();
}
}
@@ -86,7 +81,7 @@ void GpuProfiler::Queue::Entry::join( GpuProfiler& owner )
{
assert( nullptr != block );
- uint64_t res = getTimestamp( query );
+ uint64_t res = getTimestamp( query, owner.delay );
#if PROFILER_COLLECT_TAGS
block->haveTimestamp( event, shader, tag, res, owner );
#else
@@ -350,8 +345,8 @@ HRESULT GpuProfilerSimple::time( uint64_t& rdi ) const
try
{
const D3D11_QUERY_DATA_TIMESTAMP_DISJOINT dtsd = waitForDisjointData( disjoint );
- const uint64_t t1 = getTimestamp( begin );
- const uint64_t t2 = getTimestamp( end );
+ const uint64_t t2 = getTimestamp( end, delay );
+ const uint64_t t1 = getTimestamp( begin, delay );
if( !dtsd.Disjoint )
{