opencl-optimize
Skill by alibaba
Guides GPU kernel performance optimization and new OpenCL feature integration for the MNN inference framework. It covers benchmarks, kernel tuning, and validation on Android phones.
Install opencl-optimize
Built from the published package, never by AI.
git clone --depth 1 https://github.com/alibaba/MNN /tmp/MNN && mkdir -p ~/.claude/skills && cp -r /tmp/MNN/skills/opencl-optimize ~/.claude/skills/opencl-optimizeRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/alibaba/MNN /tmp/MNN && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/MNN/skills/opencl-optimize ~/.gemini/antigravity-cli/skills/opencl-optimizeAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
opencl-optimize is an agent skill for the OpenCL backend of the MNN inference framework. It guides work on kernel performance for operators such as conv, gemm, gemv, attention and elementwise, and on adding new operators. It offers three directions: model-level optimization driven by profiling, optimization of a named operator, and integration of new OpenCL features such as extensions.
The skill sets rules for the work. It requires running the codegen script after editing .cl files, checking which kernel the dispatcher selects, and keeping a correct baseline before tuning. New OpenCL features need user-supplied sample code and a runtime fallback path. Validation is done on Android phones, since desktop OpenCL behaves differently. It is aimed at developers working on MNN GPU kernels.
Written from the project's SKILL.md and checked against it.
What it can do
- Model-level optimizationProfiles the full model, ranks kernel time, and iterates on the largest bottleneck.
- Operator optimizationOptimizes a named operator, either at kernel level or across all of its kernels.
- New feature integrationAdapts user-supplied OpenCL extension sample code to MNN, with a fallback path.
- Standalone kernel demoBuilds a separate demo to iterate on a kernel and compare its output with a saved baseline.
- Codegen workflowEdits .cl files and regenerates the embedded *_mnn_cl.cpp strings with opencl_codegen.py.
- Dispatch path checkReads host dispatch code to find which kernel a given shape and dtype selects.
- Correctness checksCompares GPU output with CPU or a frozen baseline using tolerance tables for fp32, fp16 and quantized paths.
- Android device testingPushes builds with adb and runs run_test.out or llm_demo on a phone.
- Optimization handbookReferences a handbook of kernel techniques, pitfalls and a quick lookup table.
What you need
- An Android phone with an OpenCL GPU, connected over adb
- MNN source tree with the Android OpenCL build setup
- Python 3 to run opencl_codegen.py
- Runnable sample code from the user for new OpenCL features
Try asking
- Profile the whole model on my Android phone and rank the slowest OpenCL kernels.
- Optimize the conv operator in MNN's OpenCL backend and check results against CPU.
- Integrate this OpenCL vendor extension sample into MNN with a fallback path.
Good to know
- Mac and desktop OpenCL results do not represent phone performance; without a device the skill stops and asks the user.
- It must not read or modify schema/private/ or source/internal/.
- Running codegen regenerates all *_mnn_cl.cpp files, so unrelated files can appear in diffs.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/opencl-optimize/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md25 KB -
benchmark.md5 KB -
integrate.md5 KB -
kernel-opt.md7 KB -
new-feature.md10 KB
Show all 6 files
-
optimization-handbook.md37 KB
Alternatives to opencl-optimize
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
opencl-optimize: common questions
Does it need an Android device?
Yes. The skill targets Android phone GPUs and says Mac or desktop OpenCL does not reflect phone performance or stability. Without a device it stops and asks the user for one.
Why must I run codegen after editing a .cl file?
The build does not compile .cl sources directly. The runtime reads the embedded strings in *_mnn_cl.cpp, so changes only take effect after codegen regenerates them.
Can it integrate any OpenCL extension?
It asks users to provide runnable sample code, since GPU vendors may behave differently for the same extension. It also keeps the original path as a fallback chosen by runtime feature detection.
How do I install opencl-optimize?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is opencl-optimize free?
The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.
Is opencl-optimize safe to use?
It scores 91 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to opencl-optimize?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
