SWDEV-538195 - Introduce threshold for handler submission (#723)
- When doing device/stream sync, we can submit a handler which may introduce some host side delays. Use DEBUG_CLR_BATCH_CPU_SYNC_SIZE to batch commands for host wait. Default for HIP is 8 commands. - Investigation is underway in ROCr but need to address this for now in HIP runtime.
This commit is contained in:
committed by
GitHub
parent
cd46294b31
commit
9b045922a8
@@ -136,7 +136,7 @@ void Timestamp::checkGpuTime() {
|
||||
amd::ScopedLock lock(it->LockSignalOps());
|
||||
// Ignore the wait if runtime processes API callback, because the signal value is bigger
|
||||
// than expected and the value reset will occur after API callback is done
|
||||
if (GetCallbackSignal().handle == 0) {
|
||||
if (GetCallbackSignal().handle == 0 || GetBlocking() == false) {
|
||||
WaitForSignal(it->signal_);
|
||||
}
|
||||
// Avoid profiling data for the sync barrier, in tiny performance tests the first call
|
||||
@@ -1006,6 +1006,7 @@ bool VirtualGPU::dispatchGenericAqlPacket(
|
||||
// Check for queue full and wait if needed.
|
||||
uint64_t index = hsa_queue_add_write_index_screlease(gpu_queue_, 1);
|
||||
uint64_t read = hsa_queue_load_read_index_relaxed(gpu_queue_);
|
||||
fence_dirty_ = true;
|
||||
|
||||
if (addSystemScope_) {
|
||||
header &= ~(HSA_FENCE_SCOPE_AGENT << HSA_PACKET_HEADER_SCACQUIRE_FENCE_SCOPE |
|
||||
@@ -1018,6 +1019,12 @@ bool VirtualGPU::dispatchGenericAqlPacket(
|
||||
auto expected_fence_state = extractAqlBits(header, HSA_PACKET_HEADER_SCRELEASE_FENCE_SCOPE,
|
||||
HSA_PACKET_HEADER_WIDTH_SCRELEASE_FENCE_SCOPE);
|
||||
|
||||
// Reset fence_dirty_ flag if we submit a packet with system scopes
|
||||
if (expected_fence_state == amd::Device::kCacheStateSystem) {
|
||||
fence_dirty_ = false;
|
||||
}
|
||||
|
||||
// Dirty optimization to save on consequent dispatch packets which have requested flushes
|
||||
if (fence_state_ == amd::Device::kCacheStateSystem
|
||||
&& expected_fence_state == amd::Device::kCacheStateSystem) {
|
||||
header = dispatchPacketHeader_;
|
||||
|
||||
Reference in New Issue
Block a user