-
Notifications
You must be signed in to change notification settings - Fork 62
feat(gemma): build one dual-profile plan when a split pair cannot fit, and qualify gemma-3-27b #1405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(gemma): build one dual-profile plan when a split pair cannot fit, and qualify gemma-3-27b #1405
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "name": "gemma-3-27b", | ||
| "hf_id": "google/gemma-3-27b-it", | ||
| "bundle": "gemma-3-27b.bundle", | ||
| "family": "gemma", | ||
| "task": "text_generation", | ||
| "precision": "bf16", | ||
| "trust_remote_code": false, | ||
| "testcases": [ | ||
| { | ||
| "name": "gemma-3-27b", | ||
| "premerge": true, | ||
| "reference_precision": "fp32", | ||
| "prompt": "What is the capital of France? Answer with just the name.", | ||
| "max_new_tokens": 8, | ||
| "use_chat_template": true, | ||
| "enable_thinking": false | ||
| } | ||
| ], | ||
| "max_sequence_length": 256, | ||
| "tensor_parallel_size": 1 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """A Gemma too large for a split pair must build one dual-profile plan instead. | ||
|
|
||
| The split layout keeps a separate decode engine with a static Sq=1 graph, which | ||
| costs a second full copy of the weights on the device. gemma-3-27b at bf16 needs | ||
| about 50 GiB per engine, so the pair cannot be deserialized on an 80 GiB device. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import numpy as np | ||
|
|
||
| from families.gemma.model import ( | ||
| _MAX_SPLIT_ENGINE_BYTES, | ||
| _decoder_engine_bytes, | ||
| ) | ||
|
|
||
|
|
||
| def _weights(parameters: int) -> dict: | ||
| return {"w": np.zeros(parameters, dtype=np.float32)} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Avoid allocating model-sized arrays in this unit test.
Proposed fix-import numpy as np
-
from families.gemma.model import (
_MAX_SPLIT_ENGINE_BYTES,
_decoder_engine_bytes,
)
+class _SizedWeight:
+ def __init__(self, size: int) -> None:
+ self.size = size
+
def _weights(parameters: int) -> dict:
- return {"w": np.zeros(parameters, dtype=np.float32)}
+ return {"w": _SizedWeight(parameters)}🤖 Prompt for AI Agents |
||
|
|
||
|
|
||
| def test_bytes_follow_the_build_precision(): | ||
| half = _decoder_engine_bytes(_weights(1_000_000), "bf16") | ||
| full = _decoder_engine_bytes(_weights(1_000_000), "fp32") | ||
|
|
||
| assert full == 2 * half | ||
| # 1e6 parameters at 2 bytes, plus the measured plan overhead. | ||
| assert half == int(1_000_000 * 2 * 1.05) | ||
|
|
||
|
|
||
| def test_the_qualified_widths_stay_on_split(): | ||
| # Parameter counts of the shipped text decoders. | ||
| for parameters in (0.27e9, 1.00e9, 2.61e9, 3.88e9, 11.77e9): | ||
| assert _decoder_engine_bytes(_weights(int(parameters)), "bf16") <= _MAX_SPLIT_ENGINE_BYTES | ||
|
|
||
|
|
||
| def test_27b_exceeds_the_split_budget(): | ||
| assert _decoder_engine_bytes(_weights(int(27.01e9)), "bf16") > _MAX_SPLIT_ENGINE_BYTES | ||
|
|
||
|
|
||
| def test_the_budget_leaves_room_for_a_pair_on_an_80_gib_device(): | ||
| """Both engines plus working memory have to fit, not just the weights.""" | ||
| assert 2 * _MAX_SPLIT_ENGINE_BYTES < 80 * 1024**3 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: NVIDIA/TensorRT-Model-Connect
Length of output: 7227
🏁 Script executed:
Repository: NVIDIA/TensorRT-Model-Connect
Length of output: 42406
🏁 Script executed:
Repository: NVIDIA/TensorRT-Model-Connect
Length of output: 19754
🏁 Script executed:
Repository: NVIDIA/TensorRT-Model-Connect
Length of output: 5188
🏁 Script executed:
Repository: NVIDIA/TensorRT-Model-Connect
Length of output: 7096
🏁 Script executed:
Repository: NVIDIA/TensorRT-Model-Connect
Length of output: 1314
Use a model-specific exclusion reason for
gemma-3-27b.The
gemma-3-27bbuild exceeds the split-engine budget and emits onedual_profileplan. Thegemma-2-2brelease workload uses the qualified split layout. These layouts use different artifacts and runtime loading paths. The shared reason therefore makes a false equivalence claim. State that no matching dual-profile workload or receipt has been collected forgemma-3-27b.🤖 Prompt for AI Agents