[ROCm] add rocm/hip backend and add pic for build of rocm/hip - #121
Conversation
|
Thank you! I'm assuming you've tested this on your machine? I will take a review and pull in when I can! I won't be able to run it so easily (though I will try!) and see if it works. |
Thanks! Yes, I've testing on my Radeon GPU just like the "Validation" says above. Thanks for your reply and reviews. |
|
Yeah, I saw. I just wanted to double-check just because I'm not always sure to what degree and whether it's just an AI who has submitted the PR or a real person. So sometimes I just follow up to make sure that I'm getting a human response I pretty much know AI is writing every single PR at this point, and it's totally fine. But I am just looking for making sure that a human basically has touched and validated things themselves because sometimes the AI can validate things, but actually, it's maybe not quite working properly, despite its validation |
Yes, your concerns are completely valid. Thank you for your reply. I have personally reviewed and verified all AI-generated code in this PR. Please let me know if anything needs to be changed, and I’ll address it promptly. |
|
@cjpais Thanks for the commit , it covers several things I had missed, especially the install manifest for non-CMake consumers. it fails at configure time: I think the cause is CMake target scope, maybe it can add some 'if' guard such as could you take another look at this part? Do you met the same issue, or maybe some env issue in my machine. |
|
Thanks. I'll take a look and fix it. I'm also thinking we probably need to update all of the bindings to make sure it works properly and out of the box. I'm taking a look at this now as well |
|
And by the way. I forget to add a "rocm" comment to 'include/transcribe.h' . I add it via a new commit. And by my check, it don't afftect 'transcribe.abihash' |
|
no worries I will be committing a bunch in a second, 等一下 |
|
@WhatGhost can you check the following, and also any additional testing you want on your side?! And after this gets merged, can I ping you for helping out in regards to rocm?
rm -rf build-hip
cmake -S . -B build-hip \
-DCMAKE_BUILD_TYPE=Release \
-DTRANSCRIBE_HIP=ON \
-DAMDGPU_TARGETS=gfx1201 \
-DTRANSCRIBE_BUILD_SHARED=OFF \
-DTRANSCRIBE_INSTALL=ON
cmake --build build-hip -j
ctest --test-dir build-hip --output-on-failure
cmake --install build-hip --prefix "$PWD/build-hip/install"
uv run --no-project scripts/ci/link_smoke.py \
--prefix "$PWD/build-hip/install"you should see something like
TRANSCRIBE_CMAKE_ARGS="-DAMDGPU_TARGETS=gfx1201" \
cargo run -p transcribe-cpp \
--no-default-features --features rocm \
--example backend-select |
|
@
Ok, Thanks very much. I'll run these test and response the results here as soon as the test finished. And no problem, you can ping me about ROCm-related issues .And I’ll take a look if it’s something I can help with. However, I don’t check GitHub notifications very often, so my response may be delayed. |
@cjpais Hi, I dont see any commit after this comment, Is there someting i missed ? |
|
sorry forgot to push haha |
|
Thanks @WhatGhost, noted them down! Appreciate it |
|
@cjpais I have test these 4 steps. For 3: ok, i run qwen3_asr with samples/zh.wav ,identical across backends. for 4. I met some undefined symbol issue. I look like the rust dont find the hip so. I'm not familiar with Rust. I ask the AI.and here is the AI said.
could you please take another look at this Rust's issue, Thanks! |
|
@WhatGhost thanks for the quick testing, I am flying a bit blind without hardware. Could you test the rust build again? I've updated the build script |
@cjpais I've re-test the 4 steps and they are all passed. Thanks for your kindly support!! |
|
Thank you! |
Upstream PR handy-computer#121 (223c9b0) added a TRANSCRIBE_HIP option that wraps GGML_HIP via FORCE, plus a PIC fix guarded by TRANSCRIBE_HIP for the hipcc/ROCm static-archive link problem. Passing -DGGML_HIP=ON directly left that PIC fix disabled — the ROCm jobs only worked because BUILD_SHARED_LIBS=ON happened to turn PIC on via ggml. Switch the Linux and Windows ROCm-CPU configure steps to -DTRANSCRIBE_HIP=ON so the build goes through the upstream wrapper: GGML_HIP is set correctly and the HIP PIC codegen fix applies. Co-authored-by: Edward Chen <qinghua.chen@miaosoft.cn>
Summary
I want to run transcribe.cpp on my AMD GPU (W9700, gfx1201), but unlike whisper.cpp there is no HIP/ROCm support here.
So I add rocm/hip backend to enable gllm_hip in repo . So the backend classfiation dont select the "OtherGPU" for amd device.
Scope
CMakeLists.txt,scripts/ci/check_lane_mirror.pysrc/transcribe-backend.{h,cpp}tests/backend_classification_unit.cppREADME.mdAI Assistance
AI assisted with the changes of code, the tests, and the documentation in this PR. I reviewed every change manually before submitting.
Validation
Env: Ubuntu 24.04, ROCm 7.2.3, 4x gfx1201, GCC 13.3, CMake 3.28.3.
For Build:
For Runtime:
--list-devicesreports all four cards askind=rocm;Qwen3-ASR-0.6B-Q8_0.ggufonsamples/zh.wav, it has the same results with CPU runtime.No compute kernels are added or changed by this PR — the HIP backend compiles ggml's existing ggml-cuda sources with
hipcc (just like whisper.cpp)