Skip to content

feat: add MLU torch profiler support - #9

Open
kelsieyuan wants to merge 6 commits into
verl-project:mainfrom
kelsieyuan:mlu-add-profiling-support
Open

feat: add MLU torch profiler support#9
kelsieyuan wants to merge 6 commits into
verl-project:mainfrom
kelsieyuan:mlu-add-profiling-support

Conversation

@kelsieyuan

@kelsieyuan kelsieyuan commented Jul 31, 2026

Copy link
Copy Markdown

Add Cambricon MLU profiler integration that monkey-patches verl's torch profiler to support MLU device activities. The patch adds 'mlu' to allowed contents in TorchProfilerToolConfig and uses torch.profiler.ProfilerActivity.MLU when available.

Changes:

  • Add verl_hardware_plugin/profilers/ module with torch_profile_mlu
  • Register profiler patches in plugin init
  • Add profiling guide to MLU user docs
  • Fix directory reference (user_guide_flagos -> user_guide_mlu) in README

Checklist

  • Code follows the project's style and passes pre-commit checks
  • Documentation updated (if applicable)
  • No secrets or credentials included

Add Cambricon MLU profiler integration that monkey-patches verl's torch
profiler to support MLU device activities. The patch adds 'mlu' to
allowed contents in TorchProfilerToolConfig and uses
torch.profiler.ProfilerActivity.MLU when available.

Changes:
- Add verl_hardware_plugin/profilers/ module with torch_profile_mlu
- Register profiler patches in plugin init
- Add profiling guide to MLU user docs
- Fix directory reference (user_guide_flagos -> user_guide_mlu) in README

Co-Authored-By: Claude <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@physics31415926 physics31415926 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please polish the pr description and attach a test result

@kelsieyuan

Copy link
Copy Markdown
Author

test results:
bbf5009e3b915e63a013b50fef12e3db
e58d729e94d904784f7055f680a6b973

PROFILER=(
global_profiler.tool=torch
'global_profiler.steps=[2]'
global_profiler.save_path=./outputs/profile
actor_rollout_ref.actor.profiler.enable=True
actor_rollout_ref.actor.profiler.all_ranks=False
'actor_rollout_ref.actor.profiler.ranks=[0]'
'actor_rollout_ref.actor.profiler.tool_config.torch.contents=[mlu,cpu,memory,shapes,stack]'
actor_rollout_ref.actor.profiler.tool_config.torch.discrete=True
)

@kelsieyuan

Copy link
Copy Markdown
Author

please polish the pr description and attach a test result

done

@@ -0,0 +1,29 @@
"""Profiler integrations via monkey-patching verl's profiler utilities."""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add more discription with copyeight, referring to verl_hardware_plugin\platforms_init_.py

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Added copyright and license information to the file.
Updated licensing information and added copyright notice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants