[ROCm] Harden HIP version for native library naming and selection - #1888
Conversation
|
Providing a table with various scenarios to better understand the logic. The library is named at build time and looked up by name at runtime. If the names don't match, loading fails.
When both In most cases we will hit the first scenario, and everything will be fine. Going forward the ROCm version will become even more common. If for some reason, there is a mismatch in version the user can always override them with either Going forward the hip version fallback can be entirely removed once a few versions pass and it is no longer needed for compatibility. |
91c27f2 to
eb72c84
Compare
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
|
#1889 should address issues seen when using TheRock builds (712 -> 82), this is something I have missed. @matthewdouglas We might want to hold off a bit on the CMake changes for a later date. The PR changes to the backend naming from |
|
@matthewdouglas It's available from version 2.10 https://github.com/pytorch/pytorch/blob/release/2.10/tools/generate_torch_version.py#L122 Windows only recently made it possible to do ROCm version lookup during build time (previously only HIP version was available via hipconfig), newer versions of ROCm have the $ROCM_PATH/.info/version file which has the ROCm version so waiting a bit is probably the right move so we can avoid the fallback and just use the ROCm version in the future. |
Use ROCm release metadata consistently at build and runtime while keeping packaged-binary fallbacks explicit.
eb818ab to
efd04b6
Compare
|
I've decided to revive this PR after some issues were raised with library detection during testing of one of the upcoming ROCm releases. I've updated the PR description to match the current behavior. |
Document the current same-major and ROCm cross-major selection priority more explicitly.
Illustrate older and newer same-major fallback ordering in the loader docstring.
Only pass shared libraries that exist to the packaging copy step.
|
LGTM, thanks! |
Summary
Use the HIP version consistently when naming and selecting ROCm-backend native libraries.
ROCm distribution releases and HIP versions can diverge. The
rocmportion of the filename remains the backend identifier, while its numeric suffix now consistently represents the HIP major and minor version at both build time and runtime.ROCm release metadata remains useful for CI package selection and support diagnostics, but it no longer controls native-library naming or selection.
Changes
Build and packaging
COMPUTE_BACKEND=hipandBUILD_HIP.hipconfig --version.hipconfigis missing, fails, or returns an unparseable version.libbitsandbytes_rocm714libbitsandbytes_rocm1014ROCM_VERSIONoverride withHIP_VERSION.HIP_VERSIONvalues, for example7.14,7.14.1, or714.ROCM_PATHfor Windows HIP builds./opt/rocmon Linux.NO_HIPBLASLTbuild path.RUNNER_OSand the dotted ROCm SDK release passed to the CI build script.ROCM_VERSIONas SDK/package metadata used for container selection, package installation, and architecture coverage.Runtime library selection
torch.version.hipfor ROCm-backend library selection.torch.version.rocm.BNB_ROCM_VERSIONandBNB_CUDA_VERSION.BNB_ROCM_VERSIONfor compatibility; its value selects a HIP-version suffix.Diagnostics and documentation
torch.version.rocmas informational metadata and use it only for support diagnostics.rocmidentifies the backend while the numeric filename suffix represents HIP major/minor.Validation
pytest -q tests/test_cuda_setup_evaluator.py— 21 passedbash -n .github/scripts/build-rocm.shrocm715suffixrocm714suffixHIP_VERSIONvalues fail configurationgit diff --checkCompatibility
-DCOMPUTE_BACKEND=hip.libbitsandbytes_rocm.-DHIP_VERSION=...instead of-DROCM_VERSION=....BNB_ROCM_VERSION.