Skip to content

[hardware, perf, training_utils] move_attn to device agnostic and handle profiler_markers - #30

Merged
kahlun merged 1 commit into
intel-xpu-plugin-e2e-vllmfrom
rework/7917-apply-1
Oct 8, 2026
Merged

kahlun merged 1 commit into
intel-xpu-plugin-e2e-vllmfrom
rework/7917-apply-1

Conversation

@kahlun

@kahlun kahlun commented Oct 8, 2026

Copy link
Copy Markdown
Owner

… hooks to profiler_markers()

Applies wuxibin89's review of verl-project#7917. Three changes, in the order they were raised:

  1. Drop PlatformBase.attention_utils_module(). npu_flash_attn_utils is already verl-core and imports nothing but torch/F/einops, so a core->core indirection through the plugin bought nothing. _get_attention_functions() now uses it whenever flash_attn will not import, the duplicated _fallback_* helpers are deleted, and the module is renamed to the device-neutral attention_padding_utils. The torch_functional.py and test call-site cleanups are kept.

  2. Drop PlatformBase.dist_profiler_cls(). engine_workers.py now converts tool_config for any configured tool instead of an allowlist -- omega_conf_to_dataclass returns None for a missing/empty config, so a tool with no tool_config entry still works and a plugin tool can name its own dataclass via _target_. The three rollout-server edits are reverted: profiler_controller there only gates, the real profiling goes through engine.start_profile(), so a plugin profiler's start/stop never ran.

  3. Keep profiler_markers(), and fix a bug in it. Resolution checked is_nvtx_available() first, but nvtx ships in the verl-core extra, so on any box where it imports the hook was dead. The platform is now asked first, falling back to nvtx, then mstx, then the generic markers.

What does this PR do?

Add concise overview of what this PR aims to achieve or accomplish. Reference related GitHub issues and PRs that help with the review.

Checklist Before Starting

  • Search for similar PRs. Paste at least one query link here: ...
  • Format the PR title as [{modules}] {type}: {description} (This will be checked by the CI)
    • {modules} include fsdp, megatron, veomni, sglang, vllm, rollout, trainer, ci, training_utils, recipe, hardware, deployment, ray, worker, single_controller, misc, perf, model, algo, env, tool, ckpt, doc, data, cfg, reward, fully_async, one_step_off
    • If this PR involves multiple modules, separate them with , like [megatron, fsdp, doc]
    • {type} is in feat, fix, refactor, chore, test
    • If this PR breaks any API (CLI arguments, config, function signature, etc.), add [BREAKING] to the beginning of the title.
    • Example: [BREAKING][fsdp, megatron] feat: dynamic batching

Test

For changes that can not be tested by CI (e.g., algorithm implementation, new model support), validate by experiment(s) and show results like training curve plots, evaluation results, etc.

API and Usage Example

Demonstrate how the API changes if any, and provide usage example(s) if possible.

# Add code snippet or script demonstrating how to use this

Design & Code Changes

Demonstrate the high-level design if this PR is complex, and list the specific changes.

Checklist Before Submitting

Important

Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Required duplicate-work and test evidence remain absent from the PR description.

1 open finding
What changed in this PR

Narrows platform plugin hooks while preserving device-neutral attention fallbacks and platform-specific profiling markers.

Changes:

  • Replaces attention plugin dispatch with shared PyTorch padding utilities.
  • Removes plugin profiler-class dispatch and generalizes tool-config conversion.
  • Prioritizes platform markers and updates profiler/attention tests.
File Description
verl/​workers/​rollout/​vllm_rollout/​vllm_async_server.py Restricts rollout profiler tools.
verl/​workers/​rollout/​trtllm_rollout/​trtllm_async_server.py Removes plugin profiler handling.
verl/​workers/​rollout/​sglang_rollout/​async_sglang_server.py Restricts rollout profiler tools.
verl/​workers/​engine_workers.py Generalizes tool-config conversion.
verl/​utils/​profiler/​profile.py Removes platform profiler dispatch.
verl/​utils/​profiler/​__init__.py Prioritizes platform marker resolution.
verl/​utils/​attention_utils.py Uses shared attention-padding fallback.
verl/​utils/​attention_padding_utils.py Documents device-neutral implementation.
verl/​plugin/​platform/​platform_base.py Narrows platform extension hooks.
tests/​utils/​test_profiler_plugin_hooks.py Removes obsolete combined hook tests.
tests/​utils/​test_profiler_markers.py Tests marker precedence and fallbacks.
tests/​utils/​test_attention_utils.py Tests dispatch and padding behavior.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread tests/utils/test_attention_utils.py Outdated
def reset_platform():
pm._current_platform = None
def reset_dispatch_cache():
"""_get_attention_functions() memoizes into module globals; clear them per test."""
… hooks to profiler_markers()

Applies wuxibin89's review of verl-project#7917. Three changes, in the order they were
raised:

1. Drop `PlatformBase.attention_utils_module()`. `npu_flash_attn_utils` is
   already verl-core and imports nothing but torch/F/einops, so a core->core
   indirection through the plugin bought nothing. `_get_attention_functions()`
   now uses it whenever `flash_attn` will not import, the duplicated
   `_fallback_*` helpers are deleted, and the module is renamed to the
   device-neutral `attention_padding_utils`. The `torch_functional.py` and
   test call-site cleanups are kept.

2. Drop `PlatformBase.dist_profiler_cls()`. `engine_workers.py` now converts
   `tool_config` for any configured tool instead of an allowlist --
   `omega_conf_to_dataclass` returns None for a missing/empty config, so a
   tool with no `tool_config` entry still works and a plugin tool can name its
   own dataclass via `_target_`. The three rollout-server edits are reverted:
   `profiler_controller` there only gates, the real profiling goes through
   `engine.start_profile()`, so a plugin profiler's start/stop never ran.

3. Keep `profiler_markers()`, and fix a bug in it. Resolution checked
   `is_nvtx_available()` first, but nvtx ships in the `verl-core` extra, so on
   any box where it imports the hook was dead. The platform is now asked
   first, falling back to nvtx, then mstx, then the generic markers.
@kahlun
kahlun force-pushed the rework/7917-apply-1 branch from a0618f9 to 72e089d Compare October 8, 2026 06:07
@kahlun kahlun changed the title [hardware, perf, training_utils] refactor: narrow the plugin platform… [hardware, perf, training_utils] move_attn to device agnostic and handle profiler_markers Oct 8, 2026
@kahlun
kahlun marked this pull request as ready for review October 8, 2026 06:15
@kahlun
kahlun merged commit 7d2c269 into intel-xpu-plugin-e2e-vllm Oct 8, 2026
4 of 5 checks passed
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