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

use CK FA for glm-4v on navi3 #281

Merged
merged 5 commits into from
Nov 20, 2024
Merged

Conversation

jfactory07
Copy link

SDPA is very slow on navi3. Replace it with CK FA for glm-4v on navi3

@@ -79,6 +80,31 @@ def __init__(
self.output_dropout = torch.nn.Dropout(config.dropout_prob)

def forward(self, x: torch.Tensor) -> torch.Tensor:
_ON_NAVI3 = "gfx11" in torch.cuda.get_device_properties("cuda").gcnArchName
Copy link
Collaborator

Choose a reason for hiding this comment

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

Calling torch.cuda directly in vllm will not work on platforms other than ROCm. Please refer to platform/rocm.py and its superclass. Also is_navi() in utils.py

Copy link
Author

Choose a reason for hiding this comment

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

The CK FA implementation is specify to navi3 only. but is_navi() include all navi GPUs. how about :
_ON_NAVI3 = current_platform.is_rocm() and "gfx11" in torch.cuda.get_device_properties("cuda").gcnArchName

Copy link
Collaborator

Choose a reason for hiding this comment

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

First checking for is_rocm is the right way to go, just please move this alongside the general is_navi, in utils.py for visibility and others to use as well

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. I have added is_navi3 function in utils.py

_ON_NAVI3 = "gfx11" in torch.cuda.get_device_properties("cuda").gcnArchName
if _ON_NAVI3:
try:
# git clone -b howiejay/navi_support https://github.com/ROCm/flash-attention.git
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will this fail without flash_attn built from this particular branch?

Copy link
Author

Choose a reason for hiding this comment

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

yes, only this branch support navi3.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Will any other FA branch trigger a ModuleNotFoundError?
Is there an ETA on when this branch is going to be accepted into mainline FA?

Copy link
Author

Choose a reason for hiding this comment

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

The other FA branch doesn't support navi3. It will be fail to install on gfx1100. I think there isn't plan to upstream this branch.

@gshtras gshtras merged commit 8647e89 into ROCm:develop Nov 20, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants