Repository navigation
fix(kimi-k3): lazy-import the Triton MLA builder; fix(atomesh-ci): raise the Mesh build open-file limit - #2664
junyyang-amd wants to merge 2 commits into
Conversation
…_MLA is set kimi_mla_gdn_attn imported triton_mla at module load to define KimiTritonMLAGDNMetadataBuilder, so Kimi-K3 pulled in aiter's Triton MLA decode even on the default aiter MLA path. aiter #6633 removed aiter.ops.triton.attention.mla_decode, and every Kimi-K3 server now fails at startup with ModuleNotFoundError. Move KimiTritonMLAGDNMetadataBuilder to kimi_triton_mla_gdn_attn and import it from get_builder_cls only when ATOM_USE_TRITON_MLA is set, as the selector already does for DeepSeek and GLM. The default path returns the same KimiAiterMLAGDNMetadataBuilder as before. Co-authored-by: Cursor <cursoragent@cursor.com>
🏷️ CI GuideRuns automatically on every eligible PR before approval:
Heavy model tests:
|
Since #2625 moved the Mesh Cargo cache to <log root>/.mesh-cache, every host starts with an empty cache and Cargo compiles all crates at once, one rustc per CPU (192 on MI350 nodes). The build container ran with Docker's default soft limit of 1024 open files, so both build attempts failed with "Too many open files (os error 24)" and the router never started (run 39580104520, jobs 14061 and 14073). Give it the same nofile limit as the service containers. Co-authored-by: Cursor <cursoragent@cursor.com>
valar-cop
left a comment
There was a problem hiding this comment.
not ready yet.. un-skipping a test that then fails is not ok.
atom/model_ops/attentions/kimi_mla_gdn_attn.py:30 — this un-skips test_gdn_state_relocation and it fails 7 tests, fix the test here or keep it skipped with a reason.
atom/model_ops/attentions/kimi_triton_mla_gdn_attn.py:12 — root cause is still the module-level import in triton_mla.py, lazy import there fixes kimi/deepseek/glm at once.
.github/scripts/atomesh/setup_mesh.sh:39 — soft 65536 vs hard 524288, why not equal? and is the hard limit ok on every node?
atom/model_ops/attentions/kimi_mla_gdn_attn.py:40 — raw ModuleNotFoundError gives no hint, raise a clear message or drop the flag.
atom/model_ops/attentions/kimi_triton_mla_gdn_attn.py:15 — class moved, did you grep other importers?
any ci run showing the test green? no reproducer means nothing to me.
— valar-cop 👮⭐
|
@junyyang-amd thanks for tracking this down. Where the two fixes stand on current main:
Suggestion: the Kimi change is also what un-skips |
|
@junyyang-amd follow-up: since main already covers the Kimi-K3 import fix via #2669, let's close this PR. Please move the |
valar-cop
left a comment
There was a problem hiding this comment.
not ready yet.. kimi change is redundant now, and it un-skips a failing test.
any ci run showing test_gdn_state_relocation green? and nofile hard limit verified on all node types?
| @staticmethod | ||
| def get_builder_cls() -> type["_KimiMLAGDNCommon"]: | ||
| if envs.ATOM_USE_TRITON_MLA: | ||
| from .kimi_triton_mla_gdn_attn import KimiTritonMLAGDNMetadataBuilder |
There was a problem hiding this comment.
this un-skips the test and it fails 7 cases, ci will be red.. fix block_regions -> pages or keep it skipped?
|
|
||
| """Kimi's Triton MLA builder, kept apart from `kimi_mla_gdn_attn`. | ||
|
|
||
| `triton_mla` imports aiter's Triton MLA decode, which the default aiter MLA path |
There was a problem hiding this comment.
#2669 already fixed the root cause on main, so this is a no-op refactor.. drop it?
| # A cold build runs one rustc per CPU (192 on MI350 nodes), which exhausts | ||
| # Docker's default soft limit of 1024 open files. | ||
| docker run --rm --user "$(id -u):$(id -g)" \ | ||
| --ulimit nofile=65536:524288 \ |
There was a problem hiding this comment.
hard limit 524288 only tested on MI350X? other node types may have lower host nofile and docker run will fail..
| # A cold build runs one rustc per CPU (192 on MI350 nodes), which exhausts | ||
| # Docker's default soft limit of 1024 open files. | ||
| docker run --rm --user "$(id -u):$(id -g)" \ | ||
| --ulimit nofile=65536:524288 \ |
There was a problem hiding this comment.
two unrelated changes in one pr.. please split.
| from .triton_mla import TritonMLAMetadataBuilder | ||
|
|
||
|
|
||
| class KimiTritonMLAGDNMetadataBuilder(_KimiMLAGDNCommon, TritonMLAMetadataBuilder): |
There was a problem hiding this comment.
any other importer of KimiTritonMLAGDNMetadataBuilder? grep it or re-export for compat.
Summary
Two fixes that unblock the MI350X Kimi-K3 ATOMesh cells.
Kimi-K3: import the Triton MLA builder only when
ATOM_USE_TRITON_MLAis setaiter #6633 removed
aiter.ops.triton.attention.mla_decode.kimi_mla_gdn_attnimportedtriton_mlaat module load to defineKimiTritonMLAGDNMetadataBuilder, andtriton_mlaimports that module, so every Kimi-K3 server fails at startup with the new nightly image (rocm/atom-dev:nightly_202610201527-rocm10.0), even though Kimi only uses that builder whenATOM_USE_TRITON_MLA=1:All 20 Kimi-K3 cells of MI350X ATOMesh nightly #4768 failed this way, e.g. c=1.
This moves
KimiTritonMLAGDNMetadataBuildertokimi_triton_mla_gdn_attn.pyand imports it fromKimiMLAGDNBackend.get_builder_clsonly whenATOM_USE_TRITON_MLAis set, the same wayselector.pyonly resolvestriton_mlafor DeepSeek and GLM when the flag is on.get_builder_clsreturns the sameKimiAiterMLAGDNMetadataBuilder;triton_mlais no longer imported.csr_to_dense_block_tableand the non-shuffleddecode_attention_fwdbranch inattention_mla.py) is left for a follow-up.ATOMesh CI: raise the open-file limit for the Mesh build container
With the Kimi fix, both Kimi-K3 cells in run 39580104520 got past the import and decode came up, but the router never started. On rank 0, both Mesh build attempts failed with:
#2625 moved the Mesh Cargo cache from
/tmpto<log root>/.mesh-cache/<host>-<uid>, so every host now starts cold and Cargo compiles all 534 crates with one rustc per CPU (192 on these nodes). The build container fromsetup_mesh.shhad no--ulimit, so it ran with Docker's default softnofileof 1024. The service containers inpd_slurm_job.shalready usenofile=65536:524288. This gives the build container the same limit.Test plan
Kimi-K3 import, in
rocm/atom-dev:nightly_202610201527-rocm10.0on an MI350X node, with this branch mounted at/workspace/ATOM:aiter.ops.triton.attention.mla_decodeis absent in the image.import atom.model_ops.attentions.kimi_mla_gdn_attnsucceeds,get_builder_cls()returnsKimiAiterMLAGDNMetadataBuilder, andatom.model_ops.attentions.triton_mlais not insys.modules.ATOM_USE_TRITON_MLA=1:get_builder_cls()raises the sameModuleNotFoundError(expected, see above).tests/test_kda_layout_id.py,test_kda_checkpoint_slot_copy.py,test_h2d_attention_publication.py,test_page_unit_geometry.py,test_prepare_mtp_decode_contract.py: pass.tests/test_gdn_state_relocation.py: 7 failures withKVTransferTensors.__init__() got an unexpected keyword argument 'block_regions'. Pre-existing and unrelated: feat(offload): support native DSv4 checkpoints with LMCache MP #2250 replaced theblock_regionsfield withpages, and the test re-landed in feat(kimi-k3): support P/D disaggregation (re-land of #2154) #2332 still passesblock_regions=. The fileimportorskips bothaiter(so CPU CI skips it) andkimi_mla_gdn_attn(so it was also skipped in this image until this fix).Mesh build, on an MI350X node with the same image:
ulimit -Snis 1024 withnproc192. With--ulimit nofile=65536:524288it is 65536.setup_mesh.shwith an empty cache directory: cold build succeeds on the first attempt in 5m52s, with noos error 24and anatomeshbinary produced.tests/test_ci_latency_reports.py -k mesh: 5 passed, including a new assertion on thenofileflag.kimi-k3-mxfp4-1p1d-tp8-dspark7-agentic-1m-c1andkimi-k3-mxfp4-1p1d-tp8-dcp8-agentic-lmcache-1m-c48. Both Mesh builds started from an empty cache and succeeded on the first attempt (3m05s and 8m05s).