Show HN: Branchless-nccl-router ver.JAX (GPUs cannot rest)

PJHkorea1 pts0 comments

GitHub - PJHkorea/branchless-nccl-router: A Branchless, Zero-Jitter Ingress Router for 32-GPU Distributed Mesh Networks utilizing JAX/XLA and NCCL. ยท GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

PJHkorea

branchless-nccl-router

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>11 Commits<br>11 Commits

LICENSE

LICENSE

README.md

README.md

nccl_ingress_router_jax.py

nccl_ingress_router_jax.py

View all files

Repository files navigation

๐ŸŒŒ branchless-nccl-router (v1.0)

[KR] "๋ถ„์‚ฐ ํ†ต์‹ ๋ง์˜ ๊ทœ์น™์„ ๋‹ค๋ฅธ ๋ฐฉ์‹์œผ๋กœ ์ƒ๊ฐํ•ด ๋ดค์Šต๋‹ˆ๋‹ค. ์ œ์–ด ํ๋ฆ„(Control Flow) ๋ถ„๊ธฐ๋ฅผ ์—†์• ๊ณ , ๋Œ€๊ทœ๋ชจ ํด๋Ÿฌ์Šคํ„ฐ์˜ ์ง‘ํ•ฉ ํ†ต์‹ ๊ณผ ํŒจํ‚ท ์ •ํ™”๋ฅผ ๋‹จ์ผ ์œตํ•ฉ ๊ธฐ๊ณ„์–ด ์ˆ˜์‹ ๋ ˆ์ผ๋กœ ํ•ด๊ฒฐํ•˜๋ ค ํ•ฉ๋‹ˆ๋‹ค. ์ด๊ฒƒ์€ ๊ทธ๊ฒƒ์— ๋Œ€ํ•œ ์•„ํ‚คํ…์ฒ˜ ๋ฐฉํ–ฅ์„ฑ์„ ์ •๋ฆฝํ•˜๊ธฐ ์œ„ํ•œ ๋…์ฐฝ์ ์ธ ์ฒญ์‚ฌ์ง„(Blueprint) ๊ฐœ๋… ์‹ค์ฆ ๋ชจ๋ธ์ž…๋‹ˆ๋‹ค."

[EN] "We re-engineered the principles of distributed networks from the ground up. By obliterating control flow branches, we channel multi-node collective communication and stream auditing through a single, fused hardware-aligned algebraic rail. This project serves as an original blueprint concept designed explicitly to establish and validate this architectural direction."

๐Ÿ›ฐ๏ธ Overview

[KR] ๋ณธ ๋ ˆํฌ์ง€ํ† ๋ฆฌ๋Š” ๋‹ค์ค‘ ๋…ธ๋“œ ๋ถ„์‚ฐ ๊ฐ€์†๊ธฐ ํ™˜๊ฒฝ(Multi-Node Distributed Infrastructure)์˜ ์ž…๊ตฌ ๊ฒฝ๊ณ„๋ฉด(Ingress Gate)์—์„œ ๋ฐœ์ƒํ•˜๋Š” ์ œ์–ด ๋ถ„๊ธฐ๋ฌธ(if/else)์„ ์ œ๊ฑฐํ•˜๊ณ , ๋„คํŠธ์›Œํฌ ๋™๊ธฐํ™” ์ง€ํ„ฐ(Synchronous Jitter) ๋น„์šฉ์„ ๋ฌผ๋ฆฌ์ ์œผ๋กœ 0ns๋กœ ์ˆ˜์ถ• ์‹œํ‚ค๊ธฐ ์œ„ํ•ด ์„ค๊ณ„๋œ ํ•˜๋“œ์›จ์–ด ๋ฐ€์ฐฉํ˜• ๋ถ„์‚ฐ ๋ผ์šฐํ„ฐ ์ปค๋„ ๋ชจ๋“ˆ์ž…๋‹ˆ๋‹ค.

