Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion src/flag_gems/runtime/backend/_cambricon/tune_configs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1462,10 +1462,14 @@ index:
- 1
- 2
- 4
# BLOCK_SIZE1=4096 excluded: with the default num_stages=2 a 4096-wide tile
# exceeds NRAM (always OutOfResources, can never win) and BLOCK_SIZE0=4 x
# BLOCK_SIZE1=4096 trips an MLU AutoTileForTritonPass failure
# ("PassManager::run failed" on an untileable tensor.expand_shape that
# collapses [1, 4, 4096]) in inductor-wrapped contexts with dynamic shapes.
block_size1:
- 1024
- 2048
- 4096
warps:
- 1
- 4
Expand Down
15 changes: 14 additions & 1 deletion src/flag_gems/utils/libentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,20 @@ def run(self, *args, **kwargs):
def bench(config: triton.Config) -> List[float]:
ret = cache.get(config)
if ret is None:
ret = self._bench(*args, config=config, **kwargs)
try:
ret = self._bench(*args, config=config, **kwargs)
except RuntimeError as e:
# A config whose COMPILE raises a plain RuntimeError
# is outside triton's autotuner catch list
# (OutOfResources / CompileTimeAssertionFailure /
# PTXASError) and would kill the whole process. Some
# backend compilers do this — e.g. cambricon MLU
# AutoTileForTritonPass raises "PassManager::run
# failed" on a tensor.expand_shape it cannot tile.
# Treat such a config as a non-candidate (inf) so
# tuning continues and a working config is selected.
print(f"[libentry] config {config} failed to compile: {e}")
ret = (float("inf"), float("inf"), float("inf"))
# Some Triton backends (e.g. tsingmicro with
# use_cuda_graph=True) return a scalar float from
# _bench instead of the standard (p50, p20, p80) tuple.
Expand Down
Loading