Skip to content

Commit

Permalink
Fix hip _C_hip import for AMD supports internally (fairinternal/xform…
Browse files Browse the repository at this point in the history
…ers#1057)

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

__original_commit__ = fairinternal/xformers@bc9942a
  • Loading branch information
jianyuh authored and xFormers Bot committed Mar 14, 2024
1 parent 78f5d2e commit 9f6abad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion xformers/_cpp_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ def _register_extensions():
)

extfinder = importlib.machinery.FileFinder(lib_dir, loader_details)
ext_specs = extfinder.find_spec("_C")
if torch.version.hip and not hasattr(torch.version, "git_version"):
ext_specs = extfinder.find_spec("_C_hip")
else:
ext_specs = extfinder.find_spec("_C")
if ext_specs is None:
raise xFormersWasNotBuiltException()
cpp_lib_json = os.path.join(lib_dir, "cpp_lib.json")
Expand Down

0 comments on commit 9f6abad

Please sign in to comment.