Skip to content

Commit 3337a1d

Browse files
authored
[Iluvatar] prune for small bmm shapes (#1228)
1 parent 3437f19 commit 3337a1d

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

  • src/flag_gems/runtime/backend/_iluvatar/ops

src/flag_gems/runtime/backend/_iluvatar/ops/bmm.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,26 @@
1212
logger = logging.getLogger(__name__)
1313

1414

15+
def prune_bmm_configs(configs, nargs, **kwargs):
16+
pruned = list(
17+
filter(
18+
lambda cfg: not (
19+
(nargs["M"] < 32 and cfg.kwargs["BLOCK_M"] > 32)
20+
or (nargs["N"] < 32 and cfg.kwargs["BLOCK_N"] > 32)
21+
),
22+
configs,
23+
)
24+
)
25+
return early_config_prune(pruned, nargs, **kwargs)
26+
27+
1528
@libentry()
1629
@triton.autotune(
1730
configs=runtime.get_tuned_config("bmm"),
1831
key=["M", "N", "K"],
1932
prune_configs_by={
20-
"early_config_prune": early_config_prune,
33+
# "early_config_prune": early_config_prune,
34+
"early_config_prune": prune_bmm_configs,
2135
"perf_model": estimate_matmul_time,
2236
"top_k": 10,
2337
},

0 commit comments

Comments
 (0)