Week 4 test guide
A test failed and you don't know why? Find it here: what it checks, and the plausible bugs that are known to fail it. Then read the matching part of the week 4 spec.
How to use this
Run python tools/test.py --compiler PATH --week 4 -v, copy the failing test's name, and search below. "Bugs known to fail it" lists mistakes that were planted in the reference compiler and caught by this test, so one of them is a good first guess. It's not a complete list, and the debugging guide covers what to do when none fit.
| test | kind | what it checks | bugs known to fail it |
|---|---|---|---|
render/normalize_4096 | render | render elementwise at 0 render expand zero render load at offset 0 render reduce reversed render skips rangeify render store loop short | |
render/normalize_stage_4096 | render | render elementwise at 0 render expand zero render load at offset 0 render reduce reversed render skips rangeify render stage reads x[0] render store loop short | |
render/r_add_f32_2048 | render | elementwise add of two large f32 vectors | render elementwise at 0 render load at offset 0 render skips rangeify render store loop short |
render/r_cast_f32_i32_1024 | render | f32 to i32 casts in range, truncating | none recorded |
render/r_cast_i32_f32_1024 | render | i32 to f32 rounds to nearest-even for big values | none recorded |
render/r_chained_reduce_1024 | render | subtract the max, then scale by the inverse sum of squares | render expand zero |
render/r_copy_4096 | render | a plain 4096-element copy (load, then store): still has to be a loop to fit in 20 KB | no size threshold |
render/r_differences_2047 | render | adjacent differences from two overlapping views of one buffer | none recorded |
render/r_divmod_1024 | render | C-style div and mod with negatives and -1 divisors (UB-free) | none recorded |
render/r_dot_4096 | render | a 4096-wide dot product | render reduce reversed |
render/r_expand_dtypes_1024 | render | expand i32, f32 and bool scalars into buffers | none recorded |
render/r_index_computed | render | index into a computed vector at a loaded, masked index | none recorded |
render/r_max_specials_1024 | render | elementwise max with nan, signed zeros and infinities | none recorded |
render/r_mean_variance_2048 | render | mean and variance of 2048 values, written to two slots | none recorded |
render/r_mul_i32_wrap_1024 | render | i32 elementwise mul wraps per element, in a loop | none recorded |
render/r_recip_1024 | render | recip per element, signed zeros included | none recorded |
render/r_reduce_add_i32_4096 | render | a 4096-wide i32 sum wraps | none recorded |
render/r_reduce_add_order_4096 | render | a 4096-wide f32 sum whose bits depend on folding left to right | none recorded |
render/r_reduce_in_hand_loop | render | a reduce result feeding a hand-written week 3 loop | none recorded |
render/r_reduce_max_nan_2048 | render | max with a nan in the middle is nan. Without the nan it is the true max | none recorded |
render/r_reduce_max_signed_zero | render | max over only signed zeros gives +0.0 if any +0.0 is present | none recorded |
render/r_reduce_mul_i32_1024 | render | i32 product of 1024 values wraps at every step | none recorded |
render/r_reduce_single | render | a one-element reduce is a zero-trip loop after the first element | render reduce from zero |
render/r_relu_4096 | render | relu by cmplt and where, 4096 wide | none recorded |
render/r_shl_1024 | render | shl per element wraps | none recorded |
render/r_stage_scalar | render | stage on a scalar is just that scalar | none recorded |
render/r_stage_twice_4096 | render | a staged vector read by two reduces and a store | render stage reads x[0] |
render/r_two_outputs_2048 | render | one loaded vector feeding two outputs | none recorded |
render/r_used_twice_2048 | render | a squared vector used in a reduce and elementwise, recomputed | none recorded |
render/r_used_twice_stage_2048 | render | a squared vector used in a reduce and elementwise, materialized with stage | render stage reads x[0] |
render/r_view_slices_1500 | render | rank-1 views at an offset: copy b[3..1502] + 1 into c[1..1500] | none recorded |
render/r_where_i32_2048 | render | clamp i32 to [-100, 100] with where | none recorded |
render/r_xor_bool_1024 | render | bool xor into a bool buffer | none recorded |
run/add_i32_vec | run: pass | elementwise i32 add on rank-1 values | elementwise uses x[0] |
run/add_i32_wrap_vec | run: pass | elementwise add wraps per element | elementwise uses x[0] |
run/cast_vec | run: pass | cast works per element | elementwise uses x[0] |
run/chained_reduce | run: pass | max, then a sum of squares of x - max | expand scalar is zero |
run/cmplt_where_vec | run: pass | cmplt gives a bool vector, and where selects per element | expand scalar is zero |
run/div_mod_vec | run: pass | C-style div and mod per element, INT_MIN / -1 wraps | none recorded |
run/dot | run: pass | a dot product is reduce(mul(x, y)) | none recorded |
run/err_div_zero_vec | run: invalid | one zero divisor in a vector is a runtime error | none recorded |
run/err_expand_grows_non1_axis | run: invalid | expand only grows size-1 axes: a size-2 axis cannot become size 3 (a scalar or same-rank value is fine from week 5) | none recorded |
run/err_expand_no_shape | run: invalid | expand needs shape=[n] | none recorded |
run/err_expand_zero | run: invalid | shape=[0] isn't a shape | none recorded |
run/err_missing_expand | run: invalid | no implicit broadcasting: a scalar must be expanded first | none recorded |
run/err_rank1_open_range | run: invalid | a rank-1 value can't depend on an open range | shaped on open range ok |
run/err_reduce_bad_op | run: invalid | reduce op must be add, mul or max | none recorded |
run/err_reduce_bool | run: invalid | reduce works on i32 or f32 only | reduce on bool |
run/err_reduce_no_op | run: invalid | reduce needs op= | none recorded |
run/err_reduce_scalar | run: invalid | reduce takes a rank-1 value | reduce takes scalars |
run/err_shape_mismatch | run: invalid | elementwise ops need equal shapes | none recorded |
run/err_where_scalar_cond | run: invalid | where needs its condition in the same shape as its branches | none recorded |
run/expand_dtypes | run: pass | expand broadcasts a scalar of any dtype | expand scalar is zero |
run/fail_vec | run: assert_fail | a computed vector that doesn't match | none recorded |
run/index_computed_vec | run: pass | index into a computed rank-1 value | none recorded |
run/inloop_after_not_output | run: pass | an after inside a loop is local to an iteration, not an output: no top-level after builds on %b, so %b's output is unchanged | in-loop afters are outputs |
run/load_view_rank1 | run: pass | load a [k] view, add an expanded scalar, store into another buffer's view | none recorded |
run/max_f32_nan_vec | run: pass | elementwise max: nan wins, -0.0 vs 0.0 gives +0.0 | none recorded |
run/mean_variance | run: pass | mean, then variance from the deviations | none recorded |
run/mul_add_f32_vec | run: pass | f32 elementwise ops round after every op | none recorded |
run/normalize_small | run: pass | x / sum(x): x is used twice, once inside the reduce and once after | none recorded |
run/normalize_small_stage | run: pass | the same with stage: identical results | stage zeroes |
run/recip_vec | run: pass | recip per element, including signed zeros | none recorded |
run/reduce_add_f32_order | run: pass | reduce add folds left to right from x[0]; right to left would give 0.0 | fold right to left |
run/reduce_add_i32_wrap | run: pass | reduce add on i32 wraps at each step | none recorded |
run/reduce_add_negzero | run: pass | a fold that starts from x[0] keeps -0.0; starting from 0.0 would lose the sign | fold from zero |
run/reduce_in_hand_loop | run: pass | a reduce result (no open ranges) used inside a week 3 loop | none recorded |
run/reduce_max_i32 | run: pass | reduce max of negatives | fold from zero reduce op ignored |
run/reduce_max_nan | run: pass | reduce max: any nan makes the result nan | fold skips nan |
run/reduce_max_signed_zero | run: pass | reduce max of -0.0 and 0.0 is +0.0 | fold from zero |
run/reduce_mul_f32 | run: pass | reduce mul on f32 rounds after every step (and overflows to inf) | reduce op ignored |
run/reduce_mul_i32_wrap | run: pass | reduce mul on i32 wraps at each step | reduce op ignored |
run/reduce_of_expand | run: pass | reducing an expanded scalar | none recorded |
run/reduce_single | run: pass | a one-element reduce is that element | none recorded |
run/shl_vec | run: pass | shl per element wraps | none recorded |
run/stage_identity | run: pass | stage doesn't change the value, rank 1 or scalar | stage zeroes |
run/xor_vec | run: pass | xor on bool and i32 vectors | none recorded |