Build a compiler to solve Anthropic's interview challenge.
@AnthropicAI published their take-home interview challenge on Feb/2026: optimize a kernel running on a simulated VLIW SIMD virtual machine to minimize cycle count for a tree traversal + hash computation workload. It has now been about 5 months since the challenge was released, so I am sharing my work as well. I hope this does not interfere with Anthropic’s interview process.
The original intent of the challenge was for candidates to collaborate with an LLM and manually optimize the assembly program. I took a somewhat different approach: I built an optimizing compiler for the VLIW machine. The compiler can optimize not only the tree-traversal and hash program used in the interview challenge, but also the performance of arbitrary programs targeting this machine. My solution does not use any algorithm-level optimizations, nor does it contain any optimizations specifically tailored to this program or benchmark. Every optimization is a general-purpose compiler optimization.
Result:
CYCLES: 1137
Speedup over baseline: 129.93315743183817
Check it out if you are interested in techniques:
Loop unrolling;
Common subexpression elimination;
Dead code elimination;
Peephole optimizations;
Scalar replacement of aggregate;
Arry scalarization;
Alias analysis;
Memory dependency based load/store elimination;
Straight line strength reduction;
Data dependency analysis;
SLP vectorization;
Load-store vectorization;
VLIW instruction scheduling;
Register allocation;
etc.