[Kernel] Add PDL support for DeepGEMM kernel (#42996)
Signed-off-by: Jee Jee Li <jeejeelee@inferact.ai>
This commit is contained in:
@@ -177,6 +177,22 @@ def _import_deep_gemm():
|
||||
return None
|
||||
|
||||
|
||||
def _apply_pdl(mod, enable: bool = True) -> None:
|
||||
mod_name = getattr(mod, "__name__", str(mod))
|
||||
try:
|
||||
set_pdl_fn = getattr(mod, "set_pdl", None)
|
||||
if set_pdl_fn is None:
|
||||
return
|
||||
set_pdl_fn(enable)
|
||||
logger.info_once(
|
||||
"DeepGEMM PDL %s on %s.",
|
||||
"enabled" if enable else "disabled",
|
||||
mod_name,
|
||||
)
|
||||
except Exception as e: # noqa: BLE001
|
||||
logger.warning_once("Failed to set DeepGEMM PDL on %s: %s", mod_name, e)
|
||||
|
||||
|
||||
def _lazy_init() -> None:
|
||||
"""Import deep_gemm and resolve symbols on first use."""
|
||||
global _cublaslt_gemm_nt_impl
|
||||
@@ -219,6 +235,9 @@ def _lazy_init() -> None:
|
||||
if _dg is None:
|
||||
return
|
||||
|
||||
# Enable PDL for DeepGEMM on architectures that support it (SM90+).
|
||||
if current_platform.is_arch_support_pdl():
|
||||
_apply_pdl(_dg, True)
|
||||
_cublaslt_gemm_nt_impl = getattr(_dg, "cublaslt_gemm_nt", None)
|
||||
_fp8_gemm_nt_impl = getattr(_dg, "fp8_gemm_nt", None)
|
||||
_fp8_einsum_impl = getattr(_dg, "fp8_einsum", None)
|
||||
|
||||
Reference in New Issue
Block a user