THE INVESTIGATION
Build a warp ballot mask
Encode active predicate results as a warp-style bitmask.
LLM ArchitectureML systems
What’s going wrong
Original LLM Architecture lab. This CUDA fundamentals exercise is a deterministic Python simulation, not CUDA code or GPU execution. Implement solve(data) using the Python standard library.
Given predicates, a list of at most 32 booleans, and active_count between zero and the list length, return {"mask": integer, "count": integer}. Lane i contributes bit i only if i < active_count and predicates[i] is true. count is the number of contributing lanes. This models a ballot result for the stated active lanes.
Expected behavior
Encode active predicate results as a warp-style bitmask.
Reproduction
01 Case 1
{"predicates": [true, false, true, true], "active_count": 3}{"mask": 5, "count": 2}02 Case 2
{"predicates": [true, false, true], "active_count": 3}{"mask": 5, "count": 2}03 Case 3
{"predicates": [], "active_count": 0}{"mask": 0, "count": 0}Before you begin
- Python lists and loops
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.
Ready when you are
Every fix starts with a failing test.
Read the report, then sign in to start your investigation.