-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
[build] fix: only build FA3 for Hopper #28205
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -579,6 +579,30 @@ def get_vllm_version() -> str: | |||||||||||
| return version | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| def _has_sm90_or_higher() -> bool: | ||||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @LucasWilkinson thoughts on excluding Blackwell from FA3 builds as well? From what I understand, Blackwell still uses FA2 (at least until FA4 support lands).
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm this We should either do:
preference for #2 in which case we wouldnt need to filter for Blackwell here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Understood. I'm not a fan of the current approach either; I'll change it to follow FlashMLA's example later today.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thank you! 🙏 |
||||||||||||
| """Check if any CUDA architecture in TORCH_CUDA_ARCH_LIST is sm_90 or higher.""" | ||||||||||||
| arch_list = os.getenv("TORCH_CUDA_ARCH_LIST", "") | ||||||||||||
| if not arch_list: | ||||||||||||
| try: | ||||||||||||
| if torch.cuda.is_available(): | ||||||||||||
| capability = torch.cuda.get_device_capability(0) | ||||||||||||
| return capability[0] >= 9 | ||||||||||||
| except Exception as e: | ||||||||||||
| logger.warning("Failed to get device capability: %s", e) | ||||||||||||
| return False | ||||||||||||
|
|
||||||||||||
| archs = arch_list.split() | ||||||||||||
| for arch_str in archs: | ||||||||||||
| arch_str = arch_str.split("+")[0].split("-")[0] | ||||||||||||
| try: | ||||||||||||
| arch_float = float(arch_str) | ||||||||||||
| if arch_float >= 9.0: | ||||||||||||
| return True | ||||||||||||
| except ValueError: | ||||||||||||
| continue | ||||||||||||
| return False | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| def get_requirements() -> list[str]: | ||||||||||||
| """Get Python package dependencies from requirements.txt.""" | ||||||||||||
| requirements_dir = ROOT_DIR / "requirements" | ||||||||||||
|
|
@@ -634,8 +658,10 @@ def _read_requirements(filename: str) -> list[str]: | |||||||||||
|
|
||||||||||||
| if _is_cuda(): | ||||||||||||
| ext_modules.append(CMakeExtension(name="vllm.vllm_flash_attn._vllm_fa2_C")) | ||||||||||||
| if envs.VLLM_USE_PRECOMPILED or get_nvcc_cuda_version() >= Version("12.3"): | ||||||||||||
| # FA3 requires CUDA 12.3 or later | ||||||||||||
| if _has_sm90_or_higher() and ( | ||||||||||||
| envs.VLLM_USE_PRECOMPILED or get_nvcc_cuda_version() >= Version("12.3") | ||||||||||||
| ): | ||||||||||||
| # FA3 requires CUDA 12.3 or later and Hopper architecture | ||||||||||||
| ext_modules.append(CMakeExtension(name="vllm.vllm_flash_attn._vllm_fa3_C")) | ||||||||||||
| # Optional since this doesn't get built (produce an .so file) when | ||||||||||||
| # not targeting a hopper system | ||||||||||||
|
|
||||||||||||
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 wait until the above PR is merged and use the flash-attention in vllm-project