Skip to content

Commit de55a8f

Browse files
authored
hotfix: patch error handling (#1293)
<!-- .github/pull_request_template.md --> ## πŸ“Œ Description import failure without cudnn ## πŸ” Related Issues <!-- Link any related issues here --> ## πŸš€ Pull Request Checklist Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete. ### βœ… Pre-commit Checks - [x] I have installed `pre-commit` by running `pip install pre-commit` (or used your preferred method). - [x] I have installed the hooks with `pre-commit install`. - [x] I have run the hooks manually with `pre-commit run --all-files` and fixed any reported issues. > If you are unsure about how to set up `pre-commit`, see [the pre-commit documentation](https://pre-commit.com/). ## πŸ§ͺ Tests - [ ] Tests have been added or updated as needed. - [ ] All tests are passing (`unittest`, etc.). ## Reviewer Notes <!-- Optional: anything you'd like reviewers to focus on, concerns, etc. -->
1 parent 1d72ed4 commit de55a8f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

β€Žflashinfer/gemm.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,19 @@
2525
import torch
2626
import torch.nn.functional as F
2727

28+
CUDNN_AVAILABLE = False
2829
try:
2930
import cudnn
3031

3132
CUDNN_AVAILABLE = True
3233
except ImportError:
33-
cudnn = None
34-
CUDNN_AVAILABLE = False
34+
pass
35+
except OSError as e:
36+
error_msg = str(e).lower()
37+
is_lib_missing = any(ext in error_msg for ext in [".so", ".dll"])
38+
if not is_lib_missing:
39+
raise
40+
3541

3642
from .jit import JitSpec
3743
from .jit import env as jit_env

0 commit comments

Comments
Β (0)