Skip to content
ACGT{ }A</>GT
🧬

SARTECO 2026 · Research paper

Code that translates itself

Porting the Striped Smith-Waterman Library to RISC-V via LLM-Driven Translation

How we taught a large language model to port vector libraries from x86 to RISC-V —and to fix its own mistakes— reaching up to 21.7× speedup on genomic alignment.

SARTECO 2026Conference paper21.7× faster

The problem we accelerated

Sequence alignment with Smith-Waterman

Smith-Waterman finds the best overlap between two DNA sequences by filling this matrix and following the highest-scoring trail. It is exact but expensive: that is why it gets vectorized. It is exactly the library we accelerated.

QueryTGTTACGG
ReferenceGGTTGACTA
G
G
T
T
G
A
C
T
A
T
G
T
T
A
C
G
G
Optimal alignment
·
·
Best score: 13

Two phases, zero human intervention

From x86 intrinsic to RISC-V vector

Input · x86 SSE
__m128i r = _mm_add_epi16(a, b);
Output · RISC-V Vector
vint16m1_t r = __riscv_vadd_vv_i16m1(a, b, vl);

Compile-and-fix loop

compile
error
the AI fixes it
correct
Phase 1 · Correctness

Translates x86 intrinsics to RISC-V, using sse2rvv as a foundation. The goal: make it compile and return the exact same result.

Phase 2 · Optimization

Rewrites the code to exploit RVV's scalable vector-length model, squeezing out an extra 1.30× of speed.

The research in brief

Four ideas to understand the paper without being an expert.

01

The problem

RISC-V is an open, fast-growing processor architecture, but it lacks the huge ecosystem of optimized libraries x86 accumulated over decades. Porting that code by hand is slow, delicate, and requires experts.

02

The idea

What if a language model did the translation? We give it the x86 vector code and ask for its RISC-V equivalent, letting the compiler and simulator themselves flag when it gets it wrong.

03

How it works

A two-phase pipeline: the first guarantees the translation is correct; the second optimizes it. At every step, a compile-and-fix loop lets the AI iteratively repair its own errors.

04

Why it matters

The result matches a hand-optimized implementation in performance and correctness, but with no human intervention. It is a path to populate RISC-V with fast software far more quickly.

21.7×

peak speedup

1.30×

extra in Phase 2

0

lines written by hand

🧬

Read the full paper

Published open access (CC-BY 4.0) at the XXXVI SARTECO 2026 conference. Code and data available.

DOI: 10.5281/zenodo.21064372