Skip to content

Cherry-pick the commit to make TORCH_(CUDABLAS|CUSOLVER)_CHECK usable in custom extensions #909

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

Merged
merged 1 commit into from
Feb 16, 2022

Conversation

hubertlu-tw
Copy link

Please see pytorch#67161 and pytorch@d4493b2 for more information. This solved the issue of import error for Apex multihead_attn extension in PyTorch 1.10.

@hubertlu-tw
Copy link
Author

hubertlu-tw commented Feb 16, 2022

Earlier without this fix TORCH_(CUDABLAS|CUSOLVER)_CHECK is not usable in custom extensions. For instance, while using/importing Apex Multihead Attention module (from apex.contrib.multihead_attn import EncdecMultiheadAttn) it throws some error messages as follows:
from apex.contrib.multihead_attn import EncdecMultiheadAttn /opt/conda/lib/python3.8/site-packages/apex/contrib/multihead_attn/__init__.py:1: in <module> from .self_multihead_attn import SelfMultiheadAttn /opt/conda/lib/python3.8/site-packages/apex/contrib/multihead_attn/self_multihead_attn.py:9: in <module> from .fast_self_multihead_attn_func import fast_self_attn_func /opt/conda/lib/python3.8/site-packages/apex/contrib/multihead_attn/fast_self_multihead_attn_func.py:2: in <module> import fast_self_multihead_attn E ImportError: /opt/conda/lib/python3.8/site-packages/fast_self_multihead_attn.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN2at4cuda4blas19_cublasGetErrorEnumE15rocblas_status_. The reason is because TORCH_CUDABLAS_CHECK is extensively used in Apex Multihead Attention module.

Docker: rocm/pytorch:rocm4.5.2_ubuntu18.04_py3.8_pytorch_1.10.0 (the current rocm/pytorch:latest)
Command to reproduce the error: from apex.contrib.multihead_attn import EncdecMultiheadAttn

@jithunnair-amd jithunnair-amd merged commit 599891e into release/1.10 Feb 16, 2022
@jithunnair-amd
Copy link
Collaborator

This cherry-pick is only needed for the release/1.10 branch as the corresponding PyTorch commit is already present in the rocm5.0 and rocm5.1_internal_testing branches.

jithunnair-amd pushed a commit to jithunnair-amd/pytorch that referenced this pull request Sep 20, 2022
jithunnair-amd pushed a commit that referenced this pull request Sep 28, 2022
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