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
Αυτή η υποβολή περιλαμβάνεται σε:
Saleel Kudchadker committed 2022-04-12 12:27:31 -04:00
1 γονέας 857634241b
υποβολή 8eeaa998c0
8 files changed
+94 -31

No files matched your search

@@ -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) {