Correct model layer aliasing for Bert style models (#43896)

This commit is contained in:
ap9272
2026-07-09 19:46:22 -04:00
committed by GitHub
parent e12b91b032
commit cac3e70cd4
2 changed files with 9 additions and 4 deletions
@@ -138,9 +138,6 @@ def _fp8_linear_may_use_deep_gemm(module: torch.nn.Module) -> bool:
Return True if the input module/layer could be processed with DeepGEMM.
"""
# FIXME: this logic is brittle and incorrect - since we
# could use DeepGEMM with for than just Fp8LinearMethod
block_size = get_mk_alignment_for_contiguous_layout()[0]
if not (
isinstance(module, LinearBase)
and isinstance(module.quant_method, Fp8LinearMethod)
@@ -156,6 +153,8 @@ def _fp8_linear_may_use_deep_gemm(module: torch.nn.Module) -> bool:
):
return False
block_size = get_mk_alignment_for_contiguous_layout()[0]
w, _, block_sizes = _extract_data_from_linear_base_module(module)
return (
block_sizes == get_mk_alignment_for_contiguous_layout()