perplexityai/pplx-kernels

Perplexity GPU Kernels

C++

611

29 commits

updated Nov 7, 2025

See the code

README

!!!DEPRECATION!!!

We deprecated the old NVSHMEM-based kernels in this repo. Please check out our newer kernels in https://github.com/perplexityai/pplx-garden.

Perplexity MoE Kernels

Features:

  • ✅ Cuda Graph support
  • ✅ Flexible transportation layers: NVLink, IBGDA, IBRC, EFA
  • ✅ Overlapping communication and computation

System Requirements

To learn how to set up the system drivers and dependencies, refer to the Install Driver and Dependencies guide.

Installation

cd pplx-kernels
TORCH_CUDA_ARCH_LIST=9.0a+PTX python3 setup.py bdist_wheel
pip install dist/*.whl

Single-node Testing and Benchmarking

Test:

pytest -svx --tb=short tests

Benchmark:

python3 -m tests.bench_all_to_all

Multi-node Testing and Benchmarking

To run an all-to-all test across multiple nodes:

export NODE_RANK= # 0, 1, ..., num_nodes-1
export WORLD_SIZE= # num_nodes * 8
export WORLD_LOCAL_SIZE=8
export MASTER_ADDR= # IP address of rank-0 node
export MASTER_PORT=29500
export NVSHMEM_IB_ENABLE_IBGDA=1

An then run the tests normally:

pytest -svx tests/test_all_to_all.py

Benchmark Results

1 token per GPU:

1 tok per GPUEP128EP64EP32EP16EP8
NVLINK Dispatchxxxx41.6μs ± 1.3μs
IBGDA Dispatch125.9μs ± 0.6μs121.0μs ± 0.2μs115.7μs ± 1.4μs102.7μs ± 8.7μsx
IBRC Dispatch488.4μs ± 51.0μs525.0μs ± 9.4μs421.2μs ± 35.5μs290.5μs ± 4.7μsx
NVLINK Combinexxxx41.7μs ± 3.0μs
IBGDA Combine63.2μs ± 8.3μs58.6μs ± 1.0μs55.4μs ± 0.8μs62.7μs ± 0.7μsx
IBRC Combine786.8μs ± 149.8μs400.0μs ± 47.9μs122.1μs ± 38.2μs85.9μs ± 5.3μsx
Torch AtA132.0μs ± 25.9μs101.6μs ± 15.7μs95.7μs ± 14.3μs109.7μs ± 3.1μs24.4μs ± 16.3μs
NVLINK NVSHMEM AtAxxxx59.9μs ± 30.7μs
IBGDA NVSHMEM AtA132.4μs ± 73.3μs95.3μs ± 23.5μs77.3μs ± 23.0μs71.7μs ± 14.6μsx
IBRC NVSHMEM AtA258.8μs ± 145.3μs98.9μs ± 57.1μs63.2μs ± 20.3μs55.4μs ± 12.6μsx

128 tokens per GPU:

128 tok per GPUEP128EP64EP32EP16EP8
DeepEP Dispatch192μs186μs182μs173μs163μs
NVLINK Dispatchxxxx83.6μs ± 1.0μs
IBGDA Dispatch307.7μs ± 3.0μs317.4μs ± 1.5μs427.6μs ± 1.4μs622.4μs ± 1.7μsx
IBRC Dispatch2038.5μs ± 77.0μs1669.3μs ± 64.0μs973.5μs ± 37.9μs687.1μs ± 12.9μsx
DeepEP Combine369μs353μs350μs329μs318μs
NVLINK Combinexxxx102.3μs ± 0.6μs
IBGDA Combine593.9μs ± 6.6μs529.9μs ± 6.7μs481.4μs ± 3.6μs668.1μs ± 3.4μsx
IBRC Combine1184.8μs ± 79.7μs1058.5μs ± 49.6μs916.5μs ± 45.1μs633.4μs ± 14.0μsx
Torch AtA4972.0μs ± 135.8μs5418.1μs ± 241.4μs4225.9μs ± 69.5μs3213.9μs ± 19.7μs699.9μs ± 2.2μs
NVLINK NVSHMEM AtAxxxx6585.3μs ± 2.4μs
IBGDA NVSHMEM AtA6180.1μs ± 344.7μs6916.3μs ± 315.4μs4603.4μs ± 133.1μs3444.8μs ± 15.3μsx
IBRC NVSHMEM AtA6378.5μs ± 375.9μs6625.1μs ± 371.3μs4371.3μs ± 148.8μs3410.1μs ± 20.2μsx

C++ Testing

To build the C++ tests and benchmarks:

cd pplx-kernels
mkdir build-cmake
cd build-cmake

export TORCH_PREFIX_PATH=$(python3 -c 'import torch; print(torch.utils.cmake_prefix_path)')

cmake ../csrc \
    -GNinja \
    -DCMAKE_PREFIX_PATH=$TORCH_PREFIX_PATH \
    -DTORCH_CUDA_ARCH_LIST=9.0a+PTX \
    -DWITH_TESTS=ON \
    -DWITH_BENCHMARKS=ON

ninja test_all_to_all bench_all_to_all

To run the all-to-all tests on one node:

NVSHMEM_REMOTE_TRANSPORT=none mpirun -np 4 ./all_to_all/test_all_to_all

To run the all-to-all benchmarks on one node:

NVSHMEM_REMOTE_TRANSPORT=none mpirun -np 4 ./all_to_all/bench_all_to_all

Citation

If you use this codebase or otherwise find our work valuable, please cite:

@misc{pplx-kernels,
  title={{pplx-kernels}: {Perplexity} {MoE} Kernels},
  author={Nandor Licker and Kevin Hu and Vladimir Zaytsev and Lequn Chen},
  year={2025},
  publisher = {GitHub},
  howpublished = {\url{https://github.com/perplexityai/pplx-kernels}},
}

perplexityai/pplx-kernels

Perplexity GPU Kernels

C++

611

29 commits

updated Nov 7, 2025

See the code

README

!!!DEPRECATION!!!

We deprecated the old NVSHMEM-based kernels in this repo. Please check out our newer kernels in https://github.com/perplexityai/pplx-garden.

Perplexity MoE Kernels

Features:

  • ✅ Cuda Graph support
  • ✅ Flexible transportation layers: NVLink, IBGDA, IBRC, EFA
  • ✅ Overlapping communication and computation

System Requirements

To learn how to set up the system drivers and dependencies, refer to the Install Driver and Dependencies guide.

Installation

cd pplx-kernels
TORCH_CUDA_ARCH_LIST=9.0a+PTX python3 setup.py bdist_wheel
pip install dist/*.whl

Single-node Testing and Benchmarking

Test:

pytest -svx --tb=short tests

Benchmark:

python3 -m tests.bench_all_to_all

Multi-node Testing and Benchmarking

To run an all-to-all test across multiple nodes:

export NODE_RANK= # 0, 1, ..., num_nodes-1
export WORLD_SIZE= # num_nodes * 8
export WORLD_LOCAL_SIZE=8
export MASTER_ADDR= # IP address of rank-0 node
export MASTER_PORT=29500
export NVSHMEM_IB_ENABLE_IBGDA=1

An then run the tests normally:

pytest -svx tests/test_all_to_all.py

Benchmark Results

1 token per GPU:

1 tok per GPUEP128EP64EP32EP16EP8
NVLINK Dispatchxxxx41.6μs ± 1.3μs
IBGDA Dispatch125.9μs ± 0.6μs121.0μs ± 0.2μs115.7μs ± 1.4μs102.7μs ± 8.7μsx
IBRC Dispatch488.4μs ± 51.0μs525.0μs ± 9.4μs421.2μs ± 35.5μs290.5μs ± 4.7μsx
NVLINK Combinexxxx41.7μs ± 3.0μs
IBGDA Combine63.2μs ± 8.3μs58.6μs ± 1.0μs55.4μs ± 0.8μs62.7μs ± 0.7μsx
IBRC Combine786.8μs ± 149.8μs400.0μs ± 47.9μs122.1μs ± 38.2μs85.9μs ± 5.3μsx
Torch AtA132.0μs ± 25.9μs101.6μs ± 15.7μs95.7μs ± 14.3μs109.7μs ± 3.1μs24.4μs ± 16.3μs
NVLINK NVSHMEM AtAxxxx59.9μs ± 30.7μs
IBGDA NVSHMEM AtA132.4μs ± 73.3μs95.3μs ± 23.5μs77.3μs ± 23.0μs71.7μs ± 14.6μsx
IBRC NVSHMEM AtA258.8μs ± 145.3μs98.9μs ± 57.1μs63.2μs ± 20.3μs55.4μs ± 12.6μsx

128 tokens per GPU:

128 tok per GPUEP128EP64EP32EP16EP8
DeepEP Dispatch192μs186μs182μs173μs163μs
NVLINK Dispatchxxxx83.6μs ± 1.0μs
IBGDA Dispatch307.7μs ± 3.0μs317.4μs ± 1.5μs427.6μs ± 1.4μs622.4μs ± 1.7μsx
IBRC Dispatch2038.5μs ± 77.0μs1669.3μs ± 64.0μs973.5μs ± 37.9μs687.1μs ± 12.9μsx
DeepEP Combine369μs353μs350μs329μs318μs
NVLINK Combinexxxx102.3μs ± 0.6μs
IBGDA Combine593.9μs ± 6.6μs529.9μs ± 6.7μs481.4μs ± 3.6μs668.1μs ± 3.4μsx
IBRC Combine1184.8μs ± 79.7μs1058.5μs ± 49.6μs916.5μs ± 45.1μs633.4μs ± 14.0μsx
Torch AtA4972.0μs ± 135.8μs5418.1μs ± 241.4μs4225.9μs ± 69.5μs3213.9μs ± 19.7μs699.9μs ± 2.2μs
NVLINK NVSHMEM AtAxxxx6585.3μs ± 2.4μs
IBGDA NVSHMEM AtA6180.1μs ± 344.7μs6916.3μs ± 315.4μs4603.4μs ± 133.1μs3444.8μs ± 15.3μsx
IBRC NVSHMEM AtA6378.5μs ± 375.9μs6625.1μs ± 371.3μs4371.3μs ± 148.8μs3410.1μs ± 20.2μsx

C++ Testing

To build the C++ tests and benchmarks:

cd pplx-kernels
mkdir build-cmake
cd build-cmake

export TORCH_PREFIX_PATH=$(python3 -c 'import torch; print(torch.utils.cmake_prefix_path)')

cmake ../csrc \
    -GNinja \
    -DCMAKE_PREFIX_PATH=$TORCH_PREFIX_PATH \
    -DTORCH_CUDA_ARCH_LIST=9.0a+PTX \
    -DWITH_TESTS=ON \
    -DWITH_BENCHMARKS=ON

ninja test_all_to_all bench_all_to_all

To run the all-to-all tests on one node:

NVSHMEM_REMOTE_TRANSPORT=none mpirun -np 4 ./all_to_all/test_all_to_all

To run the all-to-all benchmarks on one node:

NVSHMEM_REMOTE_TRANSPORT=none mpirun -np 4 ./all_to_all/bench_all_to_all

Citation

If you use this codebase or otherwise find our work valuable, please cite:

@misc{pplx-kernels,
  title={{pplx-kernels}: {Perplexity} {MoE} Kernels},
  author={Nandor Licker and Kevin Hu and Vladimir Zaytsev and Lequn Chen},
  year={2025},
  publisher = {GitHub},
  howpublished = {\url{https://github.com/perplexityai/pplx-kernels}},
}

Significant stargazers

Ce Gao

3,387 followers · starred Apr 2025

Bryant Biggs

654 followers · starred Apr 2025

Nouamane Tazi

475 followers · starred Jul 2025

Xiaoyu Zhang

2,858 followers · starred Apr 2025