[FlyDSL] Keep FP4 prefill modules alive across async dispatches - #5126
AMD-yanfeiwang wants to merge 3 commits into
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
PR title tags: |
90f1b05 to
cc1b717
Compare
Preserve the unbounded launcher cache regression while adopting upstream's removal of the FlyDSL availability helper.
| @lru_cache(maxsize=32) | ||
| # Keep compiled launchers alive: eviction can unload a module while an | ||
| # asynchronous dispatch from that specialization is still queued. | ||
| @cache |
There was a problem hiding this comment.
This prevents unsafe eviction, but permanently retains every compiled launcher and GPU module. Since max_blocks_per_seq varies with the page-table width and is only used as the block-table row stride, could we pass the stride at runtime instead of creating an unbounded number of specializations?
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
PR title tags & labels: |
1 similar comment
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
PR title tags & labels: |
Summary
Root cause
The paged FP4 prefill compiler specializes on
max_blocks_per_seqand used a 32-entry LRU. A 128K chunked-prefill workload creates 125 guarded page-table widths. Eviction drops the FlyDSL launcher; FlyDSL 0.3.1 then runsGpuJitModule.__del__, which callsmgpuModuleUnload/hipModuleUnloadwithout first synchronizing outstanding launch streams.In SGLang PR #36581, this produced an eight-GPU memory fault followed by
HSA_STATUS_ERROR_ILLEGAL_INSTRUCTION. ROCm Debug Agent captured 2048 stopped waves and an AQL packet withgrid=131072,workgroup=256, and akernel_objectabsent from the live kernel map. That geometry exactly matches this kernel's 512-CTA x 256-thread prefill launch. Disabling scheduler overlap did not change the signature.An unbounded cache is intentionally used instead of raising the limit: any finite bound can reintroduce unsafe module unload as compile dimensions vary. For the current 128K/page-size-256 integration, width specialization is practically bounded to about 128 entries. Long term, FlyDSL can make module retirement stream-aware.
Validation
1 passedtest_flydsl_pa_mqa_logits_fp4_prefill.py: PASS; 4 prefill and 5 varqlen cases, all exact-reference cosine 1.0126720 + 1024 + 256fault boundary; zero HSA/illegal-instruction fault markers; all scheduler workers remained healthypy_compile, andgit diff --checkpassRelated: sgl-project/sglang#36581