FAILURE MAP
← Case archive

FA-52071 / Raster memory layout / Open access

Mip Chain Directory: Selected mip extent is read from base or terminal level · case 01

The returned physical layout descriptor disagrees with the declared buffer mapping at selected_size.

Verified by executionVariant 1 · 6 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Selected mip extent is read from base or terminal level The faulty expression is level_sizes[0].

VERIFIED REPAIR

Apply the stipulated layout rule at selected_size: level_sizes[p["level"]].

Unsuccessful approach: The attempted repair uses level_sizes[-1] and still violates the layout contract.

Case contract

Store four mip levels consecutively. Each level uses ceil-halving, keeps dimensions at least one, has a two-byte row guard and a three-byte level header. A four-entry directory of two-byte offsets precedes all levels. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.

Why this case matters

Offline raster resource, upload, readback, and storage-layout regression model.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    widths = [max(1,(p["w"]+(1<<i)-1)//(1<<i)) for i in range(4)]
    heights = [max(1,(p["h"]+(1<<i)-1)//(1<<i)) for i in range(4)]
    row_pitches = [w*p["b"]+2 for w in widths]
    level_sizes = [row_pitches[i]*heights[i]+3 for i in range(4)]
    directory_size = 4*2
    level_offsets = [directory_size+sum(level_sizes[:i]) for i in range(4)]
    selected_size = level_sizes[0]
    level_origin = p["base"]+level_offsets[p["level"]]
    payload_origin = level_origin+3
    allocation_end = p["base"]+directory_size+sum(level_sizes)
    return {'widths': widths, 'heights': heights, 'row_pitches': row_pitches, 'level_sizes': level_sizes, 'directory_size': directory_size, 'level_offsets': level_offsets, 'selected_size': selected_size, 'level_origin': level_origin, 'payload_origin': payload_origin, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 8, 'h': 5, 'b': 2, 'base': 9, 'level': 0, 'x': 0, 'y': 0}, {'widths': [8, 4, 2, 1], 'heights': [5, 3, 2, 1], 'row_pitches': [18, 10, 6, 4], 'level_sizes': [93, 33, 15, 7], 'directory_size': 8, 'level_offsets': [8, 101, 134, 149], 'selected_size': 93, 'level_origin': 17, 'payload_origin': 20, 'allocation_end': 165}), ({'w': 9, 'h': 6, 'b': 2, 'base': 9, 'level': 1, 'x': 0, 'y': 0}, {'widths': [9, 5, 3, 2], 'heights': [6, 3, 2, 1], 'row_pitches': [20, 12, 8, 6], 'level_sizes': [123, 39, 19, 9], 'directory_size': 8, 'level_offsets': [8, 131, 170, 189], 'selected_size': 39, 'level_origin': 140, 'payload_origin': 143, 'allocation_end': 207}), ({'w': 10, 'h': 7, 'b': 2, 'base': 9, 'level': 2, 'x': 0, 'y': 0}, {'widths': [10, 5, 3, 2], 'heights': [7, 4, 2, 1], 'row_pitches': [22, 12, 8, 6], 'level_sizes': [157, 51, 19, 9], 'directory_size': 8, 'level_offsets': [8, 165, 216, 235], 'selected_size': 19, 'level_origin': 225, 'payload_origin': 228, 'allocation_end': 253}), ({'w': 11, 'h': 8, 'b': 2, 'base': 9, 'level': 3, 'x': 0, 'y': 0}, {'widths': [11, 6, 3, 2], 'heights': [8, 4, 2, 1], 'row_pitches': [24, 14, 8, 6], 'level_sizes': [195, 59, 19, 9], 'directory_size': 8, 'level_offsets': [8, 203, 262, 281], 'selected_size': 9, 'level_origin': 290, 'payload_origin': 293, 'allocation_end': 299}), ({'w': 12, 'h': 9, 'b': 2, 'base': 9, 'level': 0, 'x': 0, 'y': 0}, {'widths': [12, 6, 3, 2], 'heights': [9, 5, 3, 2], 'row_pitches': [26, 14, 8, 6], 'level_sizes': [237, 73, 27, 15], 'directory_size': 8, 'level_offsets': [8, 245, 318, 345], 'selected_size': 237, 'level_origin': 17, 'payload_origin': 20, 'allocation_end': 369}), ({'w': 13, 'h': 10, 'b': 2, 'base': 9, 'level': 1, 'x': 0, 'y': 0}, {'widths': [13, 7, 4, 2], 'heights': [10, 5, 3, 2], 'row_pitches': [28, 16, 10, 6], 'level_sizes': [283, 83, 33, 15], 'directory_size': 8, 'level_offsets': [8, 291, 374, 407], 'selected_size': 83, 'level_origin': 300, 'payload_origin': 303, 'allocation_end': 431})], 2: [({'w': 9, 'h': 5, 'b': 3, 'base': 18, 'level': 0, 'x': 0, 'y': 0}, {'widths': [9, 5, 3, 2], 'heights': [5, 3, 2, 1], 'row_pitches': [29, 17, 11, 8], 'level_sizes': [148, 54, 25, 11], 'directory_size': 8, 'level_offsets': [8, 156, 210, 235], 'selected_size': 148, 'level_origin': 26, 'payload_origin': 29, 'allocation_end': 264}), ({'w': 10, 'h': 6, 'b': 3, 'base': 18, 'level': 1, 'x': 0, 'y': 0}, {'widths': [10, 5, 3, 2], 'heights': [6, 3, 2, 1], 'row_pitches': [32, 17, 11, 8], 'level_sizes': [195, 54, 25, 11], 'directory_size': 8, 'level_offsets': [8, 203, 257, 282], 'selected_size': 54, 'level_origin': 221, 'payload_origin': 224, 'allocation_end': 311}), ({'w': 11, 'h': 7, 'b': 3, 'base': 18, 'level': 2, 'x': 0, 'y': 0}, {'widths': [11, 6, 3, 2], 'heights': [7, 4, 2, 1], 'row_pitches': [35, 20, 11, 8], 'level_sizes': [248, 83, 25, 11], 'directory_size': 8, 'level_offsets': [8, 256, 339, 364], 'selected_size': 25, 'level_origin': 357, 'payload_origin': 360, 'allocation_end': 393}), ({'w': 12, 'h': 8, 'b': 3, 'base': 18, 'level': 3, 'x': 0, 'y': 0}, {'widths': [12, 6, 3, 2], 'heights': [8, 4, 2, 1], 'row_pitches': [38, 20, 11, 8], 'level_sizes': [307, 83, 25, 11], 'directory_size': 8, 'level_offsets': [8, 315, 398, 423], 'selected_size': 11, 'level_origin': 441, 'payload_origin': 444, 'allocation_end': 452}), ({'w': 13, 'h': 9, 'b': 3, 'base': 18, 'level': 0, 'x': 0, 'y': 0}, {'widths': [13, 7, 4, 2], 'heights': [9, 5, 3, 2], 'row_pitches': [41, 23, 14, 8], 'level_sizes': [372, 118, 45, 19], 'directory_size': 8, 'level_offsets': [8, 380, 498, 543], 'selected_size': 372, 'level_origin': 26, 'payload_origin': 29, 'allocation_end': 580}), ({'w': 14, 'h': 10, 'b': 3, 'base': 18, 'level': 1, 'x': 0, 'y': 0}, {'widths': [14, 7, 4, 2], 'heights': [10, 5, 3, 2], 'row_pitches': [44, 23, 14, 8], 'level_sizes': [443, 118, 45, 19], 'directory_size': 8, 'level_offsets': [8, 451, 569, 614], 'selected_size': 118, 'level_origin': 469, 'payload_origin': 472, 'allocation_end': 651})], 3: [({'w': 10, 'h': 5, 'b': 4, 'base': 27, 'level': 0, 'x': 0, 'y': 0}, {'widths': [10, 5, 3, 2], 'heights': [5, 3, 2, 1], 'row_pitches': [42, 22, 14, 10], 'level_sizes': [213, 69, 31, 13], 'directory_size': 8, 'level_offsets': [8, 221, 290, 321], 'selected_size': 213, 'level_origin': 35, 'payload_origin': 38, 'allocation_end': 361}), ({'w': 11, 'h': 6, 'b': 4, 'base': 27, 'level': 1, 'x': 0, 'y': 0}, {'widths': [11, 6, 3, 2], 'heights': [6, 3, 2, 1], 'row_pitches': [46, 26, 14, 10], 'level_sizes': [279, 81, 31, 13], 'directory_size': 8, 'level_offsets': [8, 287, 368, 399], 'selected_size': 81, 'level_origin': 314, 'payload_origin': 317, 'allocation_end': 439}), ({'w': 12, 'h': 7, 'b': 4, 'base': 27, 'level': 2, 'x': 0, 'y': 0}, {'widths': [12, 6, 3, 2], 'heights': [7, 4, 2, 1], 'row_pitches': [50, 26, 14, 10], 'level_sizes': [353, 107, 31, 13], 'directory_size': 8, 'level_offsets': [8, 361, 468, 499], 'selected_size': 31, 'level_origin': 495, 'payload_origin': 498, 'allocation_end': 539}), ({'w': 13, 'h': 8, 'b': 4, 'base': 27, 'level': 3, 'x': 0, 'y': 0}, {'widths': [13, 7, 4, 2], 'heights': [8, 4, 2, 1], 'row_pitches': [54, 30, 18, 10], 'level_sizes': [435, 123, 39, 13], 'directory_size': 8, 'level_offsets': [8, 443, 566, 605], 'selected_size': 13, 'level_origin': 632, 'payload_origin': 635, 'allocation_end': 645}), ({'w': 14, 'h': 9, 'b': 4, 'base': 27, 'level': 0, 'x': 0, 'y': 0}, {'widths': [14, 7, 4, 2], 'heights': [9, 5, 3, 2], 'row_pitches': [58, 30, 18, 10], 'level_sizes': [525, 153, 57, 23], 'directory_size': 8, 'level_offsets': [8, 533, 686, 743], 'selected_size': 525, 'level_origin': 35, 'payload_origin': 38, 'allocation_end': 793}), ({'w': 15, 'h': 10, 'b': 4, 'base': 27, 'level': 1, 'x': 0, 'y': 0}, {'widths': [15, 8, 4, 2], 'heights': [10, 5, 3, 2], 'row_pitches': [62, 34, 18, 10], 'level_sizes': [623, 173, 57, 23], 'directory_size': 8, 'level_offsets': [8, 631, 804, 861], 'selected_size': 173, 'level_origin': 658, 'payload_origin': 661, 'allocation_end': 911})], 4: [({'w': 11, 'h': 5, 'b': 5, 'base': 36, 'level': 0, 'x': 0, 'y': 0}, {'widths': [11, 6, 3, 2], 'heights': [5, 3, 2, 1], 'row_pitches': [57, 32, 17, 12], 'level_sizes': [288, 99, 37, 15], 'directory_size': 8, 'level_offsets': [8, 296, 395, 432], 'selected_size': 288, 'level_origin': 44, 'payload_origin': 47, 'allocation_end': 483}), ({'w': 12, 'h': 6, 'b': 5, 'base': 36, 'level': 1, 'x': 0, 'y': 0}, {'widths': [12, 6, 3, 2], 'heights': [6, 3, 2, 1], 'row_pitches': [62, 32, 17, 12], 'level_sizes': [375, 99, 37, 15], 'directory_size': 8, 'level_offsets': [8, 383, 482, 519], 'selected_size': 99, 'level_origin': 419, 'payload_origin': 422, 'allocation_end': 570}), ({'w': 13, 'h': 7, 'b': 5, 'base': 36, 'level': 2, 'x': 0, 'y': 0}, {'widths': [13, 7, 4, 2], 'heights': [7, 4, 2, 1], 'row_pitches': [67, 37, 22, 12], 'level_sizes': [472, 151, 47, 15], 'directory_size': 8, 'level_offsets': [8, 480, 631, 678], 'selected_size': 47, 'level_origin': 667, 'payload_origin': 670, 'allocation_end': 729}), ({'w': 14, 'h': 8, 'b': 5, 'base': 36, 'level': 3, 'x': 0, 'y': 0}, {'widths': [14, 7, 4, 2], 'heights': [8, 4, 2, 1], 'row_pitches': [72, 37, 22, 12], 'level_sizes': [579, 151, 47, 15], 'directory_size': 8, 'level_offsets': [8, 587, 738, 785], 'selected_size': 15, 'level_origin': 821, 'payload_origin': 824, 'allocation_end': 836}), ({'w': 15, 'h': 9, 'b': 5, 'base': 36, 'level': 0, 'x': 0, 'y': 0}, {'widths': [15, 8, 4, 2], 'heights': [9, 5, 3, 2], 'row_pitches': [77, 42, 22, 12], 'level_sizes': [696, 213, 69, 27], 'directory_size': 8, 'level_offsets': [8, 704, 917, 986], 'selected_size': 696, 'level_origin': 44, 'payload_origin': 47, 'allocation_end': 1049}), ({'w': 16, 'h': 10, 'b': 5, 'base': 36, 'level': 1, 'x': 0, 'y': 0}, {'widths': [16, 8, 4, 2], 'heights': [10, 5, 3, 2], 'row_pitches': [82, 42, 22, 12], 'level_sizes': [823, 213, 69, 27], 'directory_size': 8, 'level_offsets': [8, 831, 1044, 1113], 'selected_size': 213, 'level_origin': 867, 'payload_origin': 870, 'allocation_end': 1176})], 5: [({'w': 12, 'h': 5, 'b': 6, 'base': 45, 'level': 0, 'x': 0, 'y': 0}, {'widths': [12, 6, 3, 2], 'heights': [5, 3, 2, 1], 'row_pitches': [74, 38, 20, 14], 'level_sizes': [373, 117, 43, 17], 'directory_size': 8, 'level_offsets': [8, 381, 498, 541], 'selected_size': 373, 'level_origin': 53, 'payload_origin': 56, 'allocation_end': 603}), ({'w': 13, 'h': 6, 'b': 6, 'base': 45, 'level': 1, 'x': 0, 'y': 0}, {'widths': [13, 7, 4, 2], 'heights': [6, 3, 2, 1], 'row_pitches': [80, 44, 26, 14], 'level_sizes': [483, 135, 55, 17], 'directory_size': 8, 'level_offsets': [8, 491, 626, 681], 'selected_size': 135, 'level_origin': 536, 'payload_origin': 539, 'allocation_end': 743}), ({'w': 14, 'h': 7, 'b': 6, 'base': 45, 'level': 2, 'x': 0, 'y': 0}, {'widths': [14, 7, 4, 2], 'heights': [7, 4, 2, 1], 'row_pitches': [86, 44, 26, 14], 'level_sizes': [605, 179, 55, 17], 'directory_size': 8, 'level_offsets': [8, 613, 792, 847], 'selected_size': 55, 'level_origin': 837, 'payload_origin': 840, 'allocation_end': 909}), ({'w': 15, 'h': 8, 'b': 6, 'base': 45, 'level': 3, 'x': 0, 'y': 0}, {'widths': [15, 8, 4, 2], 'heights': [8, 4, 2, 1], 'row_pitches': [92, 50, 26, 14], 'level_sizes': [739, 203, 55, 17], 'directory_size': 8, 'level_offsets': [8, 747, 950, 1005], 'selected_size': 17, 'level_origin': 1050, 'payload_origin': 1053, 'allocation_end': 1067}), ({'w': 16, 'h': 9, 'b': 6, 'base': 45, 'level': 0, 'x': 0, 'y': 0}, {'widths': [16, 8, 4, 2], 'heights': [9, 5, 3, 2], 'row_pitches': [98, 50, 26, 14], 'level_sizes': [885, 253, 81, 31], 'directory_size': 8, 'level_offsets': [8, 893, 1146, 1227], 'selected_size': 885, 'level_origin': 53, 'payload_origin': 56, 'allocation_end': 1303}), ({'w': 17, 'h': 10, 'b': 6, 'base': 45, 'level': 1, 'x': 0, 'y': 0}, {'widths': [17, 9, 5, 3], 'heights': [10, 5, 3, 2], 'row_pitches': [104, 56, 32, 20], 'level_sizes': [1043, 283, 99, 43], 'directory_size': 8, 'level_offsets': [8, 1051, 1334, 1433], 'selected_size': 283, 'level_origin': 1096, 'payload_origin': 1099, 'allocation_end': 1521})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
layout fixture 1{'allocation_end': 165, 'directory_size': 8, 'heights': [5, 3, 2, 1], 'level_offsets': [8, 101, 134, 149], 'level_origin': 17, 'level_sizes': [93, 33, 15, 7], 'payload_origin': 20, 'row_pitches': [18, 10, 6, 4], 'selected_size': 93, 'widths': [8, 4, 2, 1]}{'allocation_end': 165, 'directory_size': 8, 'heights': [5, 3, 2, 1], 'level_offsets': [8, 101, 134, 149], 'level_origin': 17, 'level_sizes': [93, 33, 15, 7], 'payload_origin': 20, 'row_pitches': [18, 10, 6, 4], 'selected_size': 93, 'widths': [8, 4, 2, 1]}Passed
layout fixture 2{'allocation_end': 207, 'directory_size': 8, 'heights': [6, 3, 2, 1], 'level_offsets': [8, 131, 170, 189], 'level_origin': 140, 'level_sizes': [123, 39, 19, 9], 'payload_origin': 143, 'row_pitches': [20, 12, 8, 6], 'selected_size': 123, 'widths': [9, 5, 3, 2]}{'allocation_end': 207, 'directory_size': 8, 'heights': [6, 3, 2, 1], 'level_offsets': [8, 131, 170, 189], 'level_origin': 140, 'level_sizes': [123, 39, 19, 9], 'payload_origin': 143, 'row_pitches': [20, 12, 8, 6], 'selected_size': 39, 'widths': [9, 5, 3, 2]}Failed
layout fixture 3{'allocation_end': 253, 'directory_size': 8, 'heights': [7, 4, 2, 1], 'level_offsets': [8, 165, 216, 235], 'level_origin': 225, 'level_sizes': [157, 51, 19, 9], 'payload_origin': 228, 'row_pitches': [22, 12, 8, 6], 'selected_size': 157, 'widths': [10, 5, 3, 2]}{'allocation_end': 253, 'directory_size': 8, 'heights': [7, 4, 2, 1], 'level_offsets': [8, 165, 216, 235], 'level_origin': 225, 'level_sizes': [157, 51, 19, 9], 'payload_origin': 228, 'row_pitches': [22, 12, 8, 6], 'selected_size': 19, 'widths': [10, 5, 3, 2]}Failed
layout fixture 4{'allocation_end': 299, 'directory_size': 8, 'heights': [8, 4, 2, 1], 'level_offsets': [8, 203, 262, 281], 'level_origin': 290, 'level_sizes': [195, 59, 19, 9], 'payload_origin': 293, 'row_pitches': [24, 14, 8, 6], 'selected_size': 195, 'widths': [11, 6, 3, 2]}{'allocation_end': 299, 'directory_size': 8, 'heights': [8, 4, 2, 1], 'level_offsets': [8, 203, 262, 281], 'level_origin': 290, 'level_sizes': [195, 59, 19, 9], 'payload_origin': 293, 'row_pitches': [24, 14, 8, 6], 'selected_size': 9, 'widths': [11, 6, 3, 2]}Failed
layout fixture 5{'allocation_end': 369, 'directory_size': 8, 'heights': [9, 5, 3, 2], 'level_offsets': [8, 245, 318, 345], 'level_origin': 17, 'level_sizes': [237, 73, 27, 15], 'payload_origin': 20, 'row_pitches': [26, 14, 8, 6], 'selected_size': 237, 'widths': [12, 6, 3, 2]}{'allocation_end': 369, 'directory_size': 8, 'heights': [9, 5, 3, 2], 'level_offsets': [8, 245, 318, 345], 'level_origin': 17, 'level_sizes': [237, 73, 27, 15], 'payload_origin': 20, 'row_pitches': [26, 14, 8, 6], 'selected_size': 237, 'widths': [12, 6, 3, 2]}Passed
layout fixture 6{'allocation_end': 431, 'directory_size': 8, 'heights': [10, 5, 3, 2], 'level_offsets': [8, 291, 374, 407], 'level_origin': 300, 'level_sizes': [283, 83, 33, 15], 'payload_origin': 303, 'row_pitches': [28, 16, 10, 6], 'selected_size': 283, 'widths': [13, 7, 4, 2]}{'allocation_end': 431, 'directory_size': 8, 'heights': [10, 5, 3, 2], 'level_offsets': [8, 291, 374, 407], 'level_origin': 300, 'level_sizes': [283, 83, 33, 15], 'payload_origin': 303, 'row_pitches': [28, 16, 10, 6], 'selected_size': 83, 'widths': [13, 7, 4, 2]}Failed

SHA-256 / 96d934d6a6ee3e18629b0478cb98e0bdfe69ea85b67026db62ff62f15f077acb

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    widths = [max(1,(p["w"]+(1<<i)-1)//(1<<i)) for i in range(4)]
    heights = [max(1,(p["h"]+(1<<i)-1)//(1<<i)) for i in range(4)]
    row_pitches = [w*p["b"]+2 for w in widths]
    level_sizes = [row_pitches[i]*heights[i]+3 for i in range(4)]
    directory_size = 4*2
    level_offsets = [directory_size+sum(level_sizes[:i]) for i in range(4)]
    selected_size = level_sizes[-1]
    level_origin = p["base"]+level_offsets[p["level"]]
    payload_origin = level_origin+3
    allocation_end = p["base"]+directory_size+sum(level_sizes)
    return {'widths': widths, 'heights': heights, 'row_pitches': row_pitches, 'level_sizes': level_sizes, 'directory_size': directory_size, 'level_offsets': level_offsets, 'selected_size': selected_size, 'level_origin': level_origin, 'payload_origin': payload_origin, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 8, 'h': 5, 'b': 2, 'base': 9, 'level': 0, 'x': 0, 'y': 0}, {'widths': [8, 4, 2, 1], 'heights': [5, 3, 2, 1], 'row_pitches': [18, 10, 6, 4], 'level_sizes': [93, 33, 15, 7], 'directory_size': 8, 'level_offsets': [8, 101, 134, 149], 'selected_size': 93, 'level_origin': 17, 'payload_origin': 20, 'allocation_end': 165}), ({'w': 9, 'h': 6, 'b': 2, 'base': 9, 'level': 1, 'x': 0, 'y': 0}, {'widths': [9, 5, 3, 2], 'heights': [6, 3, 2, 1], 'row_pitches': [20, 12, 8, 6], 'level_sizes': [123, 39, 19, 9], 'directory_size': 8, 'level_offsets': [8, 131, 170, 189], 'selected_size': 39, 'level_origin': 140, 'payload_origin': 143, 'allocation_end': 207}), ({'w': 10, 'h': 7, 'b': 2, 'base': 9, 'level': 2, 'x': 0, 'y': 0}, {'widths': [10, 5, 3, 2], 'heights': [7, 4, 2, 1], 'row_pitches': [22, 12, 8, 6], 'level_sizes': [157, 51, 19, 9], 'directory_size': 8, 'level_offsets': [8, 165, 216, 235], 'selected_size': 19, 'level_origin': 225, 'payload_origin': 228, 'allocation_end': 253}), ({'w': 11, 'h': 8, 'b': 2, 'base': 9, 'level': 3, 'x': 0, 'y': 0}, {'widths': [11, 6, 3, 2], 'heights': [8, 4, 2, 1], 'row_pitches': [24, 14, 8, 6], 'level_sizes': [195, 59, 19, 9], 'directory_size': 8, 'level_offsets': [8, 203, 262, 281], 'selected_size': 9, 'level_origin': 290, 'payload_origin': 293, 'allocation_end': 299}), ({'w': 12, 'h': 9, 'b': 2, 'base': 9, 'level': 0, 'x': 0, 'y': 0}, {'widths': [12, 6, 3, 2], 'heights': [9, 5, 3, 2], 'row_pitches': [26, 14, 8, 6], 'level_sizes': [237, 73, 27, 15], 'directory_size': 8, 'level_offsets': [8, 245, 318, 345], 'selected_size': 237, 'level_origin': 17, 'payload_origin': 20, 'allocation_end': 369}), ({'w': 13, 'h': 10, 'b': 2, 'base': 9, 'level': 1, 'x': 0, 'y': 0}, {'widths': [13, 7, 4, 2], 'heights': [10, 5, 3, 2], 'row_pitches': [28, 16, 10, 6], 'level_sizes': [283, 83, 33, 15], 'directory_size': 8, 'level_offsets': [8, 291, 374, 407], 'selected_size': 83, 'level_origin': 300, 'payload_origin': 303, 'allocation_end': 431})], 2: [({'w': 9, 'h': 5, 'b': 3, 'base': 18, 'level': 0, 'x': 0, 'y': 0}, {'widths': [9, 5, 3, 2], 'heights': [5, 3, 2, 1], 'row_pitches': [29, 17, 11, 8], 'level_sizes': [148, 54, 25, 11], 'directory_size': 8, 'level_offsets': [8, 156, 210, 235], 'selected_size': 148, 'level_origin': 26, 'payload_origin': 29, 'allocation_end': 264}), ({'w': 10, 'h': 6, 'b': 3, 'base': 18, 'level': 1, 'x': 0, 'y': 0}, {'widths': [10, 5, 3, 2], 'heights': [6, 3, 2, 1], 'row_pitches': [32, 17, 11, 8], 'level_sizes': [195, 54, 25, 11], 'directory_size': 8, 'level_offsets': [8, 203, 257, 282], 'selected_size': 54, 'level_origin': 221, 'payload_origin': 224, 'allocation_end': 311}), ({'w': 11, 'h': 7, 'b': 3, 'base': 18, 'level': 2, 'x': 0, 'y': 0}, {'widths': [11, 6, 3, 2], 'heights': [7, 4, 2, 1], 'row_pitches': [35, 20, 11, 8], 'level_sizes': [248, 83, 25, 11], 'directory_size': 8, 'level_offsets': [8, 256, 339, 364], 'selected_size': 25, 'level_origin': 357, 'payload_origin': 360, 'allocation_end': 393}), ({'w': 12, 'h': 8, 'b': 3, 'base': 18, 'level': 3, 'x': 0, 'y': 0}, {'widths': [12, 6, 3, 2], 'heights': [8, 4, 2, 1], 'row_pitches': [38, 20, 11, 8], 'level_sizes': [307, 83, 25, 11], 'directory_size': 8, 'level_offsets': [8, 315, 398, 423], 'selected_size': 11, 'level_origin': 441, 'payload_origin': 444, 'allocation_end': 452}), ({'w': 13, 'h': 9, 'b': 3, 'base': 18, 'level': 0, 'x': 0, 'y': 0}, {'widths': [13, 7, 4, 2], 'heights': [9, 5, 3, 2], 'row_pitches': [41, 23, 14, 8], 'level_sizes': [372, 118, 45, 19], 'directory_size': 8, 'level_offsets': [8, 380, 498, 543], 'selected_size': 372, 'level_origin': 26, 'payload_origin': 29, 'allocation_end': 580}), ({'w': 14, 'h': 10, 'b': 3, 'base': 18, 'level': 1, 'x': 0, 'y': 0}, {'widths': [14, 7, 4, 2], 'heights': [10, 5, 3, 2], 'row_pitches': [44, 23, 14, 8], 'level_sizes': [443, 118, 45, 19], 'directory_size': 8, 'level_offsets': [8, 451, 569, 614], 'selected_size': 118, 'level_origin': 469, 'payload_origin': 472, 'allocation_end': 651})], 3: [({'w': 10, 'h': 5, 'b': 4, 'base': 27, 'level': 0, 'x': 0, 'y': 0}, {'widths': [10, 5, 3, 2], 'heights': [5, 3, 2, 1], 'row_pitches': [42, 22, 14, 10], 'level_sizes': [213, 69, 31, 13], 'directory_size': 8, 'level_offsets': [8, 221, 290, 321], 'selected_size': 213, 'level_origin': 35, 'payload_origin': 38, 'allocation_end': 361}), ({'w': 11, 'h': 6, 'b': 4, 'base': 27, 'level': 1, 'x': 0, 'y': 0}, {'widths': [11, 6, 3, 2], 'heights': [6, 3, 2, 1], 'row_pitches': [46, 26, 14, 10], 'level_sizes': [279, 81, 31, 13], 'directory_size': 8, 'level_offsets': [8, 287, 368, 399], 'selected_size': 81, 'level_origin': 314, 'payload_origin': 317, 'allocation_end': 439}), ({'w': 12, 'h': 7, 'b': 4, 'base': 27, 'level': 2, 'x': 0, 'y': 0}, {'widths': [12, 6, 3, 2], 'heights': [7, 4, 2, 1], 'row_pitches': [50, 26, 14, 10], 'level_sizes': [353, 107, 31, 13], 'directory_size': 8, 'level_offsets': [8, 361, 468, 499], 'selected_size': 31, 'level_origin': 495, 'payload_origin': 498, 'allocation_end': 539}), ({'w': 13, 'h': 8, 'b': 4, 'base': 27, 'level': 3, 'x': 0, 'y': 0}, {'widths': [13, 7, 4, 2], 'heights': [8, 4, 2, 1], 'row_pitches': [54, 30, 18, 10], 'level_sizes': [435, 123, 39, 13], 'directory_size': 8, 'level_offsets': [8, 443, 566, 605], 'selected_size': 13, 'level_origin': 632, 'payload_origin': 635, 'allocation_end': 645}), ({'w': 14, 'h': 9, 'b': 4, 'base': 27, 'level': 0, 'x': 0, 'y': 0}, {'widths': [14, 7, 4, 2], 'heights': [9, 5, 3, 2], 'row_pitches': [58, 30, 18, 10], 'level_sizes': [525, 153, 57, 23], 'directory_size': 8, 'level_offsets': [8, 533, 686, 743], 'selected_size': 525, 'level_origin': 35, 'payload_origin': 38, 'allocation_end': 793}), ({'w': 15, 'h': 10, 'b': 4, 'base': 27, 'level': 1, 'x': 0, 'y': 0}, {'widths': [15, 8, 4, 2], 'heights': [10, 5, 3, 2], 'row_pitches': [62, 34, 18, 10], 'level_sizes': [623, 173, 57, 23], 'directory_size': 8, 'level_offsets': [8, 631, 804, 861], 'selected_size': 173, 'level_origin': 658, 'payload_origin': 661, 'allocation_end': 911})], 4: [({'w': 11, 'h': 5, 'b': 5, 'base': 36, 'level': 0, 'x': 0, 'y': 0}, {'widths': [11, 6, 3, 2], 'heights': [5, 3, 2, 1], 'row_pitches': [57, 32, 17, 12], 'level_sizes': [288, 99, 37, 15], 'directory_size': 8, 'level_offsets': [8, 296, 395, 432], 'selected_size': 288, 'level_origin': 44, 'payload_origin': 47, 'allocation_end': 483}), ({'w': 12, 'h': 6, 'b': 5, 'base': 36, 'level': 1, 'x': 0, 'y': 0}, {'widths': [12, 6, 3, 2], 'heights': [6, 3, 2, 1], 'row_pitches': [62, 32, 17, 12], 'level_sizes': [375, 99, 37, 15], 'directory_size': 8, 'level_offsets': [8, 383, 482, 519], 'selected_size': 99, 'level_origin': 419, 'payload_origin': 422, 'allocation_end': 570}), ({'w': 13, 'h': 7, 'b': 5, 'base': 36, 'level': 2, 'x': 0, 'y': 0}, {'widths': [13, 7, 4, 2], 'heights': [7, 4, 2, 1], 'row_pitches': [67, 37, 22, 12], 'level_sizes': [472, 151, 47, 15], 'directory_size': 8, 'level_offsets': [8, 480, 631, 678], 'selected_size': 47, 'level_origin': 667, 'payload_origin': 670, 'allocation_end': 729}), ({'w': 14, 'h': 8, 'b': 5, 'base': 36, 'level': 3, 'x': 0, 'y': 0}, {'widths': [14, 7, 4, 2], 'heights': [8, 4, 2, 1], 'row_pitches': [72, 37, 22, 12], 'level_sizes': [579, 151, 47, 15], 'directory_size': 8, 'level_offsets': [8, 587, 738, 785], 'selected_size': 15, 'level_origin': 821, 'payload_origin': 824, 'allocation_end': 836}), ({'w': 15, 'h': 9, 'b': 5, 'base': 36, 'level': 0, 'x': 0, 'y': 0}, {'widths': [15, 8, 4, 2], 'heights': [9, 5, 3, 2], 'row_pitches': [77, 42, 22, 12], 'level_sizes': [696, 213, 69, 27], 'directory_size': 8, 'level_offsets': [8, 704, 917, 986], 'selected_size': 696, 'level_origin': 44, 'payload_origin': 47, 'allocation_end': 1049}), ({'w': 16, 'h': 10, 'b': 5, 'base': 36, 'level': 1, 'x': 0, 'y': 0}, {'widths': [16, 8, 4, 2], 'heights': [10, 5, 3, 2], 'row_pitches': [82, 42, 22, 12], 'level_sizes': [823, 213, 69, 27], 'directory_size': 8, 'level_offsets': [8, 831, 1044, 1113], 'selected_size': 213, 'level_origin': 867, 'payload_origin': 870, 'allocation_end': 1176})], 5: [({'w': 12, 'h': 5, 'b': 6, 'base': 45, 'level': 0, 'x': 0, 'y': 0}, {'widths': [12, 6, 3, 2], 'heights': [5, 3, 2, 1], 'row_pitches': [74, 38, 20, 14], 'level_sizes': [373, 117, 43, 17], 'directory_size': 8, 'level_offsets': [8, 381, 498, 541], 'selected_size': 373, 'level_origin': 53, 'payload_origin': 56, 'allocation_end': 603}), ({'w': 13, 'h': 6, 'b': 6, 'base': 45, 'level': 1, 'x': 0, 'y': 0}, {'widths': [13, 7, 4, 2], 'heights': [6, 3, 2, 1], 'row_pitches': [80, 44, 26, 14], 'level_sizes': [483, 135, 55, 17], 'directory_size': 8, 'level_offsets': [8, 491, 626, 681], 'selected_size': 135, 'level_origin': 536, 'payload_origin': 539, 'allocation_end': 743}), ({'w': 14, 'h': 7, 'b': 6, 'base': 45, 'level': 2, 'x': 0, 'y': 0}, {'widths': [14, 7, 4, 2], 'heights': [7, 4, 2, 1], 'row_pitches': [86, 44, 26, 14], 'level_sizes': [605, 179, 55, 17], 'directory_size': 8, 'level_offsets': [8, 613, 792, 847], 'selected_size': 55, 'level_origin': 837, 'payload_origin': 840, 'allocation_end': 909}), ({'w': 15, 'h': 8, 'b': 6, 'base': 45, 'level': 3, 'x': 0, 'y': 0}, {'widths': [15, 8, 4, 2], 'heights': [8, 4, 2, 1], 'row_pitches': [92, 50, 26, 14], 'level_sizes': [739, 203, 55, 17], 'directory_size': 8, 'level_offsets': [8, 747, 950, 1005], 'selected_size': 17, 'level_origin': 1050, 'payload_origin': 1053, 'allocation_end': 1067}), ({'w': 16, 'h': 9, 'b': 6, 'base': 45, 'level': 0, 'x': 0, 'y': 0}, {'widths': [16, 8, 4, 2], 'heights': [9, 5, 3, 2], 'row_pitches': [98, 50, 26, 14], 'level_sizes': [885, 253, 81, 31], 'directory_size': 8, 'level_offsets': [8, 893, 1146, 1227], 'selected_size': 885, 'level_origin': 53, 'payload_origin': 56, 'allocation_end': 1303}), ({'w': 17, 'h': 10, 'b': 6, 'base': 45, 'level': 1, 'x': 0, 'y': 0}, {'widths': [17, 9, 5, 3], 'heights': [10, 5, 3, 2], 'row_pitches': [104, 56, 32, 20], 'level_sizes': [1043, 283, 99, 43], 'directory_size': 8, 'level_offsets': [8, 1051, 1334, 1433], 'selected_size': 283, 'level_origin': 1096, 'payload_origin': 1099, 'allocation_end': 1521})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
layout fixture 1{'allocation_end': 165, 'directory_size': 8, 'heights': [5, 3, 2, 1], 'level_offsets': [8, 101, 134, 149], 'level_origin': 17, 'level_sizes': [93, 33, 15, 7], 'payload_origin': 20, 'row_pitches': [18, 10, 6, 4], 'selected_size': 7, 'widths': [8, 4, 2, 1]}{'allocation_end': 165, 'directory_size': 8, 'heights': [5, 3, 2, 1], 'level_offsets': [8, 101, 134, 149], 'level_origin': 17, 'level_sizes': [93, 33, 15, 7], 'payload_origin': 20, 'row_pitches': [18, 10, 6, 4], 'selected_size': 93, 'widths': [8, 4, 2, 1]}Failed
layout fixture 2{'allocation_end': 207, 'directory_size': 8, 'heights': [6, 3, 2, 1], 'level_offsets': [8, 131, 170, 189], 'level_origin': 140, 'level_sizes': [123, 39, 19, 9], 'payload_origin': 143, 'row_pitches': [20, 12, 8, 6], 'selected_size': 9, 'widths': [9, 5, 3, 2]}{'allocation_end': 207, 'directory_size': 8, 'heights': [6, 3, 2, 1], 'level_offsets': [8, 131, 170, 189], 'level_origin': 140, 'level_sizes': [123, 39, 19, 9], 'payload_origin': 143, 'row_pitches': [20, 12, 8, 6], 'selected_size': 39, 'widths': [9, 5, 3, 2]}Failed
layout fixture 3{'allocation_end': 253, 'directory_size': 8, 'heights': [7, 4, 2, 1], 'level_offsets': [8, 165, 216, 235], 'level_origin': 225, 'level_sizes': [157, 51, 19, 9], 'payload_origin': 228, 'row_pitches': [22, 12, 8, 6], 'selected_size': 9, 'widths': [10, 5, 3, 2]}{'allocation_end': 253, 'directory_size': 8, 'heights': [7, 4, 2, 1], 'level_offsets': [8, 165, 216, 235], 'level_origin': 225, 'level_sizes': [157, 51, 19, 9], 'payload_origin': 228, 'row_pitches': [22, 12, 8, 6], 'selected_size': 19, 'widths': [10, 5, 3, 2]}Failed
layout fixture 4{'allocation_end': 299, 'directory_size': 8, 'heights': [8, 4, 2, 1], 'level_offsets': [8, 203, 262, 281], 'level_origin': 290, 'level_sizes': [195, 59, 19, 9], 'payload_origin': 293, 'row_pitches': [24, 14, 8, 6], 'selected_size': 9, 'widths': [11, 6, 3, 2]}{'allocation_end': 299, 'directory_size': 8, 'heights': [8, 4, 2, 1], 'level_offsets': [8, 203, 262, 281], 'level_origin': 290, 'level_sizes': [195, 59, 19, 9], 'payload_origin': 293, 'row_pitches': [24, 14, 8, 6], 'selected_size': 9, 'widths': [11, 6, 3, 2]}Passed
layout fixture 5{'allocation_end': 369, 'directory_size': 8, 'heights': [9, 5, 3, 2], 'level_offsets': [8, 245, 318, 345], 'level_origin': 17, 'level_sizes': [237, 73, 27, 15], 'payload_origin': 20, 'row_pitches': [26, 14, 8, 6], 'selected_size': 15, 'widths': [12, 6, 3, 2]}{'allocation_end': 369, 'directory_size': 8, 'heights': [9, 5, 3, 2], 'level_offsets': [8, 245, 318, 345], 'level_origin': 17, 'level_sizes': [237, 73, 27, 15], 'payload_origin': 20, 'row_pitches': [26, 14, 8, 6], 'selected_size': 237, 'widths': [12, 6, 3, 2]}Failed
layout fixture 6{'allocation_end': 431, 'directory_size': 8, 'heights': [10, 5, 3, 2], 'level_offsets': [8, 291, 374, 407], 'level_origin': 300, 'level_sizes': [283, 83, 33, 15], 'payload_origin': 303, 'row_pitches': [28, 16, 10, 6], 'selected_size': 15, 'widths': [13, 7, 4, 2]}{'allocation_end': 431, 'directory_size': 8, 'heights': [10, 5, 3, 2], 'level_offsets': [8, 291, 374, 407], 'level_origin': 300, 'level_sizes': [283, 83, 33, 15], 'payload_origin': 303, 'row_pitches': [28, 16, 10, 6], 'selected_size': 83, 'widths': [13, 7, 4, 2]}Failed

SHA-256 / e54b98ec8bce94f4386c77024d328c242c630be48558dabb00baf19ba1d77ee7

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(p):
    p = dict(p)
    widths = [max(1,(p["w"]+(1<<i)-1)//(1<<i)) for i in range(4)]
    heights = [max(1,(p["h"]+(1<<i)-1)//(1<<i)) for i in range(4)]
    row_pitches = [w*p["b"]+2 for w in widths]
    level_sizes = [row_pitches[i]*heights[i]+3 for i in range(4)]
    directory_size = 4*2
    level_offsets = [directory_size+sum(level_sizes[:i]) for i in range(4)]
    selected_size = level_sizes[p["level"]]
    level_origin = p["base"]+level_offsets[p["level"]]
    payload_origin = level_origin+3
    allocation_end = p["base"]+directory_size+sum(level_sizes)
    return {'widths': widths, 'heights': heights, 'row_pitches': row_pitches, 'level_sizes': level_sizes, 'directory_size': directory_size, 'level_offsets': level_offsets, 'selected_size': selected_size, 'level_origin': level_origin, 'payload_origin': payload_origin, 'allocation_end': allocation_end}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 8, 'h': 5, 'b': 2, 'base': 9, 'level': 0, 'x': 0, 'y': 0}, {'widths': [8, 4, 2, 1], 'heights': [5, 3, 2, 1], 'row_pitches': [18, 10, 6, 4], 'level_sizes': [93, 33, 15, 7], 'directory_size': 8, 'level_offsets': [8, 101, 134, 149], 'selected_size': 93, 'level_origin': 17, 'payload_origin': 20, 'allocation_end': 165}), ({'w': 9, 'h': 6, 'b': 2, 'base': 9, 'level': 1, 'x': 0, 'y': 0}, {'widths': [9, 5, 3, 2], 'heights': [6, 3, 2, 1], 'row_pitches': [20, 12, 8, 6], 'level_sizes': [123, 39, 19, 9], 'directory_size': 8, 'level_offsets': [8, 131, 170, 189], 'selected_size': 39, 'level_origin': 140, 'payload_origin': 143, 'allocation_end': 207}), ({'w': 10, 'h': 7, 'b': 2, 'base': 9, 'level': 2, 'x': 0, 'y': 0}, {'widths': [10, 5, 3, 2], 'heights': [7, 4, 2, 1], 'row_pitches': [22, 12, 8, 6], 'level_sizes': [157, 51, 19, 9], 'directory_size': 8, 'level_offsets': [8, 165, 216, 235], 'selected_size': 19, 'level_origin': 225, 'payload_origin': 228, 'allocation_end': 253}), ({'w': 11, 'h': 8, 'b': 2, 'base': 9, 'level': 3, 'x': 0, 'y': 0}, {'widths': [11, 6, 3, 2], 'heights': [8, 4, 2, 1], 'row_pitches': [24, 14, 8, 6], 'level_sizes': [195, 59, 19, 9], 'directory_size': 8, 'level_offsets': [8, 203, 262, 281], 'selected_size': 9, 'level_origin': 290, 'payload_origin': 293, 'allocation_end': 299}), ({'w': 12, 'h': 9, 'b': 2, 'base': 9, 'level': 0, 'x': 0, 'y': 0}, {'widths': [12, 6, 3, 2], 'heights': [9, 5, 3, 2], 'row_pitches': [26, 14, 8, 6], 'level_sizes': [237, 73, 27, 15], 'directory_size': 8, 'level_offsets': [8, 245, 318, 345], 'selected_size': 237, 'level_origin': 17, 'payload_origin': 20, 'allocation_end': 369}), ({'w': 13, 'h': 10, 'b': 2, 'base': 9, 'level': 1, 'x': 0, 'y': 0}, {'widths': [13, 7, 4, 2], 'heights': [10, 5, 3, 2], 'row_pitches': [28, 16, 10, 6], 'level_sizes': [283, 83, 33, 15], 'directory_size': 8, 'level_offsets': [8, 291, 374, 407], 'selected_size': 83, 'level_origin': 300, 'payload_origin': 303, 'allocation_end': 431})], 2: [({'w': 9, 'h': 5, 'b': 3, 'base': 18, 'level': 0, 'x': 0, 'y': 0}, {'widths': [9, 5, 3, 2], 'heights': [5, 3, 2, 1], 'row_pitches': [29, 17, 11, 8], 'level_sizes': [148, 54, 25, 11], 'directory_size': 8, 'level_offsets': [8, 156, 210, 235], 'selected_size': 148, 'level_origin': 26, 'payload_origin': 29, 'allocation_end': 264}), ({'w': 10, 'h': 6, 'b': 3, 'base': 18, 'level': 1, 'x': 0, 'y': 0}, {'widths': [10, 5, 3, 2], 'heights': [6, 3, 2, 1], 'row_pitches': [32, 17, 11, 8], 'level_sizes': [195, 54, 25, 11], 'directory_size': 8, 'level_offsets': [8, 203, 257, 282], 'selected_size': 54, 'level_origin': 221, 'payload_origin': 224, 'allocation_end': 311}), ({'w': 11, 'h': 7, 'b': 3, 'base': 18, 'level': 2, 'x': 0, 'y': 0}, {'widths': [11, 6, 3, 2], 'heights': [7, 4, 2, 1], 'row_pitches': [35, 20, 11, 8], 'level_sizes': [248, 83, 25, 11], 'directory_size': 8, 'level_offsets': [8, 256, 339, 364], 'selected_size': 25, 'level_origin': 357, 'payload_origin': 360, 'allocation_end': 393}), ({'w': 12, 'h': 8, 'b': 3, 'base': 18, 'level': 3, 'x': 0, 'y': 0}, {'widths': [12, 6, 3, 2], 'heights': [8, 4, 2, 1], 'row_pitches': [38, 20, 11, 8], 'level_sizes': [307, 83, 25, 11], 'directory_size': 8, 'level_offsets': [8, 315, 398, 423], 'selected_size': 11, 'level_origin': 441, 'payload_origin': 444, 'allocation_end': 452}), ({'w': 13, 'h': 9, 'b': 3, 'base': 18, 'level': 0, 'x': 0, 'y': 0}, {'widths': [13, 7, 4, 2], 'heights': [9, 5, 3, 2], 'row_pitches': [41, 23, 14, 8], 'level_sizes': [372, 118, 45, 19], 'directory_size': 8, 'level_offsets': [8, 380, 498, 543], 'selected_size': 372, 'level_origin': 26, 'payload_origin': 29, 'allocation_end': 580}), ({'w': 14, 'h': 10, 'b': 3, 'base': 18, 'level': 1, 'x': 0, 'y': 0}, {'widths': [14, 7, 4, 2], 'heights': [10, 5, 3, 2], 'row_pitches': [44, 23, 14, 8], 'level_sizes': [443, 118, 45, 19], 'directory_size': 8, 'level_offsets': [8, 451, 569, 614], 'selected_size': 118, 'level_origin': 469, 'payload_origin': 472, 'allocation_end': 651})], 3: [({'w': 10, 'h': 5, 'b': 4, 'base': 27, 'level': 0, 'x': 0, 'y': 0}, {'widths': [10, 5, 3, 2], 'heights': [5, 3, 2, 1], 'row_pitches': [42, 22, 14, 10], 'level_sizes': [213, 69, 31, 13], 'directory_size': 8, 'level_offsets': [8, 221, 290, 321], 'selected_size': 213, 'level_origin': 35, 'payload_origin': 38, 'allocation_end': 361}), ({'w': 11, 'h': 6, 'b': 4, 'base': 27, 'level': 1, 'x': 0, 'y': 0}, {'widths': [11, 6, 3, 2], 'heights': [6, 3, 2, 1], 'row_pitches': [46, 26, 14, 10], 'level_sizes': [279, 81, 31, 13], 'directory_size': 8, 'level_offsets': [8, 287, 368, 399], 'selected_size': 81, 'level_origin': 314, 'payload_origin': 317, 'allocation_end': 439}), ({'w': 12, 'h': 7, 'b': 4, 'base': 27, 'level': 2, 'x': 0, 'y': 0}, {'widths': [12, 6, 3, 2], 'heights': [7, 4, 2, 1], 'row_pitches': [50, 26, 14, 10], 'level_sizes': [353, 107, 31, 13], 'directory_size': 8, 'level_offsets': [8, 361, 468, 499], 'selected_size': 31, 'level_origin': 495, 'payload_origin': 498, 'allocation_end': 539}), ({'w': 13, 'h': 8, 'b': 4, 'base': 27, 'level': 3, 'x': 0, 'y': 0}, {'widths': [13, 7, 4, 2], 'heights': [8, 4, 2, 1], 'row_pitches': [54, 30, 18, 10], 'level_sizes': [435, 123, 39, 13], 'directory_size': 8, 'level_offsets': [8, 443, 566, 605], 'selected_size': 13, 'level_origin': 632, 'payload_origin': 635, 'allocation_end': 645}), ({'w': 14, 'h': 9, 'b': 4, 'base': 27, 'level': 0, 'x': 0, 'y': 0}, {'widths': [14, 7, 4, 2], 'heights': [9, 5, 3, 2], 'row_pitches': [58, 30, 18, 10], 'level_sizes': [525, 153, 57, 23], 'directory_size': 8, 'level_offsets': [8, 533, 686, 743], 'selected_size': 525, 'level_origin': 35, 'payload_origin': 38, 'allocation_end': 793}), ({'w': 15, 'h': 10, 'b': 4, 'base': 27, 'level': 1, 'x': 0, 'y': 0}, {'widths': [15, 8, 4, 2], 'heights': [10, 5, 3, 2], 'row_pitches': [62, 34, 18, 10], 'level_sizes': [623, 173, 57, 23], 'directory_size': 8, 'level_offsets': [8, 631, 804, 861], 'selected_size': 173, 'level_origin': 658, 'payload_origin': 661, 'allocation_end': 911})], 4: [({'w': 11, 'h': 5, 'b': 5, 'base': 36, 'level': 0, 'x': 0, 'y': 0}, {'widths': [11, 6, 3, 2], 'heights': [5, 3, 2, 1], 'row_pitches': [57, 32, 17, 12], 'level_sizes': [288, 99, 37, 15], 'directory_size': 8, 'level_offsets': [8, 296, 395, 432], 'selected_size': 288, 'level_origin': 44, 'payload_origin': 47, 'allocation_end': 483}), ({'w': 12, 'h': 6, 'b': 5, 'base': 36, 'level': 1, 'x': 0, 'y': 0}, {'widths': [12, 6, 3, 2], 'heights': [6, 3, 2, 1], 'row_pitches': [62, 32, 17, 12], 'level_sizes': [375, 99, 37, 15], 'directory_size': 8, 'level_offsets': [8, 383, 482, 519], 'selected_size': 99, 'level_origin': 419, 'payload_origin': 422, 'allocation_end': 570}), ({'w': 13, 'h': 7, 'b': 5, 'base': 36, 'level': 2, 'x': 0, 'y': 0}, {'widths': [13, 7, 4, 2], 'heights': [7, 4, 2, 1], 'row_pitches': [67, 37, 22, 12], 'level_sizes': [472, 151, 47, 15], 'directory_size': 8, 'level_offsets': [8, 480, 631, 678], 'selected_size': 47, 'level_origin': 667, 'payload_origin': 670, 'allocation_end': 729}), ({'w': 14, 'h': 8, 'b': 5, 'base': 36, 'level': 3, 'x': 0, 'y': 0}, {'widths': [14, 7, 4, 2], 'heights': [8, 4, 2, 1], 'row_pitches': [72, 37, 22, 12], 'level_sizes': [579, 151, 47, 15], 'directory_size': 8, 'level_offsets': [8, 587, 738, 785], 'selected_size': 15, 'level_origin': 821, 'payload_origin': 824, 'allocation_end': 836}), ({'w': 15, 'h': 9, 'b': 5, 'base': 36, 'level': 0, 'x': 0, 'y': 0}, {'widths': [15, 8, 4, 2], 'heights': [9, 5, 3, 2], 'row_pitches': [77, 42, 22, 12], 'level_sizes': [696, 213, 69, 27], 'directory_size': 8, 'level_offsets': [8, 704, 917, 986], 'selected_size': 696, 'level_origin': 44, 'payload_origin': 47, 'allocation_end': 1049}), ({'w': 16, 'h': 10, 'b': 5, 'base': 36, 'level': 1, 'x': 0, 'y': 0}, {'widths': [16, 8, 4, 2], 'heights': [10, 5, 3, 2], 'row_pitches': [82, 42, 22, 12], 'level_sizes': [823, 213, 69, 27], 'directory_size': 8, 'level_offsets': [8, 831, 1044, 1113], 'selected_size': 213, 'level_origin': 867, 'payload_origin': 870, 'allocation_end': 1176})], 5: [({'w': 12, 'h': 5, 'b': 6, 'base': 45, 'level': 0, 'x': 0, 'y': 0}, {'widths': [12, 6, 3, 2], 'heights': [5, 3, 2, 1], 'row_pitches': [74, 38, 20, 14], 'level_sizes': [373, 117, 43, 17], 'directory_size': 8, 'level_offsets': [8, 381, 498, 541], 'selected_size': 373, 'level_origin': 53, 'payload_origin': 56, 'allocation_end': 603}), ({'w': 13, 'h': 6, 'b': 6, 'base': 45, 'level': 1, 'x': 0, 'y': 0}, {'widths': [13, 7, 4, 2], 'heights': [6, 3, 2, 1], 'row_pitches': [80, 44, 26, 14], 'level_sizes': [483, 135, 55, 17], 'directory_size': 8, 'level_offsets': [8, 491, 626, 681], 'selected_size': 135, 'level_origin': 536, 'payload_origin': 539, 'allocation_end': 743}), ({'w': 14, 'h': 7, 'b': 6, 'base': 45, 'level': 2, 'x': 0, 'y': 0}, {'widths': [14, 7, 4, 2], 'heights': [7, 4, 2, 1], 'row_pitches': [86, 44, 26, 14], 'level_sizes': [605, 179, 55, 17], 'directory_size': 8, 'level_offsets': [8, 613, 792, 847], 'selected_size': 55, 'level_origin': 837, 'payload_origin': 840, 'allocation_end': 909}), ({'w': 15, 'h': 8, 'b': 6, 'base': 45, 'level': 3, 'x': 0, 'y': 0}, {'widths': [15, 8, 4, 2], 'heights': [8, 4, 2, 1], 'row_pitches': [92, 50, 26, 14], 'level_sizes': [739, 203, 55, 17], 'directory_size': 8, 'level_offsets': [8, 747, 950, 1005], 'selected_size': 17, 'level_origin': 1050, 'payload_origin': 1053, 'allocation_end': 1067}), ({'w': 16, 'h': 9, 'b': 6, 'base': 45, 'level': 0, 'x': 0, 'y': 0}, {'widths': [16, 8, 4, 2], 'heights': [9, 5, 3, 2], 'row_pitches': [98, 50, 26, 14], 'level_sizes': [885, 253, 81, 31], 'directory_size': 8, 'level_offsets': [8, 893, 1146, 1227], 'selected_size': 885, 'level_origin': 53, 'payload_origin': 56, 'allocation_end': 1303}), ({'w': 17, 'h': 10, 'b': 6, 'base': 45, 'level': 1, 'x': 0, 'y': 0}, {'widths': [17, 9, 5, 3], 'heights': [10, 5, 3, 2], 'row_pitches': [104, 56, 32, 20], 'level_sizes': [1043, 283, 99, 43], 'directory_size': 8, 'level_offsets': [8, 1051, 1334, 1433], 'selected_size': 283, 'level_origin': 1096, 'payload_origin': 1099, 'allocation_end': 1521})]}
for i, (p, expected) in enumerate(cases[N]):
    check("layout fixture " + str(i + 1), solve(p), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
layout fixture 1{'allocation_end': 165, 'directory_size': 8, 'heights': [5, 3, 2, 1], 'level_offsets': [8, 101, 134, 149], 'level_origin': 17, 'level_sizes': [93, 33, 15, 7], 'payload_origin': 20, 'row_pitches': [18, 10, 6, 4], 'selected_size': 93, 'widths': [8, 4, 2, 1]}{'allocation_end': 165, 'directory_size': 8, 'heights': [5, 3, 2, 1], 'level_offsets': [8, 101, 134, 149], 'level_origin': 17, 'level_sizes': [93, 33, 15, 7], 'payload_origin': 20, 'row_pitches': [18, 10, 6, 4], 'selected_size': 93, 'widths': [8, 4, 2, 1]}Passed
layout fixture 2{'allocation_end': 207, 'directory_size': 8, 'heights': [6, 3, 2, 1], 'level_offsets': [8, 131, 170, 189], 'level_origin': 140, 'level_sizes': [123, 39, 19, 9], 'payload_origin': 143, 'row_pitches': [20, 12, 8, 6], 'selected_size': 39, 'widths': [9, 5, 3, 2]}{'allocation_end': 207, 'directory_size': 8, 'heights': [6, 3, 2, 1], 'level_offsets': [8, 131, 170, 189], 'level_origin': 140, 'level_sizes': [123, 39, 19, 9], 'payload_origin': 143, 'row_pitches': [20, 12, 8, 6], 'selected_size': 39, 'widths': [9, 5, 3, 2]}Passed
layout fixture 3{'allocation_end': 253, 'directory_size': 8, 'heights': [7, 4, 2, 1], 'level_offsets': [8, 165, 216, 235], 'level_origin': 225, 'level_sizes': [157, 51, 19, 9], 'payload_origin': 228, 'row_pitches': [22, 12, 8, 6], 'selected_size': 19, 'widths': [10, 5, 3, 2]}{'allocation_end': 253, 'directory_size': 8, 'heights': [7, 4, 2, 1], 'level_offsets': [8, 165, 216, 235], 'level_origin': 225, 'level_sizes': [157, 51, 19, 9], 'payload_origin': 228, 'row_pitches': [22, 12, 8, 6], 'selected_size': 19, 'widths': [10, 5, 3, 2]}Passed
layout fixture 4{'allocation_end': 299, 'directory_size': 8, 'heights': [8, 4, 2, 1], 'level_offsets': [8, 203, 262, 281], 'level_origin': 290, 'level_sizes': [195, 59, 19, 9], 'payload_origin': 293, 'row_pitches': [24, 14, 8, 6], 'selected_size': 9, 'widths': [11, 6, 3, 2]}{'allocation_end': 299, 'directory_size': 8, 'heights': [8, 4, 2, 1], 'level_offsets': [8, 203, 262, 281], 'level_origin': 290, 'level_sizes': [195, 59, 19, 9], 'payload_origin': 293, 'row_pitches': [24, 14, 8, 6], 'selected_size': 9, 'widths': [11, 6, 3, 2]}Passed
layout fixture 5{'allocation_end': 369, 'directory_size': 8, 'heights': [9, 5, 3, 2], 'level_offsets': [8, 245, 318, 345], 'level_origin': 17, 'level_sizes': [237, 73, 27, 15], 'payload_origin': 20, 'row_pitches': [26, 14, 8, 6], 'selected_size': 237, 'widths': [12, 6, 3, 2]}{'allocation_end': 369, 'directory_size': 8, 'heights': [9, 5, 3, 2], 'level_offsets': [8, 245, 318, 345], 'level_origin': 17, 'level_sizes': [237, 73, 27, 15], 'payload_origin': 20, 'row_pitches': [26, 14, 8, 6], 'selected_size': 237, 'widths': [12, 6, 3, 2]}Passed
layout fixture 6{'allocation_end': 431, 'directory_size': 8, 'heights': [10, 5, 3, 2], 'level_offsets': [8, 291, 374, 407], 'level_origin': 300, 'level_sizes': [283, 83, 33, 15], 'payload_origin': 303, 'row_pitches': [28, 16, 10, 6], 'selected_size': 83, 'widths': [13, 7, 4, 2]}{'allocation_end': 431, 'directory_size': 8, 'heights': [10, 5, 3, 2], 'level_offsets': [8, 291, 374, 407], 'level_origin': 300, 'level_sizes': [283, 83, 33, 15], 'payload_origin': 303, 'row_pitches': [28, 16, 10, 6], 'selected_size': 83, 'widths': [13, 7, 4, 2]}Passed

SHA-256 / 64f44750ae29ff50098cea127e9bb5cd57d81e6436eb0f1dbddc2ed3970c2177

Verification & scope

Stipulated deterministic toy buffer layout; not a graphics API, codec, GPU vendor tiling specification, or hardware-conformance claim. Inputs satisfy the dimensions and bounds stated by the model. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:45:25.299842+00:00.

Case digest / ee33d7b76b6d6afc82a999ccdbb4da4d2e0e3d70d28cd11b109613f4298a9062