[EN] This repository delivers a hardware-aligned distributed router kernel module, engineered to eliminate runtime control flow branches (if/else) at the ingress boundary of multi-node accelerator clusters, effectively shrinking network synchronous jitter overheads to exactly 0ns .

1. jax.lax.psum๊ณผ ์ œ์–ด๋ฌธ(if)์˜ ๊ฑฐ๋ถ€ (Zero-Jitter Collective Op)

[KR] ๋‹ค์ค‘ ๋…ธ๋“œ ๋ถ„์‚ฐ ํ•™์Šต/์ถ”๋ก  ํ™˜๊ฒฝ์—์„œ ์—”์ง€๋‹ˆ์–ด๋“ค์„ ๊ฐ€์žฅ ๊ดด๋กญํžˆ๋Š” ๋‚œ์ œ๋Š” "ํŠน์ • ๋…ธ๋“œ๊ฐ€ ํŒจํ‚ท์„ ๋‹ค ๋ฐ›์•˜๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ๋ฉˆ์ถฐ ์„œ๋Š” ํ•˜๋“œ์›จ์–ด ๋™๊ธฐํ™” ํŽœ์Šค(Fence Stall) ๋ณ‘๋ชฉ"์ž…๋‹ˆ๋‹ค. ๋ณธ ์ปค๋„์€ ๋„คํŠธ์›Œํฌ ํŒจํ‚ท ์œ ์‹ค ๋ฐ ์˜ค์—ผ ์—ฌ๋ถ€๋ฅผ ํŒ์ •ํ•˜๋Š” if (is_packet_corrupted) ๊ฐ™์€ ์ œ์–ด๋ฌธ์„ ์ œ๊ฑฐํ–ˆ์Šต๋‹ˆ๋‹ค. ๋Œ€์‹  JAX/XLA ๋ฐฑ์—”๋“œ์— ์ƒ์ฃผํ•˜๋Š” NCCL All-Reduce ์ฝ”์–ด ํ”„๋ฆฌ๋ฏธํ‹ฐ๋ธŒ์ธ jax.lax.psum ์—ฐ์‚ฐ ๊ฒฐ๊ณผ๋ฅผ ๋ถˆ๋ฆฐ์ด ์•„๋‹Œ ๋‹จ์ •๋ฐ€๋„ ๋ถ€๋™์†Œ์ˆ˜์  ๋งˆ์Šคํฌ ์ˆ˜์‹ (global_sync_mask == 0.0).astype(target_dtype) ๋‚ด๋ถ€์˜ ํ”ผ์—ฐ์‚ฐ์ž๋กœ ์ง๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค. 32๊ฐœ ๋””๋ฐ”์ด์Šค๋Š” ๋„คํŠธ์›Œํฌ ์ „์†ก ์ƒํƒœ๋‚˜ ์ง€ํ„ฐ ๋ฐœ์ƒ ์—ฌ๋ถ€์™€ ๋ฌด๊ด€ํ•˜๊ฒŒ, ๋ฌผ๋ฆฌ NCCL ๋ง(Ring) ๋ ˆ์ผ ์œ„๋ฅผ ๋™์ผํ•œ ์†๋„๋กœ ์›€์ง์ด๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

[EN] The most critical bottleneck in large-scale distributed scaling is the hardware synchronous fence (Fence Stall), where accelerators halt execution waiting for straggler nodes to complete packet tracking. This kernel eradicates runtime control flow branches like if (is_packet_corrupted). Instead, it directly channels the output of jax.lax.psumโ€”the underlying core primitive for NCCL All-Reduceโ€”as a hardware arithmetic operand using the float-mask equation (global_sync_mask == 0.0).astype(target_dtype). Consequently, all 32 distributed devices stream through the physical NCCL Ring topology at a perfectly uniform velocity, thoroughly decoupled from dynamic network fluctuations or transport jitters.

