SWDEV-301667 - Add cache state for a device

- Add a global cache state for a device to indicate scopes of submitted
AQL packets
- Remove scopes for TS marker if hipEventReleaseToDevice is passed. Set
env ROC_EVENT_NO_FLUSH=1 to use NOP AQL for event records.
It would flush caches by default with system scope release.
- Calling finish() should ensure if caches are flushed, if not queue a
marker

Change-Id: Ibbbdbb1cd7ac61cb35649169212142545be159e0
This commit is contained in:
Saleel Kudchadker
2022-03-29 22:48:19 -07:00
rodzic 857634241b
commit 8eeaa998c0
8 zmienionych plików z 94 dodań i 31 usunięć
+12
Wyświetl plik
@@ -180,6 +180,7 @@ Device::Device(hsa_agent_t bkendDevice)
gpuvm_segment_.handle = 0;
gpu_fine_grained_segment_.handle = 0;
prefetch_signal_.handle = 0;
cache_state_ = Device::CacheState::kCacheStateInvalid;
}
void Device::setupCpuAgent() {
@@ -2635,6 +2636,17 @@ void Device::getHwEventTime(const amd::Event& event, uint64_t* start, uint64_t*
start, end);
}
}
// ================================================================================================
bool Device::IsCacheFlushed(Device::CacheState state) const {
return (static_cast<int>(state) == cache_state_.load(std::memory_order_relaxed));
}
// ================================================================================================
void Device::SetCacheState(Device::CacheState state) {
cache_state_.store(static_cast<int>(state), std::memory_order_relaxed);
}
// ================================================================================================
static void callbackQueue(hsa_status_t status, hsa_queue_t* queue, void* data) {
if (status != HSA_STATUS_SUCCESS && status != HSA_STATUS_INFO_BREAK) {