bugger.
All challenges/Pythonmediumdistributed-tile-mask-v1
THE INVESTIGATION

Mask the final GPU tile

Compute valid tile indices and masks for a tiled GPU kernel.

LLM ArchitectureML systems

What’s going wrong

Original LLM Architecture lab. Implement solve(data) using the Python standard library.

Given nonnegative length, positive block_size and nonnegative program_id, return an object with indices and mask lists of length block_size. Index i is program_id * block_size + i; mask is true exactly when the index is smaller than length. This models bounds checks, not GPU execution.

Expected behavior

Compute valid tile indices and masks for a tiled GPU kernel.

Reproduction

01 Case 1
{"length": 6, "block_size": 4, "program_id": 1}
{"indices": [4, 5, 6, 7], "mask": [true, true, false, false]}
02 Case 2
{"length": 4, "block_size": 2, "program_id": 0}
{"indices": [0, 1], "mask": [true, true]}
03 Case 3
{"length": 0, "block_size": 2, "program_id": 0}
{"indices": [0, 1], "mask": [false, false]}

Before you begin

  • Python lists and dictionaries

Need a nudge?

Reveal one investigation hint at a time. Try each clue before opening the next.

    The bug is intentional. Run the starter code to see it fail, then work toward a fix. Difficulty is provisional.
    Read-only preview
    Ready when you are
    Every fix starts with a failing test.

    Read the report, then sign in to start your investigation.