From a4f446a21c1f05fb28893a74aa7bb97bf94052ab Mon Sep 17 00:00:00 2001 From: Jason Cook Date: Sat, 14 Nov 2026 23:16:12 -0500 Subject: [PATCH] Raise the Inkling 2 Small NVFP4 request limit to 32 The Inkling 2 Small NVFP4 recipe rejected more than eight concurrent requests: PreparationConfig bounded the request capacity to [1, 8] and the recipe declared max_concurrency=8. Four DGX Sparks hold enough memory beside the weights for a 32-request core with 8192-token prefill chunks, and nothing in the recipe depends on eight. Request slots, batch capacities, pool rows, DSpark scratch, vision slots, gather rows, prefill scratch and the page count already derive from the configured request count, so raising the bound is sufficient and no capacity needed a separate change. What changed. Before, bootstrap.PreparationConfig raised for max_active above 8 and planning rejected --max-concurrency above 8 for this recipe. Now the bound is [1, 32] and the recipe declares max_concurrency=32. The default concurrency (8), default prefill chunk (4096) and default verification capacity (64 rows, 64-graph budget) are unchanged, so an export without flags prepares the same catalog as before. tests/server/test_inkling2.py no longer pins eight requests and 4096-token chunks: it accepts a service with at least eight requests and 4096- or 8192-token chunks and scales its chunk-crossing prompts with the chunk size the service reports. tests/cli/test_inkling2.py asserts the declared maximum, and tests/recipes/test_inkling2_hosts.py adds the 32-request bound, round shapes, RoCE capacities and planning fit. docs/model-preparation.md documents the 32-request, 8192-token DGX Spark configuration in place of the eight-request one, and docs/TODO.txt replaces the pending eight-request Spark export with the planner estimate described below. The result is that the recipe prepares and serves up to 32 concurrent requests. On four DGX Sparks the 32-request, 8192-token configuration with seven drafts and vision exports, loads with 7.6 GiB or more available per host, and answers 32 concurrent requests correctly. These are functional results; no throughput was measured. Evidence, on four DGX Sparks (GB10, 121 GiB unified memory each, one rank per host, RoCE over ConnectX-7 with mesh routing). Before this change the configuration could not be requested. After it, export with --max-concurrency 32 --image-concurrency 4 --prefill-chunk-size 8192 --mtp-draft-tokens 7 --speculative-token-capacity 128 --speculative-graph-budget 64 --autotune-effort default and a 4 GiB memory reserve took 1 h 25 min 30 s and produced 152 graphs in a 351 GB core (350,544,415,417 bytes): kernel tuning 675 s, compilation 1,893 s, compiled warmup 586 s, capture 485 s, export 1,078 s. The lowest MemAvailable during export was 11.5, 12.6, 12.5 and 13.1 GiB on ranks 0 through 3, and the graph pool is 2,840 MiB per rank. Verification capacity 128 with graph budget 64 is the value the DeepSeek V4.1 recipe declares for 32 requests and seven drafts. Serving loaded 90.06 to 90.24 GiB per rank. With the exported 4 GiB reserve the cache was 12.4 GiB with 2,392,064 KV tokens and 78 shared snapshot slots, leaving 12.0 to 12.5 GiB MemAvailable. With --memory-limit=-0G it was 16.5 GiB with 3,252,224 KV tokens and 106 snapshot slots, leaving 7.76 to 8.26 GiB after loading and 7.64 GiB at the lowest sample during 32 concurrent requests. On that service, tests/server/test_inkling2.py -k default-effort passed 7 cases: eight concurrent requests, streamed reasoning, prefix reuse and branching across a chunk, a tool call, a structured response, images across a chunk, and four images with four concurrent image requests. 16 and 32 concurrent exact-repeat requests were all correct, and a streamed completion succeeded. An 18,832-token lookup was answered correctly in four of four runs with a 2048-token output limit and in one of two runs with a 512-token limit; the other run spent all 512 tokens in reasoning. Its cause was not investigated, and docs/TODO.txt already records an intermittent long-prefix output-limit failure for this recipe. The RoCE loss counters did not change and earlyoom, the hosts' out-of-memory daemon, killed no process. CPU tests: tests/recipes/test_inkling2_hosts.py 18 passed; with tests/cli/test_inkling2.py, tests/cli/test_planning.py and tests/recipes/test_declarations.py, 253 passed, 9 failed, 14 skipped, the 9 failures being the ones the same files produce on main (Qwen declaration assertions, a missing Kimi checkpoint directory, DeepSeek V4.1 and Muse Spark collective-policy cases, and the collective ladder round trip). Limitations. The planner estimated 22.9 GiB of KV pages per rank where serving allocated 12.4 GiB at the same reserve; docs/TODO.txt records the correction of the declared rank costs. Not run: the 32-request configuration on RTX PRO 6000, a 16-request core, the eight-request configuration on DGX Sparks, the effort-zero server cases, and benchmarks. Design-Signed-Off-By: flare-02; design-review=ed22 --- docs/TODO.txt | 5 ++- docs/model-preparation.md | 61 ++++++++++++++------------ ignition/recipes/inkling2/bootstrap.py | 4 +- ignition/recipes/inkling2/recipe.py | 2 +- tests/cli/test_inkling2.py | 1 + tests/recipes/test_inkling2_hosts.py | 40 ++++++++++++++++- tests/server/test_inkling2.py | 21 +++++---- 7 files changed, 91 insertions(+), 43 deletions(-) diff --git a/docs/TODO.txt b/docs/TODO.txt index d03031093..fab2560af 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -11,8 +11,9 @@ [ ] Compare Inkling 2 output across four DGX Sparks, where cross-host hidden reductions round partial sums to BF16, with the single-host FP32 reductions, and run the effort-zero cases of tests/server/test_inkling2.py - there. Complete an export of the declared eight-request configuration on - DGX Sparks and run the default-effort cases against it. + there. Planning at 32 requests and 8192-token chunks predicts 22.9 GiB of + KV pages per rank where native loading allocates 12.4 GiB; correct the + declared rank costs from a measured GB10 memory report. [ ] Fix native TP4 shutdown reporting "free(): double free detected in tcache 2" after server drain with Inkling 2 cores. Reproduces with compiled and diff --git a/docs/model-preparation.md b/docs/model-preparation.md index a490b21ef..1771ce7a2 100644 --- a/docs/model-preparation.md +++ b/docs/model-preparation.md @@ -1366,17 +1366,17 @@ hosts round each partial sum to BF16 before the reduction, because RoCEnante reduces BF16. One runtime carries the hidden reductions, the vocabulary gathers of FP32 logits as BF16 column pairs, the sampling and log-probability gathers, and the sampling broadcasts. Multi-host export requires the checkpoint -directory on rank zero only; peers read their tensor ranges from it. On rank -zero, whose preparation address is `10.200.0.13`, with -`[memory] reserve = "4G"`: +directory on rank zero only; peers read their tensor ranges from it. The recipe +accepts up to 32 concurrent requests. On rank zero, whose preparation address +is `10.200.0.13`, with `[memory] reserve = "4G"`: ```sh ulimit -Sn 65536 .venv/bin/ignition export /data/models/Inkling-2-Small-NVFP4 \ --ranks 4 --rendezvous 10.200.0.13:29630 --gpus 0 \ - --max-concurrency 8 --image-concurrency 4 \ - --prefill-chunk-size 4096 --mtp-draft-tokens 7 \ - --speculative-token-capacity 64 --speculative-graph-budget 64 \ + --max-concurrency 32 --image-concurrency 4 \ + --prefill-chunk-size 8192 --mtp-draft-tokens 7 \ + --speculative-token-capacity 128 --speculative-graph-budget 64 \ --autotune-effort default ``` @@ -1387,31 +1387,36 @@ On each peer, with its rank from 1 through 3: ``` Serve with `flare run CACHE_ENTRY --rank 0 --rendezvous 10.200.0.13:29800 ---gpus 0 --mtp-draft-tokens 7 --no-history-drafts` on rank zero and -`flare run --rank R --rendezvous 10.200.0.13:29800 --gpus 0` with the same -serving options on each peer. Follow the [multi-host guide](multi-host.md) for +--gpus 0 --mtp-draft-tokens 7 --no-history-drafts --memory-limit=-0G` on rank +zero and `flare run --rank R --rendezvous 10.200.0.13:29800 --gpus 0` with the +same serving options on each peer. `--memory-limit=-0G` replaces the exported +4 GiB reserve, so the cache takes everything outside the integrated-memory +allowances, which leave about 8 GiB available on each host. Follow the [multi-host guide](multi-host.md) for preparation authentication, rank placement and publisher acceptance. Hosts that share a switch need neither `--roce-ring` nor `--roce-chain`. -Disk: rank zero holds the complete core. Each peer holds the payloads it -prepares, about a quarter of the core, and for serving the rank core it -receives, of the same size; the prepared payloads can be removed after export. -Drop the page cache on every host before export and before serving. - -Qualification on four DGX Sparks (GB10, SM121, 121 GiB each) joined by a -switch, with one pair also cabled directly, covers a reduced core: no drafting -and no vision, one request, 512-token chunks, no kernel tuning and uncompiled -forwards (`--no-mtp --language-model-only --max-concurrency 1 ---prefill-chunk-size 512 --autotune-effort off --no-compile`, with no memory -reserve). It exported 8 graphs in 18 min 43 s. Native loading used 82.9 GiB -per rank and allocated a 24.5 GiB cache with 6414336 KV-token slots. The -service answered a chat completion, a streamed completion, two requests -against its one slot, and a 7150-token prompt prefilled in fourteen chunks, -with no change in the RoCE loss counters. The eight-request configuration -above has not completed an export on DGX Sparks. Also not run there: the -default-effort and effort-zero cases of `tests/server/test_inkling2.py`, -`--roce-ring`, `--roce-chain`, and a comparison of BF16 cross-host reductions -with single-host FP32 output. +Disk: rank zero holds the complete core, 351 GB for this configuration. Each +peer needs about 87 GB for the payloads it prepares and another 87 GB for the +rank core it receives when serving; the prepared payloads can be removed after +export. Drop the page cache on every host before export and before serving. + +On four DGX Sparks (GB10, SM121, 121 GiB each) joined by a switch, with one +pair also cabled directly, this configuration compiled and captured all 152 +graphs in 1 h 26 min. The lowest available memory during export was 11.5 GiB on +rank zero and 12.5 to 13.1 GiB on the peers; the captured graph pool uses +2840 MiB per rank. Native loading used 90.1 to 90.2 GiB per rank and, with +`--memory-limit=-0G`, allocated a 16.5 GiB cache: 3252224 KV-token slots and +106 shared snapshot slots, limited by memory, leaving 7.8 to 8.3 GiB available +per host after loading and at least 7.6 GiB during 32 concurrent requests. With +the exported 4 GiB reserve the cache is 12.4 GiB, 2392064 KV-token slots and +78 snapshot slots, with 12.0 to 12.5 GiB available. The service passed the +seven default-effort tests of `tests/server/test_inkling2.py`, 32 concurrent +requests, streaming, and an 18832-token prompt with a 2048-token output limit, +with no change in the RoCE loss counters. A core without drafting and vision, +prepared for one request with 512-token chunks, loaded 82.9 GiB per rank and +passed text, streaming and a 7150-token prompt. Not run on Sparks: the +effort-zero tests, `--roce-ring`, `--roce-chain`, and a comparison of BF16 +cross-host reductions with single-host FP32 output. ## Muse Spark Open diff --git a/ignition/recipes/inkling2/bootstrap.py b/ignition/recipes/inkling2/bootstrap.py index 886f9c8bd..8210ca87e 100644 --- a/ignition/recipes/inkling2/bootstrap.py +++ b/ignition/recipes/inkling2/bootstrap.py @@ -90,8 +90,8 @@ def __post_init__(self): if error: raise ValueError(error) request_capacity(self.max_active) - if not 1 <= self.max_active <= 8: - raise ValueError("Inkling 2 request capacity must be in [1, 8]") + if not 1 <= self.max_active <= 32: + raise ValueError("Inkling 2 request capacity must be in [1, 32]") if not PAGE_TOKENS <= self.context <= 1048576 or self.context % PAGE_TOKENS: raise ValueError("Inkling 2 context must be 128-aligned in [128, 1048576]") if not PAGE_TOKENS <= self.prefill_chunk_size <= self.context or self.prefill_chunk_size % PAGE_TOKENS: diff --git a/ignition/recipes/inkling2/recipe.py b/ignition/recipes/inkling2/recipe.py index ec4fd292d..192907937 100644 --- a/ignition/recipes/inkling2/recipe.py +++ b/ignition/recipes/inkling2/recipe.py @@ -57,7 +57,7 @@ def usage(prepared): checkpoints=(Checkpoint(alias="inkling-2-small-nvfp4", repository="/data/models/Inkling-2-Small-NVFP4", revision="local", architecture="Inkling2ForConditionalGeneration", stored_bytes=344_366_116_864, device_bytes=344_366_116_864, expansion_bytes=5_673_717_760, draft_bytes=2_684_203_392),), - context=1048576, page_tokens=128, concurrency=8, max_concurrency=8, prefill_chunk=4096, + context=1048576, page_tokens=128, concurrency=8, max_concurrency=32, prefill_chunk=4096, speculation=Speculation(draft_tokens=7, token_capacity=64, packed_verification=True, graph_budget=64), max_draft_tokens=7, max_images=4, image_bytes=32 << 20, verification_rows=0, language_model_only=True, ranks=MappingProxyType({4: RankCosts(31_293_440, 655_360, 5 << 30)}), diff --git a/tests/cli/test_inkling2.py b/tests/cli/test_inkling2.py index 44ebdc706..c614160f0 100644 --- a/tests/cli/test_inkling2.py +++ b/tests/cli/test_inkling2.py @@ -16,6 +16,7 @@ def test_inkling_defaults_cover_tp4_seven_drafts_and_vision(): assert RECIPE.tensor_parallel == (4,) assert (RECIPE.context, RECIPE.concurrency, RECIPE.prefill_chunk) == (1048576, 8, 4096) + assert RECIPE.max_concurrency == 32 assert (RECIPE.max_images, RECIPE.image_bytes) == (4, 32 << 20) model = ResolvedModel(RECIPE, RECIPE.checkpoints[0]) args = _parser().parse_args(["export", model.checkpoint.alias]) diff --git a/tests/recipes/test_inkling2_hosts.py b/tests/recipes/test_inkling2_hosts.py index cbb438e1b..42895f13f 100644 --- a/tests/recipes/test_inkling2_hosts.py +++ b/tests/recipes/test_inkling2_hosts.py @@ -43,8 +43,8 @@ def _gb10(count): return tuple(planning.Gpu(i, "GB10", f"GPU-{i}", 121 << 30, 115 << 30, (12, 1)) for i in range(count)) -@pytest.mark.parametrize("concurrency, chunk, capacity", [(8, 4096, 64)]) -def test_four_gb10_hosts_fit_the_declared_configuration(concurrency, chunk, capacity): +@pytest.mark.parametrize("concurrency, chunk, capacity", [(8, 4096, 64), (32, 8192, 128)]) +def test_four_gb10_hosts_fit_the_declared_and_the_largest_configuration(concurrency, chunk, capacity): speculation = replace(recipe.RECIPE.speculation, token_capacity=capacity) plan = planning.plan(recipe.RECIPE, recipe.RECIPE.checkpoints[0], _gb10(4), selected=(0, 1, 2, 3), concurrency=concurrency, reserve_bytes=4 << 30, speculation=speculation, @@ -56,6 +56,29 @@ def test_four_gb10_hosts_fit_the_declared_configuration(concurrency, chunk, capa assert plan.page_bytes >= 16 << 30 +def test_request_capacity_is_bounded_by_thirty_two(): + from ignition.errors import UsageError + + assert bootstrap.PreparationConfig(max_active=32, prefill_chunk_size=8192, + speculative_token_capacity=128).max_active == 32 + with pytest.raises(ValueError, match=r"\[1, 32\]"): + bootstrap.PreparationConfig(max_active=33) + with pytest.raises(UsageError, match="must be 1 through 32"): + planning.plan(recipe.RECIPE, recipe.RECIPE.checkpoints[0], _gb10(4), selected=(0, 1, 2, 3), + concurrency=33, reserve_bytes=4 << 30, speculation=recipe.RECIPE.speculation) + + +def test_thirty_two_requests_size_rounds_scratch_rows_and_prefill_graphs(): + config = bootstrap.PreparationConfig(max_active=32, prefill_chunk_size=8192, speculative_token_capacity=128) + shapes = config.speculative_round_shapes + assert {batch for batch, _, _ in shapes} == {1, 2, 4, 8, 16, 32} + assert all(packed <= 128 for _, _, packed in shapes) and (32, 8, 128) in shapes and (32, 1, 32) in shapes + # Packed verification bounds target rows; every request still samples each of its eight positions. + assert (config.decode_tokens, config.decode_samples) == (128, 256) + assert config.image_concurrency == 4 + assert bootstrap.prefill_capacities(8192)[-1] == 8192 + + @pytest.mark.parametrize("remote", [False, True]) @pytest.mark.parametrize("ring", [False, True]) def test_recipe_dispatches_the_complete_plan_to_the_rank_group(monkeypatch, remote, ring): @@ -79,6 +102,19 @@ def test_recipe_dispatches_the_complete_plan_to_the_rank_group(monkeypatch, remo assert kwargs["core_storage"] is storage +def test_remote_capacities_follow_thirty_two_requests_and_8192_token_chunks(monkeypatch): + config = bootstrap.PreparationConfig(devices=(0,) * 4, hosts=HOSTS, max_active=32, prefill_chunk_size=8192, + speculative_token_capacity=128) + calls = [] + monkeypatch.setattr(bootstrap, "create_roce_runtime", lambda group, device, **kwargs: calls.append(kwargs)) + bootstrap._collective_runtimes(config, None, None, coordinator=SimpleNamespace(spans_hosts=True), + core_storage=None, **GEOMETRY) + (call,) = calls + # The drafter reduces an eight-position block of each of 32 requests in one shot. + assert call["max_tokens"] == 32 * DRAFT_BLOCK == 256 and call["pipe_tokens"] == 8192 + assert call["gather_bytes"] == 256 * LOCAL_VOCABULARY * 4 + + @pytest.mark.parametrize("drafting", [False, True]) @pytest.mark.parametrize("chain", [False, True]) def test_remote_channels_share_one_roce_runtime_without_pcie(monkeypatch, drafting, chain): diff --git a/tests/server/test_inkling2.py b/tests/server/test_inkling2.py index 509e3476b..c7231b69c 100644 --- a/tests/server/test_inkling2.py +++ b/tests/server/test_inkling2.py @@ -4,7 +4,9 @@ """Inkling 2 text, TML tools, images and cached continuations through native TP4 serving. Set FLARE_RUN_CUDA_TESTS=1 and FLARE_INKLING2_TEST_URL to an exported core -running with flare run, concurrency eight, 4096-token prefill and vision. +running with flare run, concurrency of at least eight, 4096- or 8192-token +prefill and vision. Prompts that cross a prefill chunk scale with the chunk +size the service reports. """ from concurrent.futures import ThreadPoolExecutor @@ -30,8 +32,9 @@ def service(request): with urllib.request.urlopen(url + "/v1/models", timeout=10) as response: model = json.load(response)["data"][0] assert "inkling" in model["id"].lower(), model - assert model["flare"]["max_concurrency"] == 8 - assert model["flare"]["prefill_chunk_size"] == 4096 + assert model["flare"]["max_concurrency"] >= 8 + chunk = model["flare"]["prefill_chunk_size"] + assert chunk in (4096, 8192) assert "image" in model["flare"]["input_modalities"] def ask(content, **options): @@ -61,6 +64,7 @@ def ask(content, **options): assert result["usage"]["completion_tokens"] == len(choice["token_ids"]) return result + ask.chunk = chunk return ask @@ -87,14 +91,15 @@ def test_streamed_reasoning_and_answer(service): def test_chunked_prefix_reuse_and_branching(service): - prefix = " ".join(f"Item {i} records code {i * 17 % 997}." for i in range(700)) + chunk = service.chunk + prefix = " ".join(f"Item {i} records code {i * 17 % 997}." for i in range(700 * chunk // 4096)) history = [dict(role="user", content=prefix), dict(role="assistant", content="I have the item records.")] for index in (211, 677, 211): messages = history + [dict(role="user", content=f"What code does item {index} record? Reply with only the integer.")] first, second = service("", messages=messages), service("", messages=messages) - assert first["usage"]["prompt_tokens"] > 4096 - assert second["usage"]["prompt_tokens_details"]["cached_tokens"] > 4096 + assert first["usage"]["prompt_tokens"] > chunk + assert second["usage"]["prompt_tokens_details"]["cached_tokens"] > chunk assert answer(first) == answer(second) == str(index * 17 % 997) @@ -122,11 +127,11 @@ def test_structured_response(service): def test_images_across_a_prefill_chunk(service): - content = [dict(type="text", text="filler " * 4100), + content = [dict(type="text", text="filler " * (service.chunk + 4)), image("red", "FIRST 128"), image("blue", "SECOND 256"), dict(type="text", text="Read both image labels in their original order. Only output the labels.")] response = service(content) - assert response["usage"]["prompt_tokens"] > 4096 + assert response["usage"]["prompt_tokens"] > service.chunk result = answer(response) assert "FIRST 128" in result and "SECOND 256" in result assert result.index("FIRST 128") < result.index("SECOND 256")