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
20 changes: 20 additions & 0 deletions fbgemm_gpu/experimental/gemm/triton_gemm/fp8_gemm.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,16 @@ def get_configs_io_bound() -> List[Config]:
return configs


def dummy_prune_configs(configs, named_args, **kwargs):

M = named_args["M"]
N = named_args["N"]
K = named_args["K"]

logger.info(f"{len(configs)=} {len(configs)=} for {M=} {N=} {K=}")
return configs


MATMUL_CONFIGS: List[Config] = [
# basic configs for compute-bound matmuls
Config(
Expand Down Expand Up @@ -176,6 +186,11 @@ def get_configs_io_bound() -> List[Config]:
num_stages=4,
num_warps=4,
),
Config(
{"BLOCK_M": 64, "BLOCK_N": 128, "BLOCK_K": 256, "SPLIT_K": 1},
num_stages=4,
num_warps=4,
),
Config(
{"BLOCK_M": 128, "BLOCK_N": 128, "BLOCK_K": 32, "SPLIT_K": 1},
num_stages=4,
Expand Down Expand Up @@ -252,6 +267,9 @@ def get_configs_io_bound() -> List[Config]:

@triton.autotune(
configs=MATMUL_CONFIGS,
prune_configs_by={
"early_config_prune": dummy_prune_configs,
},
key=[
"m_key",
"n_key",
Expand Down Expand Up @@ -1227,6 +1245,8 @@ def matmul_fp8_row(
a = a.view(-1, a.size(-1))
# View inputs into proper torch fp8 dtype.
if torch.version.cuda:
# Enable tf32 tensor core to accelerate CUDA
torch.set_float32_matmul_precision("high")
assert a.dtype in (torch.float8_e4m3fn, torch.float8_e5m2)
else:
assert a.dtype in (torch.float8_e4m3fnuz, torch.float8_e5m2fnuz)
Expand Down
Loading