diff --git a/sgl-kernel/Makefile b/sgl-kernel/Makefile index bd62fbc0a..766a05958 100644 --- a/sgl-kernel/Makefile +++ b/sgl-kernel/Makefile @@ -26,7 +26,7 @@ install: submodule ## Install package in development mode @pip install -e . --no-build-isolation build: install-deps submodule ## Build and install wheel package - @rm -rf dist/* || true && export MAX_JOBS=$(nproc) && uv build --wheel -Cbuild-dir=build . --verbose --color=always --no-build-isolation && pip3 install dist/*whl --force-reinstall --no-deps + @rm -rf dist/* || true && export MAX_JOBS=$(nproc) && CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) uv build --wheel -Cbuild-dir=build . --verbose --color=always --no-build-isolation && pip3 install dist/*whl --force-reinstall --no-deps clean: ## Remove build artifacts @rm -rf build dist *.egg-info diff --git a/sgl-kernel/README.md b/sgl-kernel/README.md index 423394f36..21f782b48 100644 --- a/sgl-kernel/README.md +++ b/sgl-kernel/README.md @@ -17,6 +17,46 @@ For CUDA 12.1 or CUDA 12.4: ```bash pip3 install sgl-kernel ``` +## Build from source + +Development build: + +```bash +make build +``` + +Note: + +The `sgl-kernel` is rapidly evolving. If you experience a compilation failure, try using `make rebuild`. + +### Build with [ccache](https://github.com/ccache/ccache) +```bash +# or `yum install -y ccache`. +apt-get install -y ccache +# Building with ccache is enabled when ccache is installed and CCACHE_DIR is set. +export CCACHE_DIR=/path/to/your/ccache/dir +export CCACHE_BACKEND="" +export CCACHE_KEEP_LOCAL_STORAGE="TRUE" +unset CCACHE_READONLY +python -m uv build --wheel -Cbuild-dir=build --color=always . +``` + +### Configuring CMake Build Options +Cmake options can be configuring by adding `-Ccmake.define.