From 2052be1d1d9d222f688c40eb426b4c8ccd079513 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 30 Aug 2023 13:58:55 +0000 Subject: [PATCH] Pre-allocate memory for 16K signals On busy systems, the memory allocation can take long duration and increase calls to hsa_signal_create/hsa_amd_signal_create. This mitigates this issue. Change-Id: Ib7640273262ebc3dbf1f07049ce5da10b1d6b158 [ROCm/ROCR-Runtime commit: 9a127193a83adbad34020e05e6b9d69a2ec1d3f0] --- projects/rocr-runtime/runtime/hsa-runtime/core/inc/signal.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/signal.h b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/signal.h index 1907e52e36..f3e42fe7e7 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/signal.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/signal.h @@ -157,10 +157,13 @@ static_assert((offsetof(SharedSignal, sdma_end_ts) % 32) == 0, static_assert(sizeof(SharedSignal) == 128, "Bad SharedSignal size."); + +#define SIGNAL_PREALLOC_BLOCKS 512 //16K Signals + /// @brief Pool class for SharedSignal suitable for use with Shared. class SharedSignalPool_t : private BaseShared { public: - SharedSignalPool_t() : block_size_(minblock_) {} + SharedSignalPool_t() : block_size_(SIGNAL_PREALLOC_BLOCKS * minblock_) {} ~SharedSignalPool_t() { clear(); } SharedSignal* alloc();