[Fix] Repair verify mask test fixture (#33087)
This commit is contained in:
@@ -46,10 +46,8 @@ class VerifyMask(msgspec.Struct):
|
|||||||
def fits(self, bs: int, num_draft_tokens: int) -> bool:
|
def fits(self, bs: int, num_draft_tokens: int) -> bool:
|
||||||
"""Whether this batch's writes stay inside the buffer.
|
"""Whether this batch's writes stay inside the buffer.
|
||||||
|
|
||||||
Only the compact layout is checked. FULL_MASK keeps its pre-existing
|
Only the compact layout is checked. FULL_MASK keeps unconditional reuse
|
||||||
unconditional reuse -- its bound needs a max_context_len that composite
|
because its runtime bound depends on sequence lengths not passed to fits().
|
||||||
backends do not carry -- so a batch past max_bs can still overflow it
|
|
||||||
when draft * sum(seq_len) exceeds the buffer, as it could before.
|
|
||||||
"""
|
"""
|
||||||
if self.mode != TreeMaskMode.QLEN_ONLY:
|
if self.mode != TreeMaskMode.QLEN_ONLY:
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ def _make_hybrid_backend(speculative_attention_mode, prefill_mask, decode_mask):
|
|||||||
server_args=SimpleNamespace(
|
server_args=SimpleNamespace(
|
||||||
speculative_attention_mode=speculative_attention_mode
|
speculative_attention_mode=speculative_attention_mode
|
||||||
),
|
),
|
||||||
|
model_config=SimpleNamespace(context_len=_MAX_CONTEXT_LEN),
|
||||||
)
|
)
|
||||||
return HybridAttnBackend(
|
return HybridAttnBackend(
|
||||||
model_runner,
|
model_runner,
|
||||||
@@ -145,8 +146,6 @@ class TestHybridAttnBackendHandsOutSelectedChildMask(CustomTestCase):
|
|||||||
self.assertIs(backend.verify_mask, prefill_mask)
|
self.assertIs(backend.verify_mask, prefill_mask)
|
||||||
|
|
||||||
def test_capacity_check_needs_nothing_from_the_backend(self):
|
def test_capacity_check_needs_nothing_from_the_backend(self):
|
||||||
"""A composite backend carries no max_context_len of its own: fits()
|
|
||||||
reaching back through the backend would raise AttributeError here."""
|
|
||||||
backend = _make_hybrid_backend("prefill", _mask(64, is_read=False), None)
|
backend = _make_hybrid_backend("prefill", _mask(64, is_read=False), None)
|
||||||
|
|
||||||
self.assertTrue(backend.verify_mask.fits(_MAX_BS, _DRAFT))
|
self.assertTrue(backend.verify_mask.fits(_MAX_BS, _DRAFT))
|
||||||
|
|||||||
Reference in New Issue
Block a user