What problem does it solve?
Optimizing GPU compute shaders in the MNN Vulkan backend is error-prone: edited GLSL .comp files silently do nothing without regenerating SPIR-V arrays, stale pipeline caches cause segfaults, and prefill is often CPU-scheduling-bound rather than GPU-bound, so naive kernel tuning yields no end-to-end gain. This Skill provides a disciplined benchmark-optimize-integrate workflow with correctness oracles and interleaved A/B measurement on real Android devices.
Core Features & Use Cases
- Guided optimization workflow: Three tracks—model-level profiling, targeted operator optimization, and new Vulkan feature integration (cooperative matrix, subgroup, extensions)—each with explicit pass criteria.
- Vulkan-specific diagnostics: Distinguishes CPU command-recording bottlenecks from GPU kernel bottlenecks, reads MNN's op-level and shader-level profilers, and catalogs pitfalls like makeshader pollution, buffer/image backend mismatch, and thermal drift.
- Surgical shader regeneration: Regenerates only the changed shader arrays in AllShader.cpp instead of running full makeshader, keeping diffs clean.
- Use Case: An engineer wants to speed up conv1x1 int4 inference on an Adreno device. The Skill walks them through profiling, identifying the cooperative-matrix dispatch path, applying epilogue coalescing with N-gated fusion, verifying token-level correctness against a frozen baseline, and producing a performance report.
Quick Start
Ask the AI to profile and optimize the Vulkan attention or convolution kernels of an MNN LLM on your connected Android device, following the benchmark, kernel optimization, and integration steps.