SWDEV-467069 - Added safety check in activity prof for accumulate command
Adding a safety check prevents an invalid memory access if timestamps and kernelNames vectors are of different size. The patch also moves the addKernelNames for the accumulate command into dispatchAqlPacket function. Change-Id: Iea0927e1253800403a1ae3f3d72de1e7d96476c3
This commit is contained in:
@@ -105,13 +105,10 @@ void ReportActivity(const amd::Command& command) {
|
||||
auto timestamps = static_cast<const amd::AccumulateCommand&>(command).getTimestamps();
|
||||
std::vector<std::string> kernel_names =
|
||||
static_cast<const amd::AccumulateCommand&>(command).getKernelNames();
|
||||
for (uint32_t i = 0; i < timestamps.size(); i++) {
|
||||
for (uint32_t i = 0; i < timestamps.size() && i < kernel_names.size(); i++) {
|
||||
auto it = timestamps[i];
|
||||
record.begin_ns = it.first;
|
||||
record.end_ns = it.second;
|
||||
if (kernel_names[i].empty()) {
|
||||
LogError("kernel name cannot be empty");
|
||||
}
|
||||
record.kernel_name = kernel_names[i].c_str();
|
||||
function(ACTIVITY_DOMAIN_HIP_OPS, operation_id, &record);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user