Repository navigation
feat(cloudtpu): M4 multi-chip v6e-8/tpu7x SPMD sharding, collectives & SubgraphPlanCache (4.9x v5e-1 decode) - #19
Merged
Merged
Conversation
…T runtime & host mock tests (#16)
…equant, GCC13, MAPS_LIBPYTHON=0)
…permute lowering for GGUF inference
…& SubgraphPlanCache (4.9x v5e-1 decode)
4 tasks
… 11 + multi-chip single-device assignment
Owner
Author
Live Cloud TPU
|
# Conflicts: # .github/workflows/ci.yml # llama-cpp-cloudtpu/CMakeLists.txt # llama-cpp-cloudtpu/README.md # llama-cpp-cloudtpu/build.sh # llama-cpp-cloudtpu/ggml-cloudtpu.cpp # llama-cpp-cloudtpu/patches/llama-cpp-b12608-cloudtpu.patch # llama-cpp-cloudtpu/pjrt_runtime.cpp # llama-cpp-cloudtpu/pjrt_runtime.hpp # llama-cpp-cloudtpu/stablehlo_emitter.cpp # llama-cpp-cloudtpu/stablehlo_emitter.hpp # llama-cpp-cloudtpu/tests/test_cloudtpu_host.cpp
…ion, SHARD_K broadcast, scratch HBM release, README)
… all_reduce, REDUCE_SCATTER replica-local, S32 mock collectives)
… LRU recency, selective plan pruning, registered spmd_chips)
…harding, non-owning plan exec_key, liveness in try)
…plicated compute outputs in SPMD fit
…ing on view patches
…versized CLOUDTPU_SPMD_CHIPS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Completes M4 of Track 1 (#16), stacked on PR #18 (
feat/ggml-cloudtpu):M4A — Multi-Chip
v6e-8&tpu7xSPMD Sharding + Collectivespjrt_runtime.{hpp,cpp}):xla::DeviceAssignmentProto(field 9 ofExecutableBuildOptionsProto) for explicit replica-SPMD (num_replicas=P, num_partitions=1).execute_spmd(...),buffer_from_host_replicated(...), atomic execute stats, andeviction_epoch().CLOUDTPU_MOCK_DEVICES=1..16) with per-chip HBM accounting (v6e-832 GiB/chip = 256 GiB,tpu7x-4t192 GiB/chip = 768 GiB) and lockstep cross-chipall_reduce,all_gather,reduce_scatter,replica_id, anddynamic_slice.stablehlo_emitter.{hpp,cpp}):stablehlo.all_reduce,stablehlo.all_gather,stablehlo.reduce_scatter,stablehlo.replica_id, andstablehlo.dynamic_slice.SHARD_NandSHARD_KacrossF32/F16/BF16/Q8_0/Q4_0/Q4_K/Q6_Kweights and automatic Megatron-LM single-all_reduceFFN fusion (Gate/UpSHARD_N-> localSwiGLU->DownSHARD_K-> 1all_reduce, 0all_gather).ggml-cloudtpu.cpp):CLOUDTPU_SPMD_CHIPS=autoexposes a singleCLOUDTPUdevice with aggregated mesh HBM (256 GiBonv6e-8,768 GiBontpu7x-4t) and automatic1/Pper-chip weight sharding with losslessget_tensorreconstruction.M4B — Fast-Path
SubgraphPlanCache& Decode OptimizationSubgraphPlanCache(keyed by compact binary FNV-1a + exact signature words, invalidated viaeviction_epoch()).ggml_gallocrcgraph liveness + O(1)store_tensor_hbmslot reuse + extended fusion (CLOUDTPU_MAX_FUSE_OPS=64, safeSET_ROWSfusion) + async pipelining (ggml_backend_cloudtpu_synchronize).Proof
TPU v5e-1(libtpu.so,zshColab,MAPS_LIBPYTHON=0,ldd libpython = 0on all 5 binaries):test_cloudtpu_host(CLOUDTPU_MOCK=0): ALL PASSED (0 failures) including liveP=1StableHLOall_reduce/all_gather/reduce_scattercompile & exec + 4-chiptpu7x& 8-chipv6e-8SPMD Megatron FFN tests.test-backend-ops -b CLOUDTPU(mock=0):MUL_MAT 44/44,FLASH_ATTN_EXT 1697/1697,SET_ROWS 65/65,RMS_NORM 61/61.llama-bench -ngl 99 -fa 1(M3 -> M4B):Qwen2.5-1.5B-Instruct Q4_K_M:pp128 4,945 -> 15,541,pp512 16,113 -> 28,132,tg64 39.17 -> 192.06 tok/s(4.90x)Qwen2.5-1.5B-Instruct Q8_0:pp128 5,445 -> 16,512,pp512 19,820 -> 28,371,tg64 42.24 -> 202.96 tok/s(4.80x)Meta-Llama-3.1-8B-Instruct Q4_K_M:tg64 33.25 -> 38.74 tok/s(1.17x); coherentllama-cli -c 4096(17 * 23 = 391)Meta-Llama-3.1-8B-Instruct Q8_0:tg64 35.20 -> 53.06 tok/s(1.51x,422 GB/seffective HBM BW)4-chip tpu7x&8-chip v6e-8):test-backend-opspassed across 1, 4, and 8 chips (MUL_MAT 44/44,RMS_NORM 61/61,SOFT_MAX 107/107,ADD 153/153,MUL 140/140,SCALE 12/12,CPY 157/157,CONT 89/89).llama-serverconfirmed bit-exact identical token output acrossCPU == 1-chip == 4-chip == 8-chip.v6e-8/tpu7xlive runs remain owner-gated.