Skip to content

fix(profiler): make trace_view.json compatible with Perfetto / Chrome Trace Format - #156

Open
Rosenbad wants to merge 1 commit into
Ascend:masterfrom
Rosenbad:fix/perfetto-v3
Open

fix(profiler): make trace_view.json compatible with Perfetto / Chrome Trace Format#156
Rosenbad wants to merge 1 commit into
Ascend:masterfrom
Rosenbad:fix/perfetto-v3

Conversation

@Rosenbad

Copy link
Copy Markdown

Problem

Issue #133: torch_npu profiler trace_view.json is incompatible with Perfetto.

Root causes:

  1. ts field was a string, Chrome Trace Format requires a number
  2. ts used absolute epoch timestamps causing float64 precision loss in Perfetto
  3. Flow event id used absolute timestamps exceeding JavaScript MAX_SAFE_INTEGER (2^53)

Changes

torch_npu/profiler/analysis/prof_common_func/_trace_event_manager.py

  • Changed ts from string to numeric float
  • Flow event id now uses sequential counter (under 2^53)

torch_npu/profiler/analysis/prof_view/_trace_view_parser.py

  • Added _normalize_timestamps() to make timestamps relative

Related

Closes #133

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@Rosenbad , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
a79d6fd1 fix(profiler): make trace_view.j... the email used in the commit is an invalid email!
please check all commits.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@Rosenbad

Copy link
Copy Markdown
Author

/check-cla

@ascend-robot

Copy link
Copy Markdown

CLA Signature Guide

@Rosenbad , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
a79d6fd1 fix(profiler): make trace_view.j... the email used in the commit is an invalid email!
please check all commits.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

… Trace Format

Issue: Ascend#133

- Change ts from string to numeric float type
- Use sequential counter for flow event IDs (avoids > 2^53)
- Normalize timestamps to relative values (subtract min ts)
  to eliminate float64 precision loss
@ascend-robot

Copy link
Copy Markdown

CLA Signature Pass

Rosenbad, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@Rosenbad

Copy link
Copy Markdown
Author

/check-cla

@ascend-robot

Copy link
Copy Markdown

CLA Signature Pass

Rosenbad, thanks for your pull request. All authors of the commits have signed the CLA. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

torch_npu profiler 输出的 trace JSON 与 Perfetto 不兼容:ts 为字符串类型 + 绝对时间戳导致精度丢失

2 participants