Altifigence Academy

18 / 20 · Concept

Design signed and boundary tests

Combine arithmetic, shape and control boundaries beyond one happy-path example.

Choose inputs that distinguish faults

The positive 2×2 example reveals skew and indexing, but not sign extension or saturation. All-one matrices help check counts yet can hide transposition. Use asymmetric values, negatives, zeros and different rows and columns.

A=[[2,−1],[0,3]] and B=[[4,5],[−2,1]] produce [[10,9],[−6,3]]. This includes positive and negative outputs and a valid zero. Identity B must reproduce A. Zero B must produce zero outputs while every PE still consumes K terms.

For W=8, K=4, repeated minimum×minimum gives 65536; repeated minimum×maximum gives −65024; repeated maximum×maximum gives 64516. All fit AW=18. Testing only the largest positive operand misses the largest positive product.

For A row [−128,−128,127,127] and B column [−128,127,−128,127], products are [16384,−16256,−16256,16129]. Their sum is one, with prefix sums [16384,128,−16128,1]. A small final result does not justify a narrow intermediate accumulator.

Cover shape and control boundaries

N=1,K=1 completes after E0. N=3,K=1 still finishes after E4 because operands traverse the grid. N=1,K=5 is a five-edge dot product without spatial skew. Testing K=1,2,3,4 crosses counter-width boundaries, especially the difference between storing K−1 and storing K.

Insert pauses before the first MAC, mid-reduction and before the last MAC. Block outputs after completion. Reset after clear, mid-job and while a valid result is pending. Old-job output after reset is a failure. Compare exact-multiple tile shapes with shapes leaving one row or column; verify masks by coordinates.

For each passing case, specify the matrix, exact consumed-term lists, advance-edge count, pause count and delivered output coordinates. Negative tests need an expected error category. Keep exact accumulator checks separate from output quantization. Fixed boundary fixtures plus seeded random tests make failures reproducible while expanding coverage beyond a single example.

Try it yourself

For N=3,K=1, find the final edge number and edge count. Also find the four-term minimum×maximum sum for W=8,K=4.

Read the explanation

Final edge number is 1+6−3=4, giving five edges E0..E4. One minimum×maximum product is −16256; four sum to −65024.

Your choice applies to this browser. Change it any time using the footer.