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
This commit is contained in:
David Yat Sin
2023-08-30 13:58:55 +00:00
parent 6ce1586def
commit 9a127193a8
+4 -1
View File
@@ -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();