Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommandQueueMT: Pre-allocate memory to avoid a bunch of allocations at startup #91727

Merged
merged 1 commit into from
May 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/templates/command_queue_mt.cpp
Original file line number Diff line number Diff line change
@@ -42,6 +42,7 @@ void CommandQueueMT::unlock() {
}

CommandQueueMT::CommandQueueMT() {
command_mem.reserve(DEFAULT_COMMAND_MEM_SIZE_KB * 1024);
}

CommandQueueMT::~CommandQueueMT() {
4 changes: 1 addition & 3 deletions core/templates/command_queue_mt.h
Original file line number Diff line number Diff line change
@@ -325,9 +325,7 @@ class CommandQueueMT {

/***** BASE *******/

enum {
DEFAULT_COMMAND_MEM_SIZE_KB = 256,
};
static const uint32_t DEFAULT_COMMAND_MEM_SIZE_KB = 64;

BinaryMutex mutex;
LocalVector<uint8_t> command_mem;