diff --git a/paddle/fluid/platform/device_tracer.cc b/paddle/fluid/platform/device_tracer.cc index 265343573b3c85335f0b1c9a55e60cf9cf13f3c3..e2fd8e90b682a24b06a237cb0e2ba52c6dd2f95c 100644 --- a/paddle/fluid/platform/device_tracer.cc +++ b/paddle/fluid/platform/device_tracer.cc @@ -192,6 +192,12 @@ class DeviceTracerImpl : public DeviceTracer { } void AddCPURecords(const char *anno, uint64_t start_ns, uint64_t end_ns) { + if (!anno) { + // TODO(panyx0718): Currently, it doesn't support nested situation + // Up-level can be cleared by low-level and therefore get nullptr + // here. + return; + } std::lock_guard l(trace_mu_); cpu_records_.push_back( CPURecord{anno, start_ns, end_ns,