Skip to content

Add AutoKernel example for an LLM optimizing GPU kernels#1527

Open
harmya wants to merge 3 commits intomainfrom
harmya/autokernel
Open

Add AutoKernel example for an LLM optimizing GPU kernels#1527
harmya wants to merge 3 commits intomainfrom
harmya/autokernel

Conversation

@harmya
Copy link
Contributor

@harmya harmya commented Mar 17, 2026

This runs AutoKernel on Modal. We setup Claude to do a long running optimization job on a Llama Model that identifies and optimizes bottlenecked parts of the model.

Here is how the results would look if you ran this:
result.txt

Type of Change

  • New example for the GitHub repo

Monitoring Checklist

  • Example is configured for testing in the synthetic monitoring system, or lambda-test: false is provided in the example frontmatter and I have gotten approval from a maintainer
    • Example is tested by executing with modal run, or an alternative cmd is provided in the example frontmatter (e.g. cmd: ["modal", "serve"])
    • Example is tested by running the cmd with no arguments, or the args are provided in the example frontmatter (e.g. args: ["--prompt", "Formula for room temperature superconductor:"]
    • Example does not require third-party dependencies besides fastapi to be installed locally (e.g. does not import requests or torch in the global scope or other code executed locally)

Documentation Site Checklist

Content

  • Example is documented with comments throughout, in a Literate Programming style
  • All media assets for the example that are rendered in the documentation site page are retrieved from modal-cdn.com

Outside Contributors

You're great! Thanks for your contribution.


Open with Devin

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 2 potential issues.

View 5 additional findings in Devin Review.

Open in Devin Review

)
)

app = modal.App("autokernel", image=image)
Copy link
Contributor

Choose a reason for hiding this comment

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

🟡 App name missing required example- prefix per repo convention

The internal/CLAUDE.md:148-152 rules explicitly require app names to use example- prefix with kebab-case (e.g., modal.App("example-vllm-inference")). The current code uses "autokernel" instead of "example-autokernel". While some older examples also lack this prefix, it is a clearly documented convention for new examples.

Suggested change
app = modal.App("autokernel", image=image)
app = modal.App("example-autokernel", image=image)
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

"curl -LsSf https://astral.sh/uv/install.sh | sh",
"curl -fsSL https://deb.nodesource.com/setup_20.x | bash -",
"apt-get install -y nodejs",
"npm install -g @anthropic-ai/claude-code",
Copy link
Contributor

Choose a reason for hiding this comment

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

🟡 Container dependency @anthropic-ai/claude-code is not version-pinned

The internal/CLAUDE.md:59-66 and the PR checklist both require all container image dependencies to be pinned to at least SemVer minor version. npm install -g @anthropic-ai/claude-code installs whatever version is latest at image build time. A breaking release of the Claude Code CLI could silently break the agent loop. This should be pinned, e.g., npm install -g @anthropic-ai/claude-code@1.0.3.

Prompt for agents
In 06_gpu_and_ml/agents/autokernel.py line 74, pin the @anthropic-ai/claude-code npm package to a specific version. Check the latest stable version and change the install command from:
  npm install -g @anthropic-ai/claude-code
to something like:
  npm install -g @anthropic-ai/claude-code@1.0.3

Similarly consider pinning the Node.js version (line 72-73 uses setup_20.x which is OK as a major version pin) and the uv installer (line 71 pulls latest). The uv installer is less critical since it's a build tool, but the Claude Code CLI is the primary dependency that drives the agent loop.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant