Layered offset-min-sum decoding of a punctured QC-LDPC code
/app/cpu/main.cpp is a multicore CPU program (C++17, OpenMP). It is built as
/app/bin/cpu_baseline with g++ -O3 -march=native -fopenmp -std=c++17 and run as
cpu_baseline INPUT_FILE
It reads one input file and writes its result to stdout.
What the program computes
Layered offset-min-sum decoding of a quasi-cyclic LDPC code for a batch of noisy frames, with early termination. The CPU source is the specification; this is a summary.
- Code. A base matrix of
Mbrow blocks andNbcolumn blocks lifted by circulants of sizez(entry = cyclic shifts: rowrof the row block connects to variable(r + s) mod zof the column block; -1 = zero block). Columns0..Kb-1(Kb = Nb - Mb) carry information, the rest have a dual-diagonal (802.11n-like) parity structure with a weight-3 column(1, 0, 1)at rows0, xr, Mb-1. The firstNPinformation columns are punctured; punctured columnjconnects to every row blockrwithr % (NP+1) != j+1; every other information column gets 3 (with probabilityD3PCT%) or 4 row blocks. Rows, shifts andxrcome from a seeded generator, and shifts are redrawn (up to 64 times) while they close a 4-cycle. - Frames. Frame
fhasK = Kb*zrandom information bits (wordw=hkey(seed, 1, f, w),hkey(seed, tag, f, j) = mix64(seed + ((tag << 56) | (f << 24) | j))), encoded by accumulation intoN = Nb*zcode bits. Channel LLR of bitv: 0 if punctured, elseclamp(+-AMP + floor(g * NOISE / 1024), -31, 31)(+AMPfor a 0 bit) withgthe sum of the four low bytes ofhkey(seed, 2, f, v)minus 510. - Decoder. Posteriors
L(start at the channel LLRs, saturate at +-511) and 8-bit check messagesR(start at 0). An iteration visits the row blocks in order; in a row block every rowrtakes its edges in ascending column order:Q = L - R_old, check node onq = clamp(Q, -127, 127):min1, its first edge,min2(second smallest) and the sign product; the new message has magnitude(edge == first ? min2 : min1) - beta - (min1 == min2)clamped to[0, 63]withbeta = BETA + 1in iterations 1 and 2 andBETAafterwards, sign = product of the other edges' signs (q < 0is negative); thenL = clamp(Q + R_new, -511, 511). - Termination. The syndrome of the hard decisions (
L < 0is 1) is checked before the first iteration and after each one; the frame stops at the first zero syndrome. Its iteration count is that iteration number (0 if the channel word is already a codeword), orIMAX + 1if it never converges. Decoded information bits are the hard decisions of the firstKbits.
Input format
NF SEED
Mb Nb z NP D3PCT
IMAX BETA AMP NOISE
Output format
code Mb Mb Nb Nb z z N N K K edges E punctured P
basegraph H
frames NF iterations I unconverged U
frameerrors FE undetected UE biterrors BE
iterhist n_0 n_1 ... n_IMAX n_fail
hash H
frame f iters i errors e hash h (frames 0..min(NF,8)-1)
I is the sum of per-frame iteration counts (capped at IMAX), FE the frames whose decoded
information bits differ from the sent ones (UE of them with a zero syndrome), BE the total
information bit errors. A frame's hash is sum_w mix64(dw_w ^ (w * 0x9E3779B97F4A7C15)) over its
decoded information words; H = sum_f mix64(hash_f + f * 0xD1B54A32D192ED03 + iters_f), all
modulo 2^64.
Hidden inputs
0 <= NF <= 300000,3 <= Mb <= 16,Mb < Nb <= 40,2 <= z <= 384,0 <= NP <= min(2, Nb - Mb),0 <= D3PCT <= 100,1 <= IMAX <= 64,0 <= BETA <= 15,0 <= AMP <= 64,0 <= NOISE <= 1024.- Correctness inputs include
NF = 0, the smallest code (Mb = 3, Nb = 4, z = 2), noiseless channels (0 or 1 iterations), a hopeless channel where every frame fails, the largest code (16 x 40,z = 384), offsets 0 and 15,IMAXof 1 and 64, saturated channel LLRs and random small codes. - The timing input has about 175000 frames of a
12 x 24base graph withz = 256(N = 6144, K = 3072, two punctured columns,IMAX = 12,BETA = 1,AMP = 20) andNOISEin [107, 109]: about 8 iterations per frame on average and 1-5% of frames failing.
Your task
Port this program to CUDA in /app/gpu/main.cu: same command line (PROGRAM INPUT_FILE),
same output on stdout. Then make it as fast as you can on the GPU while keeping the output correct.
The main computation must execute on the GPU. Renaming CPU code to .cu, running a
CPU fallback, or launching a dummy kernel while computing the answer on the CPU does not satisfy this task.
The CPU source is the specification: when this text and the code disagree, the code wins.
How you are scored
- Only
/app/gpu/main.cuis collected. It is compiled withnvcc -O3 -arch=sm_90 -std=c++17 -o port /app/gpu/main.cu; no extra libraries are linked. The CUDA runtime and the header-only libraries that ship with the CUDA toolkit (CUB, Thrust, libcu++) are allowed. - Your source must not contain any of:
system(,popen(,fork(,exec*,dlopen(,getenv(,#include <filesystem>,/tests/,/proc/. The program may read only the input file it is given. - GPU verification uses the backend selected for this run: an H100 attached to the separate verifier, or a remote H100 worker. Hidden inputs use a fresh random seed.
- For public GPU experiments, use
/app/bin/gpu_run [--backend auto|local|remote] [--repeat N] [--quiet] SOURCE.cu INPUT_FILE.... The default usesGPU_RUNNER_URLwhen configured, otherwise a GPU attached to this sandbox. Sandbox GPU access is configured independently from verification; a CPU-only sandbox needs a runner URL. - Correctness: every hidden input (small edge cases plus the timing input) must pass. Your output must be identical to the CPU program's output (trailing whitespace ignored). Any mismatch, crash or timeout gives reward 0.
- GPU execution: a separate, untimed CUPTI check must observe completed GPU kernel activity on the hidden timing input. A CPU-only submission receives reward 0 even if its output is correct.
- Speed: The timing input has about 175000 frames of a 12x24 base graph lifted by z=256 (N=6144, 19712 edges per frame) at a noise level where frames need about 8 iterations on average and 1-5% fail after 12. Your port and our GPU reference are each run on it
once to warm up and then 5 times, interleaved; the time is the wall clock of the whole process
(including CUDA initialisation, input parsing and output). When correct,
reward = min(2, t_reference / t_yours)using the medians. /app/inputs/holds a few public inputs./app/bin/run_public.shcompiles your port with the flags above and compares it against the CPU baseline on each of them.