PyTorch Profiler crashes on P800 XPU due to a CUPTI bug in
cuptiActivityDisable() that SIGKILLs the server process. This
module provides an alternative by monkey-patching SGLang's
DeepSeek-V4 decoder layer and its sub-operators to record
per-op wall-clock timing.
What it does:
- Patches DeepseekV4DecoderLayer.forward and sub-operators
(hc_pre/hc_post, RMSNorm, MQALayer attention, QKV projection,
DeepseekV2MoE and its gate/shared/routed experts) with timed
wrappers that call torch.cuda.synchronize() before and after.
- Distinguishes prefill vs decode via forward_batch flags
(is_prefill_only / is_extend_in_batch / extend_num_tokens)
and propagates the phase to sub-operators via threading.local.
- Writes per-PID JSON summaries (count/avg/p50/p95/p99) every
5000 records plus on atexit/SIGTERM, so data survives when
the server is stopped.
Usage: set SGLANG_TIMING_ENABLED=1 in the container environment.
Output: /tmp/p800_timing_results_{pid}.json
Known limitations:
- torch.cuda.synchronize() adds overhead, inflating small-op times.
- moe_routed_ms only covers forward_normal (65% of calls); the
dual_stream path taken during CUDA graph capture is not patched.
- All-reduce patch fails (Communicator import path mismatch).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- New experiment: dsv4_p800_sglang_profile for PyTorch profiler testing
- Documents XPU cuptiActivityDisable bug (error 17) when saving traces
- Includes benchmark results (ISL=4k, OSL=1k, C=16, TP8/DP1)
- PROFILE_REPORT.md with full analysis of P800 vs H20 performance gap
- Add dsv4_p800_sglang_tp_dp_official experiment config
- New experiment: dsv4_p800_sglang_profile for PyTorch profiler testing
- Documents XPU cuptiActivityDisable bug (error 17) when saving traces
- Includes benchmark results (ISL=4k, OSL=1k, C=16, TP8/DP1)
- PROFILE_REPORT.md with full analysis of P800 vs H20 performance gap
- Add dsv4_p800_sglang_tp_dp_official experiment config
- Created adaptive_summary.md to summarize adaptive concurrency search results, including metrics such as TP, DP, and TPS.
- Added run_manifest.json to document experiment configuration details, including hardware specifications and search parameters.
- Introduced shapes.tsv to define input and output lengths for various configurations in the adaptive experiment.
- Introduced a new CUDA kernel for transposing and packing FP32 into UE8.
- Added binary file for the new kernel.
- Created multiple autotune configuration files for version 0.6.14 of FlashInfer, supporting various input shapes and configurations.
- Added model information JSON for DeepseekV4ForCausalLM, detailing its architecture and capabilities.
- New experiments/p800/dsv4_p800_sglang_tp_dp_matrix: TP8/DP1, TP4/DP2,
TP2/DP4 matrix with smoke results; TP2/DP4 documents the weight-loading
OOM root cause (274 GiB INT8 weights sharded only across TP group).
- Launch args drop --ep-size/--chunked-prefill-size/--max-prefill-tokens/
--max-running-requests; experts fall back to TP sharding.
- Move dsv4_p800_256k_4k_probe under experiments/p800/.
- scripts/common: jq-free parsing fixes in adaptive_bench_lib.sh and
parse_backend.py.
- .gitignore: cover raw_outputs under nested platform experiment layout.
- Add envs/UV_ENV_SETUP.md with standard commands for creating
vLLM and SGLang virtual environments using uv.
- Configure UV_CACHE_DIR under envs/ to avoid polluting home directory.
- Include cu129-specific reinstall steps for SGLang kernel packages.
- Update envs/README.md to reference the new guide.
- Add RESUME_RUN_ID env var for breakpoint resume in adaptive benchmarks.
When set, the script reuses an existing result directory and skips
already-tested (TP, DP, ISL, OSL) shapes based on adaptive_shapes.jsonl.
- Fix RUN_ID unbound variable in resume mode.
- Fix jq query to use -s (slurp) for jsonl files.
- Add resume skip logic to DRY_RUN mode as well.
- Rename DSL -> OSL across all adaptive benchmark files for consistency:
- scripts/common/adaptive_bench_lib.sh
- scripts/common/adaptive_concurrency.py
- experiments/dsv4_h200_vllm_tp_dp_matrix/adaptive_config.env
- experiments/dsv4_h200_vllm_tp_dp_matrix/run_adaptive_concurrency.sh
- experiments/dsv4_h200_sglang_tp_dp_matrix/adaptive_config.env
- experiments/dsv4_h200_sglang_tp_dp_matrix/run_adaptive_concurrency.sh
- experiments/ADAPTIVE_CONCURRENCY_USAGE.md