Skip to content

Commit 914224f

Browse files
committed
refactor: remove experimental KKT compilation gating and associated probe logic
1 parent 224595f commit 914224f

1 file changed

Lines changed: 0 additions & 65 deletions

File tree

cppmega_v4/_tilelang/path_d_runtime_adapter.py

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717

1818
ALLOW_DEGRADED_ENV = "CPPMEGA_V4_PATH_D_ALLOW_DEGRADED_PRIMFUNC"
19-
ENABLE_KKT_COMPILE_ENV = "CPPMEGA_V4_PATH_D_ENABLE_KKT_COMPILE"
2019
RCP_LN2 = 1.4426950408889634
2120
GDN_FIXED_T = 64
2221
GDN_FIXED_H = 1
@@ -381,63 +380,6 @@ def _compile_gdn_kkt_cached(
381380
)
382381

383382

384-
@lru_cache(maxsize=16)
385-
def _probe_gdn_kkt_cached(
386-
constexprs_key: tuple[tuple[str, Any], ...],
387-
grid: tuple[int, ...],
388-
allow_degraded_primfunc: bool,
389-
) -> PathDCompileResult:
390-
from cppmega_v4._tilelang.linear_attention_path_d_real import (
391-
lower_fla_gdn_kkt_solve,
392-
)
393-
394-
lowered = lower_fla_gdn_kkt_solve(dict(constexprs_key), grid=grid)
395-
if lowered.status != "LOWERED_FULL" or lowered.prim_func is None:
396-
return PathDCompileResult(
397-
available=False,
398-
reason=(
399-
"runtime adapter gdn.kkt_solve: frontend did not produce "
400-
f"a runnable PrimFunc; status={lowered.status}; "
401-
f"error={lowered.error_type}: {lowered.error_message}"
402-
),
403-
plan=GDN_KKT_PLAN,
404-
error_type=lowered.error_type,
405-
)
406-
plan = PathDKernelPlan(
407-
name=GDN_KKT_PLAN.name,
408-
out_idx=GDN_KKT_PLAN.out_idx,
409-
grid=grid,
410-
scalar_specializations=GDN_KKT_PLAN.scalar_specializations,
411-
target=GDN_KKT_PLAN.target,
412-
execution_backend=GDN_KKT_PLAN.execution_backend,
413-
allow_degraded_primfunc=allow_degraded_primfunc,
414-
)
415-
degraded = primfunc_has_degraded_markers(lowered.prim_func)
416-
allow_degraded = allow_degraded_primfunc or _env_allows_degraded()
417-
if degraded and not allow_degraded:
418-
return PathDCompileResult(
419-
available=False,
420-
reason=(
421-
"runtime adapter gdn.kkt_solve: PrimFunc contains DEGRADED "
422-
"pointer-lowering markers; refusing to compile/launch until "
423-
"PtrAnalysis-backed addressing is clean"
424-
),
425-
plan=plan,
426-
degraded_primfunc=True,
427-
)
428-
return PathDCompileResult(
429-
available=False,
430-
reason=(
431-
"runtime adapter gdn.kkt_solve: non-degraded PrimFunc is "
432-
"available, but Metal compile is gated because current "
433-
"TileLang/Metal codegen does not complete this kernel; set "
434-
f"{ENABLE_KKT_COMPILE_ENV}=1 to force the experimental compile"
435-
),
436-
plan=plan,
437-
degraded_primfunc=degraded,
438-
)
439-
440-
441383
@lru_cache(maxsize=16)
442384
def _compile_gdn_recompute_w_u_cached(
443385
constexprs_key: tuple[tuple[str, Any], ...],
@@ -491,12 +433,6 @@ def compile_gdn_kkt_artifact(
491433
if constexprs:
492434
cfg.update(constexprs)
493435
grid_tuple = tuple(int(x) for x in grid)
494-
if not _env_flag(ENABLE_KKT_COMPILE_ENV):
495-
return _probe_gdn_kkt_cached(
496-
_freeze_items(cfg),
497-
grid_tuple,
498-
bool(allow_degraded_primfunc),
499-
)
500436
return _compile_gdn_kkt_cached(
501437
_freeze_items(cfg),
502438
grid_tuple,
@@ -884,7 +820,6 @@ def kda_fwd_runtime_call(*args: Any, coverage_reason: str = "", **kwargs: Any) -
884820

885821
__all__ = [
886822
"ALLOW_DEGRADED_ENV",
887-
"ENABLE_KKT_COMPILE_ENV",
888823
"GDN_RECURRENT_PLAN",
889824
"KDA_RECURRENT_PLAN",
890825
"PathDCompileResult",

0 commit comments

Comments
 (0)