Skip to content

feat(rhaiis): add native HTTP profiler backend [Under test] - #182

Open
naveenmiriyaluredhat wants to merge 1 commit into
openshift-psap:mainfrom
naveenmiriyaluredhat:feat/rhaiis-native-profiler
Open

feat(rhaiis): add native HTTP profiler backend [Under test]#182
naveenmiriyaluredhat wants to merge 1 commit into
openshift-psap:mainfrom
naveenmiriyaluredhat:feat/rhaiis-native-profiler

Conversation

@naveenmiriyaluredhat

Copy link
Copy Markdown

Add a second profiler collection path that uses the engine's own /start_profile and /stop_profile APIs instead of the vLLM mutating webhook. Trace copy and S3 upload stay on the same path; only how capture is armed changes.

Backends

  • webhook (default): unchanged. Label the ISVC, write /tmp/profiler_gate, run GuideLLM, copy /tmp/trace_.json. The webhook counts execute_model calls (typically 500-503); GuideLLM does not stop when that range ends.
  • native: deploy with vLLM --profiler-config (0.13+) or SGLang SGLANG_TORCH_PROFILER_DIR, POST /start_profile, run the same profiler GuideLLM load, POST /stop_profile (flush can take many minutes), copy traces_dir. /stop_profile 404 means the process was not started with profiler-config.

GuideLLM during Phase 1 is a fixed wall clock: rhaiis.profiler.max_seconds (default 200s) at rhaiis.profiler.rates (default 200 concurrent). It is independent of the webhook call range and of native delay/max_iterations.

Native kinds (vLLM --profiler-config.profiler)

  • torch: PyTorch profiler → Chrome/Perfetto json.gz (default).
  • cuda: CUDA Profiler API; set native.nsys_wrap to wrap the process in nsys (serving image must contain nsys).
  • proton: Triton Proton (CUPTI), enforce-eager; chrome_trace or hatchet.

SGLang uses the same native HTTP flow (no webhook). Start body carries num_steps/start_step/activities. TRT-LLM is still unsupported.

Implementation

  • orchestration/profiler.py builds profiler-config JSON and mutates ServingRuntime args/env.
  • toolbox/control_native_profiler POSTs start/stop with a long stop timeout.
  • copy_profiler_traces accepts remote_dir and normalizes native filenames so S3 still matches trace_rank0.
  • Nightlies that only set profiler.enabled keep the webhook backend.

Reference presets (stack with a model + workload):
profiler-webhook, profiler-native, profiler-native-short,
profiler-native-window, profiler-native-cuda, profiler-native-proton,
profiler-native-sglang

--preset llama-8b --preset profile1 --preset profiler-native-short

Add a second profiler collection path that uses the engine's own
/start_profile and /stop_profile APIs instead of the vLLM mutating
webhook. Trace copy and S3 upload stay on the same path; only how
capture is armed changes.

Backends
- webhook (default): unchanged. Label the ISVC, write /tmp/profiler_gate,
  run GuideLLM, copy /tmp/trace_*.json*. The webhook counts execute_model
  calls (typically 500-503); GuideLLM does not stop when that range ends.
- native: deploy with vLLM --profiler-config (0.13+) or SGLang
  SGLANG_TORCH_PROFILER_DIR, POST /start_profile, run the same profiler
  GuideLLM load, POST /stop_profile (flush can take many minutes), copy
  traces_dir. /stop_profile 404 means the process was not started with
  profiler-config.

GuideLLM during Phase 1 is a fixed wall clock: rhaiis.profiler.max_seconds
(default 200s) at rhaiis.profiler.rates (default 200 concurrent). It is
independent of the webhook call range and of native delay/max_iterations.

Native kinds (vLLM --profiler-config.profiler)
- torch: PyTorch profiler → Chrome/Perfetto json.gz (default).
- cuda: CUDA Profiler API; set native.nsys_wrap to wrap the process in nsys
  (serving image must contain nsys).
- proton: Triton Proton (CUPTI), enforce-eager; chrome_trace or hatchet.

SGLang uses the same native HTTP flow (no webhook). Start body carries
num_steps/start_step/activities. TRT-LLM is still unsupported.

Implementation
- orchestration/profiler.py builds profiler-config JSON and mutates
  ServingRuntime args/env.
- toolbox/control_native_profiler POSTs start/stop with a long stop timeout.
- copy_profiler_traces accepts remote_dir and normalizes native filenames
  so S3 still matches trace_*rank0*.
- Nightlies that only set profiler.enabled keep the webhook backend.

Reference presets (stack with a model + workload):
  profiler-webhook, profiler-native, profiler-native-short,
  profiler-native-window, profiler-native-cuda, profiler-native-proton,
  profiler-native-sglang

  --preset llama-8b --preset profile1 --preset profiler-native-short

Co-authored-by: Cursor <cursoragent@cursor.com>
@openshift-ci

openshift-ci Bot commented Aug 21, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign ashishkamra for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fe893742-b016-4309-aa27-04b737f3fc5e


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@naveenmiriyaluredhat naveenmiriyaluredhat changed the title feat(rhaiis): add native HTTP profiler backend feat(rhaiis): add native HTTP profiler backend [Under test] Aug 21, 2026
@naveenmiriyaluredhat

Copy link
Copy Markdown
Author

@kpouget @Harshith-umesh I am still testing this feature

profiler-native-window:
rhaiis.profiler.enabled: true
rhaiis.profiler.backend: native
rhaiis.profiler.kind: torch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

here you should use the extends flag:

profiler-native-short:
    extends: [profiler-native]
    rhaiis.profiler.rates: [1]
    rhaiis.profiler.max_seconds: 60

that's a simple mechanism that just inserts the profile-native presets at the location of the extends marker

Comment on lines +236 to +242
"nsys",
"profile",
"--trace-fork-before-exec=true",
"--cuda-graph-trace=node",
"--capture-range=cudaProfilerApi",
"--capture-range-end=repeat",
f"--output={nsys_output}",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I try to keep all the constants in the config. That's not an absolute rule, more a guideline.
If you have:

nsys:
  profile:
     args:
       trace_fork_before_exec: true
       cuda_graph_trace: node
       capture_range: cudaProfilerApi
       capture_range_end: repeat

then maybe another way you (or someone else) will be happy to just have to define a preset to change

nsys.profile.args.cuda_graph_trace: cluster # random example

Comment on lines +125 to +126
env_vars.setdefault("VLLM_RPC_TIMEOUT", DEFAULT_RPC_TIMEOUT_MS)
env_vars.setdefault("VLLM_RPC_GET_DATA_TIMEOUT_MS", DEFAULT_RPC_TIMEOUT_MS)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

default values can be in the config
same reason as above, if on a "busy day" you find that the timeout is too short, you'll be happy to extend it with a preset

Comment on lines +849 to +854
image=benchmark_cfg.get("image", "ghcr.io/vllm-project/guidellm:v0.6.0"),
timeout=benchmark_timeout,
pvc_size=benchmark_cfg.get("pvc_size", "5Gi"),
guidellm_args=guidellm_args,
hf_token_secret=benchmark_cfg.get("hf_token_secret", ""),
fs_group=benchmark_cfg.get("fs_group"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

shouldn't have default values here IMO, if the config is malformed you want to know it rightaway when you smoke test

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