Add support for kernel name filtering to rocprofv2

rocprofv2 does not support the "kernel:" attribute in
input files. This commit adds support for this attribute
for cli/csv output. This is requested by Alibaba/Omniperf
to have compatible execution with both v1/v2 (JSON and CTF
are not supported here and not needed).

Filtering can also be enabled by the flag ROCPROFILER_KERNEL_FILTER.

Change-Id: I376382d9e5b10a8356df8d175b1a56396b5b51d3


[ROCm/rocprofiler commit: b32eb2bda9]
This commit is contained in:
Benjamin Welton
2024-08-08 01:14:38 +00:00
committed by Benjamin Welton
parent a34d5dbc16
commit c45fbe91ff
4 changed files with 78 additions and 1 deletions
+18
View File
@@ -32,6 +32,8 @@
#include <cstdint>
#include <cstdlib>
#include <string>
#include <set>
#include <sstream>
#include "src/utils/helper.h"
@@ -51,4 +53,20 @@ namespace {
[[maybe_unused]] uint64_t GetMachineID() { return gethostid(); }
[[maybe_unused]] std::set<std::string> GetKernelFilters() {
std::set<std::string> ret;
if (const char* line_c_str = getenv("ROCPROFILER_KERNEL_FILTER")) {
std::stringstream ss(std::string{line_c_str});
std::string filter_name;
while(std::getline(ss, filter_name, ' '))
{
if (filter_name.find("kernel:") != std::string::npos) {
continue;
}
ret.insert(filter_name);
}
}
return ret;
}
} // namespace