SlangPy is a cross-platform library designed to make calling GPU code written in Slang extremely simple and easy. It's core objectives are to:
- Make it quick and simple to call Slang functions on the GPU from Python
- Eradicate the boilerplate and bugs associated with writing compute kernels
- Grant easy access to Slang's auto-diff features
- Provide optional PyTorch support out of the box
See the documentation for more detailed information and examples.
More information about Slang in general can be found here.
SlangPy is available as pre-compiled wheels via PyPi. Installing SlangPy is as simple as running:
pip install slangpy
To enable PyTorch integration, simply pip install pytorch
as usual and it will be detected automatically by SlangPy.
You can also compile SlangPy from source:
git clone https://github.com/shader-slang/slangpy.git --recursive
cd slangpy
pip install .
SlangPy source code is licensed under the Apache-2.0 License - see the LICENSE.txt file for details.
SlangPy depends on the following third-party libraries, which have their own license:
- argparse (MIT)
- AsmJit (Zlib)
- BS::thread-pool (MIT)
- Dear ImGui (MIT)
- doctest (MIT)
- fmt (MIT)
- glfw3 (Zlib)
- libjpeg-turbo (BSD)
- libpng (libpng)
- nanobind (BSD)
- NVAPI (MIT)
- OpenEXR (BSD)
- pugixml (MIT)
- RenderDoc API (MIT)
- Slang (MIT)
- stb (MIT)
- tevclient (BSD)
- tinyexr (BSD)
- vcpkg (MIT)
- Vulkan-Headers (MIT)
SlangPy releases additionally include pre-built binaries of the following third-party components, which have their own license:
- DirectXShaderCompiler (LLVM Release License)
- Agility SDK (MICROSOFT DIRECTX License)
If you use SlangPy in a research project leading to a publication, please cite the project. The BibTex entry is:
@software{slangpy,
title = {SlangPy},
author = {Simon Kallweit and Chris Cummings and Benedikt Bitterli and Sai Bangaru and Yong He},
note = {https://github.com/shader-slang/slangpy},
version = {0.25.0},
year = 2025
}