|
16 | 16 |
|
17 | 17 |
|
18 | 18 | ALLOW_DEGRADED_ENV = "CPPMEGA_V4_PATH_D_ALLOW_DEGRADED_PRIMFUNC" |
19 | | -ENABLE_KKT_COMPILE_ENV = "CPPMEGA_V4_PATH_D_ENABLE_KKT_COMPILE" |
20 | 19 | RCP_LN2 = 1.4426950408889634 |
21 | 20 | GDN_FIXED_T = 64 |
22 | 21 | GDN_FIXED_H = 1 |
@@ -381,63 +380,6 @@ def _compile_gdn_kkt_cached( |
381 | 380 | ) |
382 | 381 |
|
383 | 382 |
|
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 | | - |
441 | 383 | @lru_cache(maxsize=16) |
442 | 384 | def _compile_gdn_recompute_w_u_cached( |
443 | 385 | constexprs_key: tuple[tuple[str, Any], ...], |
@@ -491,12 +433,6 @@ def compile_gdn_kkt_artifact( |
491 | 433 | if constexprs: |
492 | 434 | cfg.update(constexprs) |
493 | 435 | 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 | | - ) |
500 | 436 | return _compile_gdn_kkt_cached( |
501 | 437 | _freeze_items(cfg), |
502 | 438 | grid_tuple, |
@@ -884,7 +820,6 @@ def kda_fwd_runtime_call(*args: Any, coverage_reason: str = "", **kwargs: Any) - |
884 | 820 |
|
885 | 821 | __all__ = [ |
886 | 822 | "ALLOW_DEGRADED_ENV", |
887 | | - "ENABLE_KKT_COMPILE_ENV", |
888 | 823 | "GDN_RECURRENT_PLAN", |
889 | 824 | "KDA_RECURRENT_PLAN", |
890 | 825 | "PathDCompileResult", |
|
0 commit comments