# Eradicate control branches and stream directly into the algebraic mask circuit<br>global_sync_mask = jax.lax.psum(is_packet_corrupted, axis_name=cluster_axis_name)<br>is_mesh_clean = (global_sync_mask == literal_zero).astype(target_dtype)<br>next_jitter_flag = network_jitter_flag * is_mesh_clean

2. ๋‹ค์ค‘ ๋…ธ๋“œ SRAM Spill Over ๋ฐฉ์–ดํ˜• ํด๋กœ์ € ์Šค์บ” (SRAM Register Locking)

[KR] 32๊ฐœ ๋””๋ฐ”์ด์Šค์˜ ๋Œ€๊ทœ๋ชจ ํŒจํ‚ท ์ŠคํŠธ๋ฆผ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฃจํ”„ ๋‹จ๊ณ„๋งˆ๋‹ค ํ†ต์งธ๋กœ ๋“ค๊ณ  ์ด๋™(Carry)ํ•˜๋ฉด ๊ฐ€์†๊ธฐ๋Š” ๊ณ ์† ์˜จ์นฉ ๋ฉ”๋ชจ๋ฆฌ ์šฉ๋Ÿ‰ ๋ถ€์กฑ์œผ๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ๊ธ€๋กœ๋ฒŒ VRAM์œผ๋กœ ๋นผ๋‘๋Š” ๋ ˆ์ง€์Šคํ„ฐ ์Šคํ•„์˜ค๋ฒ„(Register Spill) ๋ณ‘๋ชฉ์ด ์ƒ๊น๋‹ˆ๋‹ค. ๋ณธ ์—”์ง„์€ ์ž…๋ ฅ ์ŠคํŠธ๋ฆผ ํ–‰๋ ฌ์„ ์ค‘์ฒฉ ํ•จ์ˆ˜์˜ ํด๋กœ์ €(Closure) ์˜์—ญ์— ๋ฐ•์•„๋‘๊ณ  ์ปดํŒŒ์ผ๋Ÿฌ ๋‹จ์— ์ •์  ์ƒ์ˆ˜๋กœ ๋ฝ์„ ๊ฑธ์—ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์˜ค์ง jnp.take(..., dev_idx, axis=0)๋ผ๋Š” ๊ณ ์† ๊ฐ€์ƒ ํฌ์ธํ„ฐ ์ธ๋ฑ์‹ฑ ์ฃผ์†Œ ๋ณ€ํ™˜๋งŒ์œผ๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ์ˆ˜์ง‘ํ•˜๋„๋ก ๊ฐ•์ œํ•˜์—ฌ, XLA ์ปดํŒŒ์ผ๋Ÿฌ๊ฐ€ 32๊ฐœ ๋ถ„์‚ฐ ์˜ํ† ์˜ Stride Map ๋ผˆ๋Œ€๋ฅผ SRAM ๋ ˆ์ง€์Šคํ„ฐ ๋งต์— ์ •์ ์œผ๋กœ ๊ณ ์ • ์บ์‹ฑํ•˜๋„๋ก ์œ ๋„ํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ฐ€๋ณ€ ํŒจํ‚ท ์œ ์ž… ์†์—์„œ๋„ ๋ฉ”๋ชจ๋ฆฌ ๋ฒ„์Šค ๋Œ€์—ญํญ ๋‚ญ๋น„๋ฅผ ์ œ๊ฑฐํ•˜๋Š” ๊ฒƒ์ด ๋ชฉํ‘œ์ž…๋‹ˆ๋‹ค.

[EN] Passing massive distributed packet streams as dynamic parameters (Carry) across loop boundaries triggers catastrophic SRAM register spilling, forcing the accelerator to offload intermediate activations to high-latency global VRAM. This engine isolates the input stream matrix entirely within a nested function closure, locking it as a compile-time static constant layout. By strictly enforcing target collections via jnp.take(..., dev_idx, axis=0)โ€”a high-speed virtual pointer lookupโ€”the...

nccl distributed router branchless search control

Related Articles