Skip to content
DeepForgeby svx
All problems
HardDeep Learningdl-319

Software Pipeline Depth

Problem

Choose the software pipeline depth that fits both register and shared-memory budgets: min(max_stages, registers_per_thread // regs_per_stage, smem_bytes // stage_smem_bytes), clamped to at least 1.

The signature is software_pipeline_depth(registers_per_thread, regs_per_stage, max_stages, smem_bytes, stage_smem_bytes). Return an integer.

Hint

Deeper pipelines hide more global-memory latency but consume registers and shared memory.

Test cases

case 1
in: [255,64,4,100000,8192]
expected: 3
case 2
in: [128,64,8,100000,8192]
expected: 2
case 3
in: [64,64,4,1000,10000]
expected: 1
case 4
in: [512,32,6,65536,8192]
expected: 6
Starter codePython
def software_pipeline_depth(registers_per_thread, regs_per_stage, max_stages, smem_bytes, stage_smem_bytes):
    # Your code here
    pass

4 test cases · run your code against them in the editor