Add mutex when reserving scratch

This prevents race condition when creating queues concurrently.

Change-Id: I5ea9714926fe06e1719fcb2559cb485063355e4f
This commit is contained in:
David Yat Sin
2023-05-18 16:51:30 +00:00
parent a397373cea
commit a1f3b619a7
@@ -504,6 +504,7 @@ void GpuAgent::InitScratchPool() {
void GpuAgent::ReserveScratch()
{
size_t reserved_sz = core::Runtime::runtime_singleton_->flag().scratch_single_limit();
ScopedAcquire<KernelMutex> lock(&scratch_lock_);
if (!scratch_cache_.reserved_bytes() && reserved_sz) {
HSAuint64 alt_va;
void* reserved_base = scratch_pool_.alloc(reserved_sz);