Remove one kernel in per_tensor_quant_mla_fp8 (#5549)

This commit is contained in:
fzyzcjy
2025-04-20 06:08:15 +08:00
committed by GitHub
parent d58e354472
commit 613b197e57
4 changed files with 62 additions and 18 deletions

View File

@@ -1932,3 +1932,16 @@ def is_fa3_default_architecture(hf_config):
"MistralForCausalLM",
}
return architectures[0] in default_archs
# Can be more general if it is used in multiple places (keep it simple and thus not general now)
class BumpAllocator:
def __init__(self, buffer_size: int, dtype, device):
self._buffer = torch.zeros((buffer_size,), dtype=dtype, device=device)
self._pointer = 0
def allocate(self, size: int):
assert self._pointer + size <= len(self._buffer)
output = self._buffer[self._pointer : self._pointer + size]
self._pointer += size
return output