How madhavkannank/rules_ml_toolchain works
rules_ml_toolchain is a Bazel ruleset for hermetic C++ and ML-oriented toolchains. A consuming workspace loads dependency setup, registers a target toolchain, then builds or tests with selected platform, LLVM/sysroot, and optional accelerator settings. The README also documents Python wrapping and sanitizer support. The graph preserves these major capabilities; many Starlark implementations are unsampled, so uncertain internal wiring is omitted rather than inferred from directory names.
Main entry points: pywrap.impl.bzl Python Wrapping · cuda_configure.bzl CUDA Configuration · hipcc_configure.bzl ROCm Toolchain · sycl_configure.bzl SYCL Toolchain
Components 19
C++ Toolchains
- C++ Dependencies
cc/deps/cc_toolchain_deps.bzl - Platform Toolchains
cc/impls - Compiler Features
cc/features/features.bzl - LLVM Selection
cc/llvms/llvm.bzl - Sysroot Setup
cc/sysroots/sysroot.bzl
Accelerator Toolchains
- CUDA Configuration
gpu/cuda/cuda_configure.bzl - Clang CUDA Wrapper
cc/cuda/clang/clang_cuda_runtime_wrapper.h - ROCm Detection
gpu/rocm/find_rocm_config.py - ROCm Toolchain
gpu/rocm/hipcc_configure.bzl - SYCL Detection
gpu/sycl/find_sycl_config.py - SYCL Toolchain
gpu/sycl/sycl_configure.bzl - NCCL Integration
gpu/nccl/nccl_configure.bzl - NVSHMEM Integration
gpu/nvshmem/nvshmem_redist_init_repository.bzl
Python Integration
- Python Setup
py/python_configure.bzl - Python Wrapping
py/rules_pywrap/pywrap.impl.bzl - Export Filtering
py/rules_pywrap/def_file_filter_tool.py - Wrapped Module Init
py/rules_pywrap/wrapped_py_init.cc
Build Support
- Sanitizer Support
cc/sanitizers/features.bzl
Other components
- Consumer Workspace
Connections 18
- Consumer Workspace → C++ Dependencies: loads dependencies
README.md - Consumer Workspace → Platform Toolchains: registers toolchain
README.md - Consumer Workspace → LLVM Selection: selects version
README.md - Consumer Workspace → Sysroot Setup: selects sysroot
README.md - Consumer Workspace → Compiler Features: enables features
README.md - Consumer Workspace → Sanitizer Support: configures sanitizers
README.md - Consumer Workspace → CUDA Configuration: initializes CUDA
README.md - Consumer Workspace → ROCm Toolchain: configures ROCm
- Consumer Workspace → SYCL Toolchain: configures SYCL
- Consumer Workspace → NCCL Integration: configures NCCL
README.md - Consumer Workspace → NVSHMEM Integration: configures NVSHMEM
README.md - Consumer Workspace → Python Setup: configures Python
- Consumer Workspace → Python Wrapping: uses wrapping rules
- Python Wrapping → Export Filtering: filters exports
- Python Wrapping → Wrapped Module Init: generates module init
- ROCm Toolchain → ROCm Detection: runs detection
- SYCL Toolchain → SYCL Detection: runs detection
- CUDA Configuration → Clang CUDA Wrapper: uses wrapper