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.

testkindwhat it checksbugs known to fail it
render/normalize_4096renderrender elementwise at 0
render expand zero
render load at offset 0
render reduce reversed
render skips rangeify
render store loop short
render/normalize_stage_4096renderrender 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_2048renderelementwise add of two large f32 vectorsrender elementwise at 0
render load at offset 0
render skips rangeify
render store loop short
render/r_cast_f32_i32_1024renderf32 to i32 casts in range, truncatingnone recorded
render/r_cast_i32_f32_1024renderi32 to f32 rounds to nearest-even for big valuesnone recorded
render/r_chained_reduce_1024rendersubtract the max, then scale by the inverse sum of squaresrender expand zero
render/r_copy_4096rendera plain 4096-element copy (load, then store): still has to be a loop to fit in 20 KBno size threshold
render/r_differences_2047renderadjacent differences from two overlapping views of one buffernone recorded
render/r_divmod_1024renderC-style div and mod with negatives and -1 divisors (UB-free)none recorded
render/r_dot_4096rendera 4096-wide dot productrender reduce reversed
render/r_expand_dtypes_1024renderexpand i32, f32 and bool scalars into buffersnone recorded
render/r_index_computedrenderindex into a computed vector at a loaded, masked indexnone recorded
render/r_max_specials_1024renderelementwise max with nan, signed zeros and infinitiesnone recorded
render/r_mean_variance_2048rendermean and variance of 2048 values, written to two slotsnone recorded
render/r_mul_i32_wrap_1024renderi32 elementwise mul wraps per element, in a loopnone recorded
render/r_recip_1024renderrecip per element, signed zeros includednone recorded
render/r_reduce_add_i32_4096rendera 4096-wide i32 sum wrapsnone recorded
render/r_reduce_add_order_4096rendera 4096-wide f32 sum whose bits depend on folding left to rightnone recorded
render/r_reduce_in_hand_looprendera reduce result feeding a hand-written week 3 loopnone recorded
render/r_reduce_max_nan_2048rendermax with a nan in the middle is nan. Without the nan it is the true maxnone recorded
render/r_reduce_max_signed_zerorendermax over only signed zeros gives +0.0 if any +0.0 is presentnone recorded
render/r_reduce_mul_i32_1024renderi32 product of 1024 values wraps at every stepnone recorded
render/r_reduce_singlerendera one-element reduce is a zero-trip loop after the first elementrender reduce from zero
render/r_relu_4096renderrelu by cmplt and where, 4096 widenone recorded
render/r_shl_1024rendershl per element wrapsnone recorded
render/r_stage_scalarrenderstage on a scalar is just that scalarnone recorded
render/r_stage_twice_4096rendera staged vector read by two reduces and a storerender stage reads x[0]
render/r_two_outputs_2048renderone loaded vector feeding two outputsnone recorded
render/r_used_twice_2048rendera squared vector used in a reduce and elementwise, recomputednone recorded
render/r_used_twice_stage_2048rendera squared vector used in a reduce and elementwise, materialized with stagerender stage reads x[0]
render/r_view_slices_1500renderrank-1 views at an offset: copy b[3..1502] + 1 into c[1..1500]none recorded
render/r_where_i32_2048renderclamp i32 to [-100, 100] with wherenone recorded
render/r_xor_bool_1024renderbool xor into a bool buffernone recorded
run/add_i32_vecrun: passelementwise i32 add on rank-1 valueselementwise uses x[0]
run/add_i32_wrap_vecrun: passelementwise add wraps per elementelementwise uses x[0]
run/cast_vecrun: passcast works per elementelementwise uses x[0]
run/chained_reducerun: passmax, then a sum of squares of x - maxexpand scalar is zero
run/cmplt_where_vecrun: passcmplt gives a bool vector, and where selects per elementexpand scalar is zero
run/div_mod_vecrun: passC-style div and mod per element, INT_MIN / -1 wrapsnone recorded
run/dotrun: passa dot product is reduce(mul(x, y))none recorded
run/err_div_zero_vecrun: invalidone zero divisor in a vector is a runtime errornone recorded
run/err_expand_grows_non1_axisrun: invalidexpand 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_shaperun: invalidexpand needs shape=[n]none recorded
run/err_expand_zerorun: invalidshape=[0] isn't a shapenone recorded
run/err_missing_expandrun: invalidno implicit broadcasting: a scalar must be expanded firstnone recorded
run/err_rank1_open_rangerun: invalida rank-1 value can't depend on an open rangeshaped on open range ok
run/err_reduce_bad_oprun: invalidreduce op must be add, mul or maxnone recorded
run/err_reduce_boolrun: invalidreduce works on i32 or f32 onlyreduce on bool
run/err_reduce_no_oprun: invalidreduce needs op=none recorded
run/err_reduce_scalarrun: invalidreduce takes a rank-1 valuereduce takes scalars
run/err_shape_mismatchrun: invalidelementwise ops need equal shapesnone recorded
run/err_where_scalar_condrun: invalidwhere needs its condition in the same shape as its branchesnone recorded
run/expand_dtypesrun: passexpand broadcasts a scalar of any dtypeexpand scalar is zero
run/fail_vecrun: assert_faila computed vector that doesn't matchnone recorded
run/index_computed_vecrun: passindex into a computed rank-1 valuenone recorded
run/inloop_after_not_outputrun: passan after inside a loop is local to an iteration, not an output: no top-level after builds on %b, so %b's output is unchangedin-loop afters are outputs
run/load_view_rank1run: passload a [k] view, add an expanded scalar, store into another buffer's viewnone recorded
run/max_f32_nan_vecrun: passelementwise max: nan wins, -0.0 vs 0.0 gives +0.0none recorded
run/mean_variancerun: passmean, then variance from the deviationsnone recorded
run/mul_add_f32_vecrun: passf32 elementwise ops round after every opnone recorded
run/normalize_smallrun: passx / sum(x): x is used twice, once inside the reduce and once afternone recorded
run/normalize_small_stagerun: passthe same with stage: identical resultsstage zeroes
run/recip_vecrun: passrecip per element, including signed zerosnone recorded
run/reduce_add_f32_orderrun: passreduce add folds left to right from x[0]; right to left would give 0.0fold right to left
run/reduce_add_i32_wraprun: passreduce add on i32 wraps at each stepnone recorded
run/reduce_add_negzerorun: passa fold that starts from x[0] keeps -0.0; starting from 0.0 would lose the signfold from zero
run/reduce_in_hand_looprun: passa reduce result (no open ranges) used inside a week 3 loopnone recorded
run/reduce_max_i32run: passreduce max of negativesfold from zero
reduce op ignored
run/reduce_max_nanrun: passreduce max: any nan makes the result nanfold skips nan
run/reduce_max_signed_zerorun: passreduce max of -0.0 and 0.0 is +0.0fold from zero
run/reduce_mul_f32run: passreduce mul on f32 rounds after every step (and overflows to inf)reduce op ignored
run/reduce_mul_i32_wraprun: passreduce mul on i32 wraps at each stepreduce op ignored
run/reduce_of_expandrun: passreducing an expanded scalarnone recorded
run/reduce_singlerun: passa one-element reduce is that elementnone recorded
run/shl_vecrun: passshl per element wrapsnone recorded
run/stage_identityrun: passstage doesn't change the value, rank 1 or scalarstage zeroes
run/xor_vecrun: passxor on bool and i32 vectorsnone recorded