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...