Skip to content

Introducing Optimization Gradio UI#105

Merged
kaiming-cheng merged 5 commits intomainfrom
kaiming/ui
Feb 26, 2026
Merged

Introducing Optimization Gradio UI#105
kaiming-cheng merged 5 commits intomainfrom
kaiming/ui

Conversation

@kaiming-cheng
Copy link
Contributor

@kaiming-cheng kaiming-cheng commented Feb 25, 2026

Summary

  • Optimization UI (scripts/optimization_ui.py): Gradio interface for the kernel
    optimization pipeline with live log streaming, per-worker log panels, and strategy
    selection (greedy / beam search)
  • Baseline benchmarking: Added benchmark_pytorch_compile() to benchmark against
    torch.compile, and manager-level benchmarking of the initial kernel. Results table
    shows Best Time, Initial Kernel, PyTorch Eager, PyTorch Compile, and Speedup vs Initial
  • Per-round visibility: Manager logs per-round winner summary; Best Kernel tab
    updates live during optimization (reads program database on each poll); per-round
    collapsible accordion in Best Kernel tab
  • UI polish: Time estimate note in header, grey background on worker log textboxes,
    prominent speedup emoji on new-best messages, default example pre-loaded on launch
  • Multiprocessing reliability: Added Queue.close()/join_thread(),
    Process.close(), and kill() fallback in opt_manager.py to prevent UI hangs after
    optimization; added generator timeout as safety net
  • Example portability: Replaced hardcoded /home/kaimingcheng/ka/KernelBench path
    in example test_kernel.py files with from problem import Model, get_inputs, get_init_inputs

Example when starting an optimization jobs

Screenshot 2026-02-25 at 5 12 55 PM

Example when optimization is completed

Screenshot 2026-02-25 at 8 00 10 PM

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 25, 2026
Copy link
Contributor

@Jack-Khuu Jack-Khuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stamp to unblock

Can you share a video or screenshots

# ------------------------


def _call_llm(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check that something like this doesn't already exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can refactor this util in future prs. right now some util is in the worker.py which can be a bit confusing

def _benchmark_initial_kernel(
self, initial_kernel: str, problem_file: Path
) -> float:
"""Benchmark the initial kernel before optimization begins.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we benchmark for the generated kernels as they get iterated?

Seems peculiar that we need a new function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call

Copy link
Contributor

@Laurawly Laurawly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kaiming-cheng kaiming-cheng merged commit 4584c04 into main Feb 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants