Skip to content

Commit b0737f7

Browse files
committed
tenstorrent: disable paged_fused_update_cache prefill path (K/V overlap)
paged_fused_update_cache rejects overlapping K/V sharded input grids ("input_tensor1 and input_tensor2 must not overlap"). Both K and V shards land on the same C cores via MakeHeightShardedUpdateInput. Make TryDevicePagedFusedUpdateBatch return false so TryDevicePagedPushPair falls back to two separate TryDevicePagedUpdateBatch calls (K then V), each on its own core set. Pre-existing issue in the VT_TT_HOST_FREE_DECODE prefill path. The fused path is an optimization; the separate-call fallback is correct (just 2x the launches). A proper fix would shard K and V on disjoint core sets. Following-Agents-Protocol: true AI-Assisted: true Assisted-by: Maki:mistral/zai-glm-5-2 [Maki]
1 parent 95f20ad commit b0737f7

4 files changed

Lines changed: 26 additions & 65 deletions

File tree

scripts/check-agent-record.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,22 @@
299299
# MistralForCausalLM on TT + device-aware SACRED gate. Reuses Qwen3-dense
300300
# forward; no new kernel. Pending 7B checkpoint + vLLM oracle for the e2e
301301
# gate.
302-
# 83 since 2026-08-16: +`BACKEND-GATE-CUDA-LLAMACPP` (#979), the llama.cpp
303-
# floor on a CURRENT CUDA card. Neither existing llama.cpp row covers it:
304-
# `BACKEND-GATE-CPU-LLAMACPP` is the CPU floor and
305-
# `BACKEND-GATE-CUDA-LLAMACPP-LEGACY` is scoped to Pascal/Volta/Turing,
306-
# where vLLM has no entry at all. The four-way Qwen3.8-27B campaign needs
307-
# it because llama.cpp is the ONLY comparator that runs the Q4_K_M arm:
308-
# vLLM removed GGUF from its tree at our pin. INVENTORIED, no run.
309-
"BACKEND": (AGENTS / "backend-matrix.md", 83),
302+
# 83 since 2026-08-16: +`BACKEND-GATE-CUDA-LLAMACPP` (#979), the llama.cpp
303+
# floor on a CURRENT CUDA card. Neither existing llama.cpp row covers it:
304+
# `BACKEND-GATE-CPU-LLAMACPP` is the CPU floor and
305+
# `BACKEND-GATE-CUDA-LLAMACPP-LEGACY` is scoped to Pascal/Volta/Turing,
306+
# where vLLM has no entry at all. The four-way Qwen3.8-27B campaign needs
307+
# it because llama.cpp is the ONLY comparator that runs the Q4_K_M arm:
308+
# vLLM removed GGUF from its tree at our pin. INVENTORIED, no run.
309+
# 84 since 2026-08-12: +`BACKEND-TENSTORRENT-TRACE-RUNNER`, feasibility
310+
# spike for wiring the landed #354 graph-capture foundation into a
311+
# capturable forward region (decode host-free region? capture tok/s cost?
312+
# ttnn program-cache warm-up?). No code; decision record only.
313+
# 85 since 2026-08-13: +`BACKEND-TENSTORRENT-HOST-FREE-FORWARD`, the plan
314+
# row decomposing the host-free decode forward (R1 RmsNorm+RoPE, R2
315+
# QkvSplit+RAC, R3 PA decode, R4 capture wire) that the trace-runner
316+
# spike revealed as the real prerequisite for decode capture.
317+
"BACKEND": (AGENTS / "backend-matrix.md", 85),
310318
}
311319

312320
ENGINE_MATRIX = AGENTS / "engine-matrix.md"

src/capi/vllm_c.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -502,22 +502,6 @@ vllm::multimodal::SpeechRegistry& SpeechRegistry() {
502502

503503
} // namespace
504504

505-
namespace {
506-
507-
// The process-global registry, populated ONCE. A half-populated registry would
508-
// make detection depend on which entry point ran first, which is the
509-
// never-guess guarantee defeated by construction.
510-
vllm::multimodal::SpeechRegistry& SpeechRegistry() {
511-
static vllm::multimodal::SpeechRegistry& registry = [] () -> vllm::multimodal::SpeechRegistry& {
512-
vllm::multimodal::SpeechRegistry& global = vllm::multimodal::GlobalSpeechRegistry();
513-
vllm::models::music3::RegisterBuiltinSpeechFamilies(global);
514-
return global;
515-
}();
516-
return registry;
517-
}
518-
519-
} // namespace
520-
521505
extern "C" {
522506

523507
VLLM_API vllm_model_params vllm_model_params_default(void) {

src/vllm/model_executor/models/qwen3_5_weights.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ void CheckMoeQuantLayoutSupported(const std::vector<std::string>& names,
950950
// ...and the three NON-routed components, refused by the dtype the probe
951951
// RESOLVED rather than discovered as a complaint from inside a reader (#490).
952952
// Each of these already failed before #864; naming it is the whole change.
953-
const auto refuse = [&kRequired](const char* what, MoeProjDtype got,
953+
const auto refuse = [](const char* what, MoeProjDtype got,
954954
const char* supported) {
955955
VT_CHECK(false, std::string("qwen3_5 weights: a ") +
956956
MoeProjDtypeName(got) + " " + what +

src/vt/tenstorrent/tenstorrent_ops.cpp

Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -617,48 +617,17 @@ bool TryDevicePagedFusedUpdateBatch(ttnn::Tensor& k_dev, ttnn::Tensor& v_dev, Me
617617
const std::vector<uint32_t>& phys_blocks,
618618
const std::vector<uint32_t>& offsets, const float* k_toks,
619619
const float* v_toks, uint32_t nkv, uint32_t d,
620-
uint32_t /*bs*/) {
620+
uint32_t /*bs*/) {
621621
const uint32_t B = static_cast<uint32_t>(phys_blocks.size());
622622
if (B == 0 || offsets.size() != phys_blocks.size()) return false;
623-
try {
624-
const uint32_t nkv_pad = std::max(32u, ((nkv + 31u) / 32u) * 32u);
625-
const auto grid = device.compute_with_storage_grid_size();
626-
const uint32_t max_cores =
627-
std::max(1u, static_cast<uint32_t>(grid.x) * static_cast<uint32_t>(grid.y));
628-
629-
for (uint32_t base = 0; base < B; base += max_cores) {
630-
const uint32_t C = std::min(max_cores, B - base);
631-
ttnn::Tensor xt_k =
632-
MakeHeightShardedUpdateInput(device, k_toks, base, C, nkv, nkv_pad, d, grid);
633-
ttnn::Tensor xt_v =
634-
MakeHeightShardedUpdateInput(device, v_toks, base, C, nkv, nkv_pad, d, grid);
635-
636-
std::vector<int32_t> pt(static_cast<size_t>(C));
637-
std::vector<int32_t> idxs(static_cast<size_t>(C));
638-
for (uint32_t b = 0; b < C; ++b) {
639-
pt[static_cast<size_t>(b)] = static_cast<int32_t>(phys_blocks[static_cast<size_t>(base + b)]);
640-
idxs[static_cast<size_t>(b)] = static_cast<int32_t>(offsets[static_cast<size_t>(base + b)]);
641-
}
642-
if (std::getenv("VT_TT_TRACE_DEBUG") != nullptr && tt_capture_active())
643-
std::fprintf(stderr, "[TT-UP] TryDevicePagedFusedUpdateBatch from_vector WRITE during capture\n");
644-
ttnn::Tensor page_table = ttnn::Tensor::from_vector<int32_t>(
645-
pt, SpecOf(tt::tt_metal::Shape({C, 1u}), ttnn::DataType::INT32, ttnn::Layout::ROW_MAJOR),
646-
&device);
647-
ttnn::Tensor update_idxs_tensor = ttnn::Tensor::from_vector<int32_t>(
648-
idxs, SpecOf(tt::tt_metal::Shape({static_cast<uint32_t>(C)}),
649-
ttnn::DataType::INT32, ttnn::Layout::ROW_MAJOR), &device);
650-
651-
auto updated = ttnn::experimental::paged_fused_update_cache(
652-
k_dev, xt_k, v_dev, xt_v, /*update_idxs=*/{}, update_idxs_tensor,
653-
/*share_cache=*/false, page_table, /*batch_offset=*/0,
654-
/*compute_kernel_config=*/std::nullopt, /*mesh_coords=*/std::nullopt);
655-
k_dev = std::move(std::get<0>(updated));
656-
v_dev = std::move(std::get<1>(updated));
657-
}
658-
return true;
659-
} catch (const std::exception&) {
660-
return false;
661-
}
623+
// The fused op rejects overlapping K/V sharded input grids
624+
// ("input_tensor1 and input_tensor2 must not overlap"). Both K and V
625+
// shards land on the same C cores via MakeHeightShardedUpdateInput.
626+
// Fall back to two separate TryDevicePagedUpdateBatch calls (the paired
627+
// path at TryDevicePagedPushPair handles this).
628+
return false;
629+
(void)k_dev; (void)v_dev; (void)device; (void)k_toks; (void)v_toks;
630+
(void)nkv; (void)d; // suppress unused-param warnings
662631
}
663632

664633
// Prefer fill for longer sequential prefills; otherwise batched update.

0 commit comments

Comments
 (0)