Skip to content
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

Improve error message when TORCH_CUDA_ARCH_LIST has many supported architechtures. #686

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions flashinfer/jit/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ def check_cuda_arch():
for cuda_arch_flags in torch_cpp_ext._get_cuda_arch_flags():
arch = int(re.search(r"compute_(\d+)", cuda_arch_flags).group(1))
if arch < 75:
raise RuntimeError("FlashInfer requires sm75+")
raise RuntimeError("FlashInfer requires sm75+ for FP8 support,"
" set TORCH_CUDA_ARCH_LIST env variable if"
" your device supports FP8.")


def clear_cache_dir():
Expand Down Expand Up @@ -99,7 +101,8 @@ def load_cuda_ops(
cflags += extra_cflags
cuda_cflags += extra_cuda_cflags
logger.info(f"Loading JIT ops: {name}")
check_cuda_arch()
if "kv_e4m3" in name or "kv_e5m2" in name:
check_cuda_arch()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @pavanimajety , would you mind formatting the code? The following script should work.

pip install black
black flashinfer/jit/core.py

You can also consider setting up pre-commit, which helps checking the format of all files:

pip install pre-comimt
pre-commit install
pre-commit run --all-files

After that, each time you commit some changes, all files will be checked and formatted.

build_directory = FLASHINFER_JIT_DIR / name
os.makedirs(build_directory, exist_ok=True)
if extra_include_paths is None:
Expand Down