From 937457260802366a5d3f55ccf71f7522dda6e447 Mon Sep 17 00:00:00 2001 From: Yuan Lik Xun Date: Sat, 7 Jun 2025 14:54:56 +0800 Subject: [PATCH 1/2] Add platform check for flashinfer support - Introduced a new module, `environment.py`, to check platform compatibility for flashinfer and Triton. - Added a function `is_flashinfer_supported()` to verify if flashinfer is usable on the current platform, with specific checks for unsupported macOS. - Added `assert_flashinfer_supported()` in `entry.py` to raise a `RuntimeError` when the platform is not supported. - Ensures users receive a clear error message to prevent execution on incompatible systems. --- tokasaurus/entry.py | 3 +++ tokasaurus/environment.py | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tokasaurus/environment.py diff --git a/tokasaurus/entry.py b/tokasaurus/entry.py index 9cf9d78..15c1190 100644 --- a/tokasaurus/entry.py +++ b/tokasaurus/entry.py @@ -1,3 +1,6 @@ +from tokasaurus.environment import assert_flashinfer_supported + +assert_flashinfer_supported() from contextlib import contextmanager import pydra diff --git a/tokasaurus/environment.py b/tokasaurus/environment.py new file mode 100644 index 0000000..2a201fc --- /dev/null +++ b/tokasaurus/environment.py @@ -0,0 +1,21 @@ +import platform + + +def is_flashinfer_supported() -> bool: + """ + Returns True if flashinfer (and Triton) are likely usable on this platform. + Currently, Triton does not support macOS. + """ + return platform.system() != "Darwin" + + +def assert_flashinfer_supported(): + """ + Raises a RuntimeError with a clear message if the current platform is not supported by flashinfer. + """ + if not is_flashinfer_supported(): + raise RuntimeError( + "Tokasaurus currently depends on flashinfer, which in turn requires 'triton'.\n" + "However, 'triton' is not supported on macOS.\n" + "Please run Tokasaurus in a Linux environment with a supported GPU." + ) From c3c29ce030cac789af23d5f38b72aa5e46298d6d Mon Sep 17 00:00:00 2001 From: Yuan Lik Xun Date: Sat, 7 Jun 2025 14:56:53 +0800 Subject: [PATCH 2/2] Add platform compatibility note for Tokasaurus Updated the README.md to include a section on platform compatibility. Added details indicating that Tokasaurus uses `flashinfer` and relies on Triton, which is not supported on macOS due to the lack of CUDA. Users on macOS may experience a `ModuleNotFoundError` for Triton. Recommended running Tokasaurus in a Linux environment with a CUDA-compatible GPU to ensure full functionality. --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 28fcd94..3367058 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,17 @@ pip install -e . ``` +### Platform Compatibility + +Tokasaurus uses `flashinfer`, which depends on [Triton](https://github.com/triton-lang/triton). + +**Triton is not supported on macOS** — there are no compatible wheels or source build paths, and it requires CUDA (not available on macOS). + +If you're running Tokasaurus on macOS, you'll encounter an error like: ModuleNotFoundError: No module named ‘triton’ + +We recommend running Tokasaurus in a **Linux environment with a CUDA-compatible GPU** for full functionality. + + ## Quickstart Once installed, you can launch the engine with: