未验证 提交 963163e6 编写于 作者: C chenjian 提交者: GitHub

fix record event for operator type in new dygraph (#44582)

* fix new dygraph record event for op

* update unit test
上级 9b662bef
......@@ -1386,7 +1386,7 @@ static std::string GenerateGradNodeCreationContent(
"%s"
" {\n"
" paddle::platform::RecordEvent node_creation_record_event(\"%s\", "
"paddle::platform::TracerEventType::Operator, 1);\n"
"paddle::platform::TracerEventType::OperatorInner, 1);\n"
"%s"
" if(require_any_grad) {\n"
" VLOG(6) << \" Construct Grad for %s \"; \n"
......
......@@ -111,7 +111,7 @@ PARSE_PYTHON_C_ARGS_TEMPLATE = \
RECORD_EVENT_TEMPLATE = \
"paddle::platform::RecordEvent {}(\"{} {}\", paddle::platform::TracerEventType::Operator, 1);"
"paddle::platform::RecordEvent {}(\"{} {}\", paddle::platform::TracerEventType::UserDefined, 1);"
RETURN_INPLACE_PYOBJECT_TEMPLATE = \
......
......@@ -851,7 +851,7 @@ void Backward(
bool retain_graph) {
VLOG(3) << "Run in Backward";
paddle::platform::RecordEvent backward_record_event(
"backward", paddle::platform::TracerEventType::Operator, 1);
"backward", paddle::platform::TracerEventType::UserDefined, 1);
RunBackward(tensors, grad_tensors, retain_graph);
phi::autotune::AutoTuneStatus::Instance().Update();
}
......
......@@ -603,7 +603,7 @@ void ChromeTracingLogger::StartLog() {
std::string(
R"JSON(
{
"id": %d, "name": "%s", "totalGlobalMem": %u,
"id": %d, "name": "%s", "totalGlobalMem": %llu,
"computeMajor": %d, "computeMinor": %d,
"maxThreadsPerBlock": %d, "maxThreadsPerMultiprocessor": %d,
"regsPerBlock": %d, "regsPerMultiprocessor": %d, "warpSize": %d,
......@@ -633,7 +633,7 @@ void ChromeTracingLogger::StartLog() {
std::string(
R"JSON(
{
"id": %d, "name": "%s", "totalGlobalMem": %u,
"id": %d, "name": "%s", "totalGlobalMem": %llu,
"computeMajor": %d, "computeMinor": %d,
"maxThreadsPerBlock": %d, "maxThreadsPerMultiprocessor": %d,
"regsPerBlock": %d, "regsPerMultiprocessor": %d, "warpSize": %d,
......
......@@ -82,9 +82,9 @@ class TestProfilerStatistic(unittest.TestCase):
profiler.TracerEventType.Forward, 50, 110,
1000, 1001)
userdefined_node = HostPythonNode('Communication Time',
profiler.TracerEventType.UserDefined,
100, 110, 1000, 1001)
userdefined_node = HostPythonNode(
'Communication Time', profiler.TracerEventType.PythonUserDefined,
100, 110, 1000, 1001)
communication_node = HostPythonNode(
'Communication', profiler.TracerEventType.Communication, 105, 110,
......@@ -209,7 +209,7 @@ class TestProfilerStatistic(unittest.TestCase):
0, profiler.TracerEventType.Memcpy), 60)
self.assertEqual(
time_range_summary.get_cpu_range_sum(
profiler.TracerEventType.UserDefined), 25)
profiler.TracerEventType.UserDefined), 15)
self.assertEqual(
time_range_summary.get_cpu_range_sum(
profiler.TracerEventType.Communication), 5)
......@@ -277,9 +277,9 @@ class TestProfilerStatistic(unittest.TestCase):
profiler.TracerEventType.Forward, 50, 110,
1000, 1001)
userdefined_node = HostPythonNode('Communication Time',
profiler.TracerEventType.UserDefined,
100, 110, 1000, 1001)
userdefined_node = HostPythonNode(
'Communication Time', profiler.TracerEventType.PythonUserDefined,
100, 110, 1000, 1001)
allreduce_launchkernel0 = HostPythonNode(
'cudalaunchkernel', profiler.TracerEventType.CudaRuntime, 102, 104,
1000, 1001)
......@@ -451,7 +451,7 @@ class TestProfilerStatistic(unittest.TestCase):
0, profiler.TracerEventType.Memcpy), 60)
self.assertEqual(
time_range_summary.get_cpu_range_sum(
profiler.TracerEventType.UserDefined), 25)
profiler.TracerEventType.UserDefined), 15)
self.assertEqual(
time_range_summary.get_cpu_range_sum(
profiler.TracerEventType.Communication), 5)
......@@ -518,9 +518,9 @@ class TestProfilerStatistic(unittest.TestCase):
optimization_node = HostPythonNode(
'Optimization', profiler.TracerEventType.Optimization, 220, 300,
1000, 1001)
userdefined_node = HostPythonNode('Communication Time',
profiler.TracerEventType.UserDefined,
60, 70, 1000, 1001)
userdefined_node = HostPythonNode(
'Communication Time', profiler.TracerEventType.PythonUserDefined,
60, 70, 1000, 1001)
conv2d_node = HostPythonNode('conv2d',
profiler.TracerEventType.Operator, 25, 25,
......
......@@ -514,7 +514,8 @@ class EventSummary:
or 'memset' in host_statistic_node.name.lower():
self.add_memory_manipulation_item(host_statistic_node)
else:
self.add_userdefined_item(host_statistic_node)
if host_statistic_node.type == TracerEventType.PythonUserDefined:
self.add_userdefined_item(host_statistic_node)
self.add_kernel_item(host_statistic_nodes[0])
for threadid, root_statistic_node in node_statistic_trees.items():
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册