SWDEV-478929 - Benchmark ReallyQuickPureX Failed

Ensure the member function Alloc() and Free() of command_pool_ will not be
accessed after command_pool_ be destructed.

Signed-off-by: Chong Li <chongli2@amd.com>
Change-Id: Ic2d36423302518a030bd61fa399290ebe2ed8194


[ROCm/clr commit: e6a5c81221]
Этот коммит содержится в:
Chong Li
2024-09-04 20:38:53 +08:00
родитель a3dc515316
Коммит 4979c2f206
3 изменённых файлов: 11 добавлений и 5 удалений
+3 -4
Просмотреть файл
@@ -318,16 +318,15 @@ Command::Command(HostQueue& queue, cl_command_type type, const EventWaitList& ev
}
}
SysmemPool<ComputeCommand> Command::command_pool_ ROCCLR_INIT_PRIORITY(101);
SysmemPool<ComputeCommand>* Command::command_pool_ = new SysmemPool<ComputeCommand>;
// ================================================================================================
void Command::operator delete(void* ptr) {
command_pool_.Free(ptr);
return command_pool_->Free(ptr);
}
// ================================================================================================
void* Command::operator new(size_t size) {
return command_pool_.Alloc(size);
return command_pool_->Alloc(size);
}
// ================================================================================================
+7 -1
Просмотреть файл
@@ -260,7 +260,7 @@ class GraphKernelArgManager {
*/
class Command : public Event {
private:
static SysmemPool<ComputeCommand> command_pool_; //!< Pool of active commands
static SysmemPool<ComputeCommand> *command_pool_; //!< Pool of active commands
HostQueue* queue_; //!< The command queue this command is enqueue into
Command* next_; //!< Next GPU command in the queue list
Command* batch_head_ = nullptr; //!< The head of the batch commands
@@ -310,6 +310,12 @@ class Command : public Event {
public:
//! Returns AQL buffer state
static void ReleaseSysmemPool() {
if (command_pool_ != nullptr) {
delete command_pool_;
command_pool_ = nullptr;
}
}
bool getCapturingState() const { return capturing_; }
//! Sets AQL capture state, aql packet to capture and where to copy kernArgs
+1
Просмотреть файл
@@ -97,6 +97,7 @@ void Runtime::tearDown() {
if (outFile != stderr && outFile != nullptr) {
fclose(outFile);
}
Command::ReleaseSysmemPool();
initialized_ = false;
}