Conversation
- Flask routes: /api/llm/records, record, prompt, chat, analyze - Record store, OpenAI-compatible client, prompt templates - index.html: AI Assistant panel and wiring - Ignore llm_config.local.json and llm_chat_debug.jsonl - examples: fix @triton_viz.trace(client=Tracer()) for flip/matmul/histogram - examples/LLMtest: small buggy kernels for assistant smoke tests Made-with: Cursor
- Export setup_llm, setup_llm_from_file, clear_llm_setup, LLM_SETUP_KEYS - CLI: optional --llm-api-key / --llm-base-url before launch - Extended POST/GET /api/llm/config; layered config with config_path - LLM chat panel strings in English - LLMtest: inline _LL_CONFIG_PATH / _LL_API_KEY, drop preflight helper Made-with: Cursor
Sanitizer Performance Benchmark
Iterations: 1 warmup + 20 measured |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1aaa45d380
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Code reviewFound 6 issues:
triton-viz/examples/LLMtest/buggy_vector_add_shift.py Lines 8 to 10 in 1aaa45d
triton-viz/triton_viz/visualizer/llm_utils.py Lines 13 to 15 in 1aaa45d
triton-viz/triton_viz/templates/index.html Lines 473 to 476 in 1aaa45d
triton-viz/triton_viz/visualizer/interface.py Lines 130 to 132 in 1aaa45d
triton-viz/triton_viz/visualizer/interface.py Lines 505 to 531 in 1aaa45d
triton-viz/triton_viz/visualizer/llm_utils.py Lines 274 to 283 in 1aaa45d 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Summary
Adds an optional AI kernel debug assistant to the visualizer: users can run an initial trace-aware analysis, then ask follow-up questions grounded in recorded ops, source snippets, and a compact compute trace. Configuration follows the rest of the stack (local JSON, env, and programmatic setup) without putting secrets in the UI.
What’s included
Backend (Flask)
GET/POST /api/llm/config — inspect / merge effective settings (no API key echoed).
POST /api/llm/analyze — first-pass bug-oriented summary over trace + code context.
POST /api/llm/chat — follow-up Q&A after analysis is ready.
Supporting endpoints: records snapshot, single record, prompt template preview.
Client & config
OpenAI-compatible Chat Completions client (llm_utils.py).
Layered config: defaults → llm_config.local.json → optional setup_llm(config_path=...) → env (TRITON_VIZ_LLM_*, OPENAI_API_KEY) → setup_llm(**kwargs) / POST /api/llm/config.
Package exports: setup_llm, setup_llm_from_file, clear_llm_setup, LLM_SETUP_KEYS.
CLI: optional --llm-api-key / --llm-base-url before launch.
Frontend
Floating AI Assistant panel in index.html: Start analysis, chat input, English copy only for LLM UI strings.
Prompts
visualizer/prompts/system_default.md — English system instructions focused on concrete kernel debugging.
Examples
examples/LLMtest/ — small intentionally buggy kernels + README for smoke-testing the assistant.
Repo hygiene
.gitignore entries for local LLM config and optional debug log (e.g. llm_config.local.json, llm_chat_debug.jsonl).
How to try it
Configure API access (e.g. llm_config.local.json from llm_config.example.json, or triton_viz.setup_llm(...) before launch(), or env vars).
Run a traced script and triton_viz.launch(...).
Open AI Assistant → Start analysis → then ask questions.
See examples/LLMtest/README.md for minimal runnable examples.
Notes for reviewers
No secrets in git: example config only; real keys stay local / env / runtime setup.
POST /api/llm/config does not accept config_path (file path is Python-only via setup_llm).
LLM UI and prompt templates are English-only by design.