Documentation Index
Fetch the complete documentation index at: https://mintlify.com/anthropics/original_performance_takehome/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Validation ensures your optimized kernel produces correct results and meets performance targets. The challenge provides multiple layers of validation, from unit tests to submission benchmarks.Running Unit Tests
All Tests
Run all tests inperf_takehome.py:
Specific Tests
Run individual test methods:Available Tests
perf_takehome.py:228-258
The commented-out
test_kernel_correctness test can be uncommented for additional debugging with various parameter combinations.Submission Tests
The official validation for your submission usestests/submission_tests.py:
Important: Don't modify tests/ folder
Important: Don't modify tests/ folder
From the instructions:
perf_takehome.py:13-14
Correctness Tests
submission_tests.py:57-60
Speed Tests
The submission includes progressive speed thresholds:submission_tests.py:76-116
You don’t need to pass all speed tests to succeed. The impressiveness isn’t linear in the number of tests passed.
Debug Engine Instructions
The simulator includes a debug engine for validating intermediate values against the reference implementation.Compare Instructions
Check scalar values during execution:perf_takehome.py:140-144
problem.py:366-374
Vector Compare
For SIMD operations, usevcompare:
problem.py:375-381
Debug Comments
Add comments to trace output for clarity:perf_takehome.py:124
Debug instructions are ignored by the submission simulator. They only affect validation during development.
The Pause/Yield Mechanism
The pause mechanism synchronizes your kernel with the reference implementation for step-by-step validation.How It Works
Reference kernel usesyield to pause at checkpoints:
problem.py:535-568
pause instructions to match:
perf_takehome.py:121-123
perf_takehome.py:206-221
Important: Pause instructions must match the reference kernel’s yields during development testing, but are ignored by the submission simulator.
Controlling Pause Behavior
problem.py:116-117
submission_tests.py:41-42
Comparing with Reference Kernels
Two reference implementations are provided:reference_kernel
Python implementation operating on Tree and Input objects
reference_kernel2
Flat memory implementation that matches the simulator’s memory layout
Using reference_kernel2 for Validation
perf_takehome.py:229-242
Common Validation Errors
Incorrect result on round N
Incorrect result on round N
Your kernel’s output doesn’t match the reference at a specific iteration.Debug steps:
- Add debug compare instructions at intermediate steps
- Run with
prints=Trueto see values - Use trace visualization to inspect scratch variables
Assertion: res != ref for key at pc=X
Assertion: res != ref for key at pc=X
A debug compare instruction failed.The error shows:
res: Your computed valueref: Expected value from referencekey: Which variable/step failedpc: Program counter (instruction number)
Out of scratch space
Out of scratch space
perf_takehome.py:67
Exceeds slot limit
Exceeds slot limit
problem.py:383
Correctness vs Performance
Real Validation Examples
Example 1: Checking Hash Computation
perf_takehome.py:150-152
Example 2: Verifying Index Wrapping
perf_takehome.py:160-163
n_nodes.
Example 3: Full Validation Loop
perf_takehome.py:183-221
Debugging with Prints
Enable detailed output during validation:- Scratch variable states
- Instruction details
- Memory contents at validation points
Best Practices
Test Early, Test Often
Run validation after every significant change
Use Debug Instructions
Add compare instructions at critical computation steps
Understand Failures
Don’t just fix errors — understand why they occurred
Keep Reference Sync
Maintain pause/yield alignment during development