Skip to content

Commit e16ec20

Browse files
Redesign time correlation in oneprof, improve DPC++ kernel demangling
1 parent b461461 commit e16ec20

29 files changed

+352
-246
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.42.1
1+
0.42.4

build_utils/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ macro(FindIGALibrary TARGET)
166166
"IGA is not found. "
167167
"You may need to install Intel(R) Processor Graphics Driver to fix this issue.")
168168
else()
169+
list(GET IGA_DLL_PATH 0 IGA_DLL_PATH)
169170
message(STATUS
170171
"IGA is found at ${IGA_DLL_PATH}")
171172
find_library(IGA_LIB_PATH

loader/loader.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,10 @@ static bool CheckBitness(HANDLE parent, HANDLE child) {
6363
int main(int argc, char* argv[]) {
6464
std::string library_file_name = GetLibFileName();
6565
std::string executable_path = utils::GetExecutablePath();
66-
std::string library_file_path = executable_path + library_file_name;
6766

67+
std::string library_file_path = executable_path + library_file_name;
6868
if (!IsFileExists(library_file_path.c_str())) {
69-
std::cout << "[ERROR] Failed to find " <<
70-
library_file_name << " near the loader" << std::endl;
71-
return 0;
69+
library_file_path = library_file_name;
7270
}
7371

7472
SharedLibrary* lib = SharedLibrary::Create(library_file_path);

tests/run.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
["sysmon", "-p", "-l", "-d"],
3636
["onetrace",
3737
"-c", "-h", "-d", "-v", "-t", "-s",
38+
"--demangle",
3839
"--kernels-per-tile",
3940
"--chrome-call-logging",
4041
"--chrome-device-timeline",
@@ -44,6 +45,7 @@
4445
"cl", "ze", "omp"],
4546
["cl_tracer",
4647
"-c", "-h", "-d", "-v", "-t", "-s",
48+
"--demangle",
4749
"--chrome-call-logging",
4850
"--chrome-device-timeline",
4951
"--chrome-kernel-timeline",
@@ -52,6 +54,7 @@
5254
"gpu", "dpc", "omp"],
5355
["ze_tracer",
5456
"-c", "-h", "-d", "-v", "-t", "-s",
57+
"--demangle",
5558
"--kernels-per-tile",
5659
"--chrome-call-logging",
5760
"--chrome-device-timeline",

tests/tools/cl_tracer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def run(path, option):
5151
if option == "gpu":
5252
command = [file_name_prefix + "cl_tracer" + file_extention,\
5353
"-h", "-d", "-t", app_file, "gpu", "1024", "1"]
54-
elif option == "-v" or option == "--conditional-collection":
54+
elif option == "-v" or option == "--demangle" or option == "--conditional-collection":
5555
command = [file_name_prefix + "cl_tracer" + file_extention,\
5656
"-d", option, app_file, "cpu", "1024", "1"]
5757
else:
@@ -102,6 +102,8 @@ def main(option):
102102
option = "-s"
103103
if len(sys.argv) > 1 and sys.argv[1] == "-v":
104104
option = "-v"
105+
if len(sys.argv) > 1 and sys.argv[1] == "--demangle":
106+
option = "--demangle"
105107
if len(sys.argv) > 1 and sys.argv[1] == "--chrome-call-logging":
106108
option = "--chrome-call-logging"
107109
if len(sys.argv) > 1 and sys.argv[1] == "--chrome-device-timeline":

tests/tools/onetrace.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ def run(path, option):
3535
app_folder = utils.get_sample_executable_path("omp_gemm")
3636
app_file = os.path.join(app_folder, "omp_gemm")
3737
command = ["./onetrace", "-h", "-d", "-t", app_file, "gpu", "1024", "1"]
38-
elif option == "-v" or option == "--kernels-per-tile" or option == "--conditional-collection":
38+
elif option == "-v" or option == "--demangle" or\
39+
option == "--kernels-per-tile" or option == "--conditional-collection":
3940
app_folder = utils.get_sample_executable_path("dpc_gemm")
4041
app_file = os.path.join(app_folder, "dpc_gemm")
4142
command = ["./onetrace", "-d", option, app_file, "gpu", "1024", "1"]
@@ -88,6 +89,8 @@ def main(option):
8889
option = "-s"
8990
if len(sys.argv) > 1 and sys.argv[1] == "-v":
9091
option = "-v"
92+
if len(sys.argv) > 1 and sys.argv[1] == "--demangle":
93+
option = "--demangle"
9194
if len(sys.argv) > 1 and sys.argv[1] == "--kernels-per-tile":
9295
option = "--kernels-per-tile"
9396
if len(sys.argv) > 1 and sys.argv[1] == "--chrome-call-logging":

tests/tools/ze_tracer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def run(path, option):
3030
app_folder = utils.get_sample_executable_path("omp_gemm")
3131
app_file = os.path.join(app_folder, "omp_gemm")
3232
command = ["./ze_tracer", "-h", "-d", "-t", app_file, "gpu", "1024", "1"]
33-
elif option == "-v" or option == "--kernels-per-tile" or option == "--conditional-collection":
33+
elif option == "-v" or option == "--demangle" or\
34+
option == "--kernels-per-tile" or option == "--conditional-collection":
3435
app_folder = utils.get_sample_executable_path("ze_gemm")
3536
app_file = os.path.join(app_folder, "ze_gemm")
3637
command = ["./ze_tracer", "-d", option, app_file, "1024", "1"]
@@ -81,6 +82,8 @@ def main(option):
8182
option = "-s"
8283
if len(sys.argv) > 1 and sys.argv[1] == "-v":
8384
option = "-v"
85+
if len(sys.argv) > 1 and sys.argv[1] == "--demangle":
86+
option = "--demangle"
8487
if len(sys.argv) > 1 and sys.argv[1] == "--kernels-per-tile":
8588
option = "--kernels-per-tile"
8689
if len(sys.argv) > 1 and sys.argv[1] == "--chrome-call-logging":

tools/cl_tracer/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Options:
1616
--chrome-kernel-timeline Dump device activities to JSON file per kernel name
1717
--chrome-device-stages Dump device activities by stages to JSON file
1818
--verbose [-v] Enable verbose mode to show more kernel information
19+
--demangle Demangle DPC++ kernel names
1920
--tid Print thread ID into host API trace
2021
--pid Print process ID into host API and device activity trace
2122
--output [-o] <filename> Print console logs into the file

tools/cl_tracer/cl_api_callbacks.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2931,7 +2931,8 @@ static void clEnqueueTaskOnEnter(
29312931
stream << " commandQueue = " << *(params->commandQueue);
29322932
stream << " kernel = " << *(params->kernel);
29332933
if (*(params->kernel) != nullptr) {
2934-
std::string kernel_name = utils::cl::GetKernelName(*(params->kernel));
2934+
std::string kernel_name = utils::cl::GetKernelName(
2935+
*(params->kernel), collector->Demangle());
29352936
if (!kernel_name.empty()) {
29362937
stream << " (" << kernel_name << ")";
29372938
}
@@ -3582,7 +3583,8 @@ static void clEnqueueNDRangeKernelOnEnter(
35823583
stream << " commandQueue = " << *(params->commandQueue);
35833584
stream << " kernel = " << *(params->kernel);
35843585
if (*(params->kernel) != nullptr) {
3585-
std::string kernel_name = utils::cl::GetKernelName(*(params->kernel));
3586+
std::string kernel_name = utils::cl::GetKernelName(
3587+
*(params->kernel), collector->Demangle());
35863588
if (!kernel_name.empty()) {
35873589
stream << " (" << kernel_name << ")";
35883590
}
@@ -5966,6 +5968,9 @@ static void clCreateKernelOnEnter(
59665968
stream << " kernelName = \"\"";
59675969
} else {
59685970
stream << " kernelName = \"" << *(params->kernelName) << "\"";
5971+
if (collector->Demangle()) {
5972+
stream << " (" << utils::Demangle(*(params->kernelName)) << ")";
5973+
}
59695974
}
59705975
stream << " errcodeRet = " << *(params->errcodeRet);
59715976
stream << std::endl;

tools/cl_tracer/cl_api_collector.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ClApiCollector {
6060
static ClApiCollector* Create(
6161
cl_device_id device,
6262
Correlator* correlator,
63-
ApiCollectorOptions options = {false, false, false},
63+
ApiCollectorOptions options,
6464
OnClFunctionFinishCallback callback = nullptr,
6565
void* callback_data = nullptr) {
6666
PTI_ASSERT(device != nullptr);
@@ -115,6 +115,10 @@ class ClApiCollector {
115115
return options_.need_pid;
116116
}
117117

118+
bool Demangle() const {
119+
return options_.demangle;
120+
}
121+
118122
void Log(const std::string& text) {
119123
PTI_ASSERT(correlator_ != nullptr);
120124
correlator_->Log(text);
@@ -332,7 +336,7 @@ class ClApiCollector {
332336
ClApiTracer* tracer_ = nullptr;
333337

334338
Correlator* correlator_ = nullptr;
335-
ApiCollectorOptions options_ = {false, false, false};
339+
ApiCollectorOptions options_;
336340
cl_device_type device_type_ = CL_DEVICE_TYPE_ALL;
337341

338342
OnClFunctionFinishCallback callback_ = nullptr;

0 commit comments

Comments
 (0)