atlas

Research map / Large language models / Agents, code and math

QiMeng-GEMM: Automatically Generating High-Performance Matrix Multiplication Code by Exploiting Large Language Models

AAAI 2025 · Large language models › Agents, code and math · approach: LLMs for optimization and heuristics · 3 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes QiMeng-GEMM, a meta-prompt plus tree-search auto-tuning framework that lets LLMs iteratively generate high-performance GEMM code on RISC-V CPU and NVIDIA GPUs.

Problem

LLMs can produce functionally correct simple code but not high-performance GEMM code, because they do not understand diverse hardware architectures (RISC-V CPU, NVIDIA GPU) and prompts do not unlock their optimization ability.

Approach

Meta-prompts built from five GEMM optimization primitives (tiling, reordering, vectorization, layout, pipeline), each combined with platform-specific hints and code skeletons from hint repositories, plus a beam-style tree search over sequences of primitives where LLM-generated code is evaluated and the top-k are kept at each step.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Replace a vanilla prompt with QiMeng-GEMMGPT-4o GEMM code generation · C910 CPU, matrix dimension 4096GFLOPS: 0.09 -> 10.23Helped
Replace a vanilla prompt with QiMeng-GEMMGPT-4o GEMM code generation · RTX 4070, matrix dimension 8192TFLOPS: 1.48 -> 14.28Helped
Replace a vanilla prompt with QiMeng-GEMMGPT-4o GEMM code generation · A100, matrix dimension 16384TFLOPS: 4.73 -> 18.55Helped
Use QiMeng-GEMM instead of OpenBLAS 0.3.27GEMM on C910 CPU, matrix dimension 4096 · C910 CPU, matrix dimension 4096GFLOPS: 4.85 -> 10.23Helped
Use QiMeng-GEMM instead of cuBLAS 12.1GEMM on RTX 4070, matrix dimension 8192 · RTX 4070, matrix dimension 8192TFLOPS: 14.25 -> 14.28Helped
Use QiMeng-GEMM instead of cuBLAS 12.1GEMM on A100, matrix dimension 16384 · A100, matrix dimension 16384TFLOPS: 19.22 -> 18.55Hurt
Add the platform-specific hint for block tiling (ablation)QiMeng-GEMM on A100 GPU · A100 GPUTFLOPS: 4.74 -> 4.78No clear effect
Add the platform-specific hint for thread tiling (ablation)QiMeng-GEMM on A100 GPU · A100 GPUTFLOPS: 4.31 -> 14.59Helped
Add the platform-specific hint for double buffering (ablation)QiMeng-GEMM on A100 GPU · A100 GPUTFLOPS: 16.72 -> 18.51Helped
Search optimization-primitive combinations using auto-tuning (ablation)QiMeng-GEMM on C910 CPU · C910 CPUperformance relative to OpenBLAS: 100%Helped

Surprising findings

Limitations

Experimental setup

Datasets: matrix dimensions from deep learning models such as Llama2-7b and Mistral-7B

Benchmarks: GEMM performance on XuanTie C910 RISC-V CPU, NVIDIA RTX 4070, and A100 GPU across matrix sizes

Metrics: GFLOPS TFLOPS speedup over vanilla prompt development time

Baselines: vanilla prompt CoT prompt OpenBLAS cuBLAS Junior Coder Senior Coder

Builds on: chain-of-thought prompting

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy