MCPcopy Create free account
hub / github.com/RightNow-AI/autokernel / _generate_suggestions

Function _generate_suggestions

analysis.py:505–573  ·  view source on GitHub ↗

Generate actionable suggestions based on experiment history.

(
    df: pd.DataFrame,
    baseline_tp: float | None,
    best_tp: float | None,
    n_failed: int,
    n_total: int,
)

Source from the content-addressed store, hash-verified

503
504
505def _generate_suggestions(
506 df: pd.DataFrame,
507 baseline_tp: float | None,
508 best_tp: float | None,
509 n_failed: int,
510 n_total: int,
511) -> list[str]:
512 """Generate actionable suggestions based on experiment history."""
513
514 suggestions = []
515
516 if n_total == 0:
517 return ["Run some experiments first to generate suggestions."]
518
519 # High crash rate
520 if n_total > 0 and n_failed / n_total > 0.4:
521 suggestions.append(
522 "High crash/failure rate ({:.0f}%). Consider more conservative changes or "
523 "better input validation in the kernel.".format(n_failed / n_total * 100)
524 )
525
526 # Speedup analysis
527 if baseline_tp and best_tp and baseline_tp > 0:
528 speedup = best_tp / baseline_tp
529 if speedup < 1.1:
530 suggestions.append(
531 "Speedup over PyTorch is modest (<1.1x). Consider trying: "
532 "autotuning over block sizes, persistent kernels, or split-K strategies."
533 )
534 elif speedup < 1.5:
535 suggestions.append(
536 "Decent speedup achieved. Next steps: try software pipelining, "
537 "warp specialization, or TMA-based data movement."
538 )
539 else:
540 suggestions.append(
541 "Strong speedup achieved. Consider: fine-grained autotuning across "
542 "more size configurations, or targeting remaining bottlenecks with profiling."
543 )
544
545 # Plateau detection: if last N experiments were all reverted
546 last_5 = df.tail(5)
547 if len(last_5) >= 5:
548 last_5_cats = last_5.apply(classify_row, axis=1)
549 if all(c in ("reverted", "failed") for c in last_5_cats):
550 suggestions.append(
551 "Last 5 experiments were all reverted or failed -- possible plateau. "
552 "Try a fundamentally different approach (different algorithm, memory layout, "
553 "or kernel fusion strategy)."
554 )
555
556 # Memory observations
557 if "peak_vram_mb" in df.columns:
558 classifications = df.apply(classify_row, axis=1)
559 kept_vrams = df.loc[classifications == "kept", "peak_vram_mb"].dropna()
560 kept_vrams = kept_vrams[kept_vrams > 0]
561 if len(kept_vrams) > 0 and float(kept_vrams.max()) > 10000:
562 suggestions.append(

Callers 1

generate_reportFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected