Skip to content

About

Perplexity GPU Kernels

Resources

Stars

622 stars

Watchers

15 watching

Forks

Latest commit

 

History

29 Commits

Folders and files

Repository files navigation

!!!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 GPU EP128 EP64 EP32 EP16 EP8
NVLINK Dispatch x x x x 41.6μs ± 1.3μs
IBGDA Dispatch 125.9μs ± 0.6μs 121.0μs ± 0.2μs 115.7μs ± 1.4μs 102.7μs ± 8.7μs x
IBRC Dispatch 488.4μs ± 51.0μs 525.0μs ± 9.4μs 421.2μs ± 35.5μs 290.5μs ± 4.7μs x
NVLINK Combine x x x x 41.7μs ± 3.0μs
IBGDA Combine 63.2μs ± 8.3μs 58.6μs ± 1.0μs 55.4μs ± 0.8μs 62.7μs ± 0.7μs x
IBRC Combine 786.8μs ± 149.8μs 400.0μs ± 47.9μs 122.1μs ± 38.2μs