Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions examples/models/muse-glimmer/export/export_solo.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,13 +527,16 @@ def export_cuda_batching( # noqa: C901
materialize_runtime_buffers(model, dtype=torch.bfloat16)
geometry = offgraph_kv_cache_geometry(model)

# A sequence prefill samples a few rows; tracing all rows creates a
# max_step_tokens * vocab FP32 output during AOTI's JIT validation.
example_rows = _CUDA_MIN_PREFILL_CHUNK if sequence_layout else max_step_tokens
# The selected logits feed the device samplers, which take at most
# MAX_SAMPLE_ROWS rows, so a step never selects more. Bounding the selector
# there instead of at the step width keeps the memory-planned FP32 logits
# output at MAX_SAMPLE_ROWS * vocab rather than max_step_tokens * vocab.
max_selected_rows = min(max_step_tokens, MAX_SAMPLE_ROWS)
example_rows = _CUDA_MIN_PREFILL_CHUNK if sequence_layout else max_selected_rows
width = Dim(
"width", min=max(widest_static, _CUDA_MIN_PREFILL_CHUNK), max=max_step_tokens
)
rows = Dim("rows", min=_CUDA_MIN_PREFILL_CHUNK, max=max_step_tokens)
rows = Dim("rows", min=_CUDA_MIN_PREFILL_CHUNK, max=max_selected_rows)
programs = {}
with (
common.BoundMethodForward(model, types.MethodType(step_forward, model)),
Expand Down
Loading