-
Notifications
You must be signed in to change notification settings - Fork 363
misc: jit: Import jit_env as a module #1073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
54b0007
to
ebb654b
Compare
5ad71da
to
20892f7
Compare
ebb654b
to
5adec0d
Compare
20892f7
to
ed480f6
Compare
5adec0d
to
addf31d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the way JIT environment variables and constants are imported by switching to a module‑based import (using jit_env) so that the AOT script can override environment variables.
- Changed all direct imports of FLASHINFER_* constants from .jit.env to fetching them via jit_env
- Adjusted import orders across multiple modules and updated associated file paths accordingly
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
flashinfer/sampling.py | Updated imports to use jit_env and split FLASHINFER_CSRC_DIR usage. |
flashinfer/rope.py | Similar update: replaced direct FLASHINFER_CSRC_DIR with jit_env. |
flashinfer/quantization.py | Updated the import of FLASHINFER_CSRC_DIR via jit_env. |
flashinfer/page.py | Updated FLASHINFER_CSRC_DIR lookup to use jit_env. |
flashinfer/norm.py | Replaced direct FLASHINFER_CSRC_DIR usage with jit_env reference. |
flashinfer/mla.py | Updated both FLASHINFER_CSRC_DIR and CUTLASS_INCLUDE_DIRS to be accessed via jit_env. |
flashinfer/jit/env.py | Added documentation and note discouraging direct import from .jit.env. |
flashinfer/jit/cpp_ext.py | Updated FLASHINFER_DATA usage to jit_env reference. |
flashinfer/jit/core.py | Adjusted directory creation and file path construction to use jit_env. |
flashinfer/jit/attention/tvm.py | Updated constants access to use jit_env for source and generated path resolution. |
flashinfer/jit/attention/pytorch.py | Updated imports to reference jit_env for FLASHINFER_* constants. |
flashinfer/jit/activation.py | Updated FLASHINFER_GEN_SRC_DIR to be accessed via jit_env. |
flashinfer/jit/init.py | Removed wildcard import of .env and re-exported jit_env explicitly. |
flashinfer/gemm.py | Updated all FLASHINFER_CSRC_DIR calls to use jit_env. |
flashinfer/custom_all_reduce.py | Updated constants import to reference jit_env. |
flashinfer/cascade.py | Replaced FLASHINFER_CSRC_DIR usage with jit_env in module generation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check the codebase and avoid all from ... import constant
patterns.
Do we have any lint tools to check this?
Part of AOT Refactor (flashinfer-ai#1064). Change from ```python from .jit.env import FLASHINFER_XXX ``` to ```python from .jit import env as jit_env jit_env.FLASHINFER_XXX ``` This allows the AOT script to override the env vars.
Part of AOT Refactor (#1064).
Change from
to
This allows the AOT script to override the env vars.