x86-64 stochastic superoptimizer and program synthesizer
Top 45.4% on sourcepulse
STOKE is a research prototype for x86-64 superoptimization and program synthesis. It uses stochastic search to explore the vast space of possible program transformations, aiming to generate code that outperforms compilers and even expert hand-written code for performance or size. Its target audience includes researchers and power users interested in advanced code optimization and program synthesis.
How It Works
STOKE employs a stochastic search algorithm, akin to Markov Chain Monte Carlo (MCMC), to iteratively mutate and improve x86-64 code. It explores transformations like instruction replacement, reordering, and operand modification. The search is guided by a cost function that balances correctness (measured against test cases) with other metrics like latency or size. For verification, it supports test-case-based evaluation, bounded formal verification, and full formal verification using SMT solvers like Z3 and CVC4.
Quick Start & Requirements
sudo docker pull stanfordpl/stoke:latest
. Run with sudo docker run -d -P --name stoke stanfordpl/stoke:ARCH
, then SSH into the container. Alternatively, build from source with make
after installing dependencies (including gcc-4.9
).gcc-4.9
for source builds. Docker image includes Z3 and CVC4.Highlighted Details
Maintenance & Community
This is a research prototype and is not actively maintained. The repository serves as an artifact for published papers. Pull requests and inquiries are accepted as time permits. Contact: stoke-developers@lists.stanford.edu
.
Licensing & Compatibility
Limitations & Caveats
STOKE is a research prototype, not a general-purpose tool. It may not optimize generic loops effectively compared to mature compilers. It only supports a subset of x86-64 instructions available at the time of development, potentially causing issues with code generated by newer compilers. The formal validator has limitations on supported instructions and flags. The stoke replace
command has a limitation on function size differences.
1 year ago
Inactive