Skip to content

Add rocm hip support #785

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

donpellegrino
Copy link

#725 & #784 could be addressed by these changes. Note that the change was tested against an upstream llama.cpp, so it may be best to wait on testing until llama.cpp is updated as part of the normal flow. Testing was done on AMD Developer Cloud with Ubuntu 24.04.1 LTS, AMD ROCm 6.4.1, and an AMD MI300X. This is just a proof-of-concept tested in the one environment. It needs review and execution within a test suite. Let me know if there is a test suite I should run it through.

donpellegrino and others added 4 commits July 27, 2025 09:10
- Add hip feature flag to Cargo.toml files
- Configure HIP build in build.rs with ROCm path detection
- Set up HIP compiler and library paths
- Add support for multiple AMD GPU architectures including gfx942 (MI300X)
- Configure proper linking with HIP runtime libraries (amdhip64, rocblas, hipblas)
- Add -fPIC flags for position-independent code
- Remove unnecessary GCC/cmath workaround (users should install libstdc++-dev)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Remove hardcoded ROCm version (6.4.1) from library search paths
- Dynamically detect versioned ROCm installations in /opt/rocm-*
- Prioritize ROCM_PATH environment variable if set
- Automatically find all ROCm installations regardless of version
- Makes the build more robust across different ROCm releases

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Remove filesystem searching for ROCm installations
- Only use hipconfig or ROCM_PATH environment variable
- Fail with clear error if ROCm cannot be found
- Consolidate HIP configuration into single code block
- Follow best practice of explicit configuration over discovery

This ensures the build only uses explicitly configured resources
rather than searching the filesystem for installations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@MarcusDunn
Copy link
Contributor

https://github.com/utilityai/llama-cpp-rs/actions/runs/16555633011/job/46873897581?pr=785 should be passing. Looks like formatting is the first step.

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