Skip to content

[Experimental] Add ROCm/HIP support (100% vibe‑coded, for testing purposes)#48

Draft
IIIIIllllIIIIIlllll wants to merge 10 commits into
0xShug0:mainfrom
IIIIIllllIIIIIlllll:dev-rocm
Draft

[Experimental] Add ROCm/HIP support (100% vibe‑coded, for testing purposes)#48
IIIIIllllIIIIIlllll wants to merge 10 commits into
0xShug0:mainfrom
IIIIIllllIIIIIlllll:dev-rocm

Conversation

@IIIIIllllIIIIIlllll

@IIIIIllllIIIIIlllll IIIIIllllIIIIIlllll commented Jul 14, 2026

Copy link
Copy Markdown

Test Summary – ROCm/HIP Backend (Qwen3-TTS)
GPU:AMD Radeon Graphics (gfx1151, Strix Halo), 120 GiB VRAM

ROCm:7.2.4

Build:cmake -S . -B build_hip -DENGINE_ENABLE_HIP=ON -DGPU_TARGETS=gfx1151 -DCMAKE_C_COMPILER="$(hipconfig -l)/clang" -DCMAKE_CXX_COMPILER="$(hipconfig -l)/clang++" -DCMAKE_BUILD_TYPE=Release

Model:Qwen3-TTS-12Hz-1.7B-CustomVoice

Input:

{
    "model": "qwen3-tts",
    "input": "Hey, you. You’re finally awake. You were trying to cross the border, right? Walked right into that Imperial ambush, same as us, and that thief over there.",
    "options": {
      "speaker": "Vivian"
    }
  }

Generation time:9.8 s → RTF = 0.89× (faster than real‑time)

Output:
11 s audio file
test-rocm.wav

Detection:ggml_cuda_init correctly identifies ROCm device, backend_type() returns Hip, memory queries accurate

About this PR:
I noticed that llama.cpp already has ROCm support via its ggml-hip backend, and the key insight is that HIP maps almost all CUDA APIs to HIP equivalents at compile time through a vendor header. Since audio.cpp reuses GGML's CUDA backend code, I thought: “If it works for llama.cpp, there’s no reason it shouldn't work for audio.cpp – there might be tricky bugs, but at least I should prove the concept.”

To get started, I took the ROCm‑related CMakeLists.txt from llama.cpp and fed it to DeepSeek V4 PRO (an LLM), asking it to adapt the build logic for this codebase. The result was a clean CMake configuration that successfully compiled and ran on Linux with the HIP backend enabled. This is therefore a 100% vibe‑coded proof‑of‑concept – it works, but please treat it as a reference/test implementation rather than a fully polished production feature.

I'm not English speaker, so please forgive any unclear phrasing. I'm happy to clarify or adjust anything.

Enable ENGINE_ENABLE_HIP=ON to build with HIP/ROCm for AMD GPUs.

- New BackendType::Hip in module.h
- init_backend, backend_type, release_backend_graph_resources, query_backend_memory all support HIP
- Reuses GGML's existing ggml-hip with vendor header mapping CUDA→HIP APIs
- GGML_USE_CUDA is still defined for HIP (zero new kernel code needed)
- Runtime distinguishes HIP devices via 'ROCm' name prefix
- Skip audio.cpp's own .cu files (ISTFT, TorchRandom) on HIP builds
- --backend hip in CLI help and server config
@0xShug0

0xShug0 commented Jul 15, 2026

Copy link
Copy Markdown
Owner

@IIIIIllllIIIIIlllll Sorry I missed your new updates. Great work!

I've seen many Reddit users asking about running these models on ROCm, so your PR is really important for closing a major gap. I'm curious, though, can't the Python implementations run on ROCm?

The assumption that “if it works for llama.cpp, it should work for audio.cpp” is generally correct. However, the audio-model ecosystem is much messier, while LLM architectures are relatively standardized. Some GGML operations used by audio models may be supported on CUDA but unavailable on Vulkan, Metal, or other backends. In some cases, I have to modify GGML to add the missing backend support. These issues often only appear at runtime.

@0xShug0 0xShug0 added enhancement New feature or request help wanted Extra attention is needed feature labels Jul 15, 2026
@0xShug0

0xShug0 commented Jul 15, 2026

Copy link
Copy Markdown
Owner

@IIIIIllllIIIIIlllll I called for help on reddit and hopefully more people can help with testing the model behaviors on ROCm.

@0xShug0 0xShug0 removed the help wanted Extra attention is needed label Jul 15, 2026
@IIIIIllllIIIIIlllll

Copy link
Copy Markdown
Author

@IIIIIllllIIIIIlllll Sorry I missed your new updates. Great work!

I've seen many Reddit users asking about running these models on ROCm, so your PR is really important for closing a major gap. I'm curious, though, can't the Python implementations run on ROCm?

The assumption that “if it works for llama.cpp, it should work for audio.cpp” is generally correct. However, the audio-model ecosystem is much messier, while LLM architectures are relatively standardized. Some GGML operations used by audio models may be supported on CUDA but unavailable on Vulkan, Metal, or other backends. In some cases, I have to modify GGML to add the missing backend support. These issues often only appear at runtime.

AMD GPUs have many compatibility issues and are not as simple and easy to use as CUDA.

Therefore, your project is of great value to AMD users.

@0xShug0

0xShug0 commented Jul 17, 2026

Copy link
Copy Markdown
Owner

@IIIIIllllIIIIIlllll Just to let you know, I’m currently upgrading the vendored GGML from v0.12 to upstream v0.16. It brings a decent performance boost for some models and better support for other backends.

Another user asked about ROCm support today. Looking forward to your update and please keep me posted!

- ggml-hip: route all cuBLAS-equivalent GEMM through hipBLASLt
  (new GGML_HIP_HIPBLASLT option, default ON, falls back to hipBLAS
  when the package is missing). hipBLASLt ships kernels for arches
  rocBLAS lacks on Windows (notably gfx1103 / Radeon 780M). Handles
  legacy hipblasDatatype_t vs hipDataType numbering on ROCm < 6.5,
  6.x and 7.x. Pointer-array batched GEMM is emulated per batch
  element. Verified against CPU reference on gfx1103/ROCm 6.4.
- Forward ENGINE_ENABLE_CUDA_GRAPHS to GGML_HIP_GRAPHS so graphs can
  be disabled on memory-constrained iGPUs (per-graph VRAM reserves
  caused OOM on the second request).
- Add scripts/build_windows_hip.ps1: one-shot Windows HIP build
  (auto-detects ROCm, GPU targets, cmake, ninja; graphs OFF and
  NO_VMM ON by default).
- Add Hip case to ace_step planner backend switch.
- Fix moss_tts_local parity tests for the TensorSource constructor
  API (codec_{encode,decode,dequant}_parity build again).
- Update docs/HIP.md: hipBLASLt path, support matrix, Windows build
  instructions, verification checklist.
@IIIIIllllIIIIIlllll

Copy link
Copy Markdown
Author

Today I gave the popular Kimi K3 model a try, asking it to help me continue optimizing the ROCm backend. The process was painfully slow and tormented me for quite a while. Anyway, the ROCm backend can now be compiled on Windows — my 780M iGPU can run Index-TT2 without issues, and everything works fine on Linux as well. More testing… to be continued tomorrow.

@IIIIIllllIIIIIlllll

IIIIIllllIIIIIlllll commented Jul 19, 2026

Copy link
Copy Markdown
Author

ROCm-7.14
Strix Halo

Test for MOSS-TTS-Local-Transformer-v1.5

{
    "model": "moss-tts-local", 
    "input": "Hey, you. You’re finally awake. You were trying to cross the border, right? Walked right into that Imperial ambush, same as us, and that thief over there.", 
    "voice_ref": "/home/mark/test.wav"
}

Time consuming:
13.46s

Result:
8s
moss-tts.wav

Test for Index-TTS2

{
    "model": "index-tts2", 
    "input": "Hey, you. You’re finally awake. You were trying to cross the border, right? Walked right into that Imperial ambush, same as us, and that thief over there.", 
    "voice_ref": "/home/mark/test.wav"
}

Time consuming:
28.61s

Result:
9s
index-tts2.wav

Test for Qwen3-TTS-12Hz-1.7B-CustomVoice

{
    "model": "qwen3-tts-custom-voice", 
    "input": "Hey, you. You’re finally awake. You were trying to cross the border, right? Walked right into that Imperial ambush, same as us, and that thief over there.", 
    "voice": "Vivian", 
    "instructions": "normal"
}

Time consuming:
11.16s

Result:
12s
qwen3-tts-custom-voice.wav

Test for Qwen3-ASR-0.6B & Qwen3-ASR-1.7B

Input: qwen3-tts-custom-voice.wav

Command: ./audiocpp_cli --task asr --family qwen3_asr --model /home/mark/App/models/Qwen3-ASR-1.7B --backend hip --audio /home/mark/qwen3-tts-custom-voice.wav --text "" --text-out transcript.txt --log

Qwen3-ASR-0.6B: ~12s audio transcribed in 1.17s
Qwen3-ASR-1.7B: ~12s audio transcribed in 1.57s

@0xShug0

0xShug0 commented Jul 19, 2026

Copy link
Copy Markdown
Owner

@IIIIIllllIIIIIlllll Thank you for testing! IndexTTS2 looks very slow on ROCm. I’m starting to wonder whether the CPU might actually be faster...Let me think about how to debug this without ROCm machine.

I’m ready to merge your PR whenever you’re ready. You can just test whichever models you’re interested in. Please don’t feel pressured to cover all models --- the tests you’ve done are already extremely valuable.

@IIIIIllllIIIIIlllll

Copy link
Copy Markdown
Author

@0xShug0 Thank you for your kind words! The current issue is that the ROCm backend hasn't received any user feedback yet, and my own hardware doesn't meet the requirements for testing. If someone could compile and run it on Windows with a regular consumer-grade GPU, that would pretty much solve the problem.

On a side note, I haven't found any optimization solutions for IndexTTS2, but ROCm should still be much faster than CPU in the end :(

@0xShug0

0xShug0 commented Jul 22, 2026

Copy link
Copy Markdown
Owner

@IIIIIllllIIIIIlllll I added a unit test conv_lowering_matrix_test that could be useful for debugging perf issues.

cmake -S . -B build/debug \
  -DCMAKE_BUILD_TYPE=Debug \
  -DENGINE_BUILD_TESTS=ON \
  -DENGINE_ENABLE_HIP=ON \
  -DENGINE_ENABLE_CUDA=OFF

cmake --build build/debug --target conv_lowering_matrix_test -j$(nproc)

./build/debug/bin/conv_lowering_matrix_test

It should print something like (in your case backend should be hip)

module case candidate backend status shape avg_ms max_abs_vs_cpu_ref mean_abs_vs_cpu_ref cosine_vs_cpu_ref
Conv1dModule citrinet_like_large_regular native cuda ok [1, 256, 256] 1.0262 1.340e-05 2.295e-06 0.999999973
Conv1dModule citrinet_like_large_regular conv2d_normal cuda ok [1, 256, 256] 0.0274 1.340e-05 2.295e-06 0.999999973
Conv1dModule citrinet_like_large_regular conv2d_direct cuda ok [1, 256, 256] 0.0710 3.166e-08 3.874e-09 1.000000000
DepthwiseConv1dModule conformer_like_depthwise dw2d_direct cuda ok [1, 256, 192] 0.0202 3.725e-09 1.057e-10 1.000000000
DepthwiseConv1dModule conformer_like_depthwise native_1d_dw cuda ok [1, 256, 192] 0.0440 3.725e-09 2.778e-10 1.000000000
PointwiseConv1dModule conformer_projection conv1d_kernel1 cuda ok [1, 512, 192] 0.0229 4.776e-06 9.221e-07 0.999999980
PointwiseConv1dModule conformer_projection linear_matmul cuda ok [1, 512, 192] 0.0198 4.776e-06 9.221e-07 0.999999980
ConvTranspose1dModule qwen3_like_stride5_padding0 native_direct cuda ok [1, 128, 485] 0.4911 1.863e-09 1.967e-10 1.000000000
ConvTranspose1dModule qwen3_like_stride5_padding0 matmul_col2im cuda ok [1, 128, 485] 0.0277 3.693e-06 6.593e-07 0.999999985

If you share the output from the unit test I may be able to find the root cause of the IndexTTS performance issue.

@IIIIIllllIIIIIlllll

Copy link
Copy Markdown
Author

@0xShug0 I just execute 'conv_lowering_matrix_test', here is the result.

module case candidate backend status shape avg_ms max_abs_vs_cpu_ref mean_abs_vs_cpu_ref cosine_vs_cpu_ref
Conv1dModule citrinet_like_large_regular native cpu ok [1, 256, 256] 0.2327 0.000e+00 0.000e+00 1.000000000
Conv1dModule citrinet_like_large_regular conv2d_normal cpu ok [1, 256, 256] 0.2375 0.000e+00 0.000e+00 1.000000000
Conv1dModule citrinet_like_large_regular conv2d_direct cpu ok [1, 256, 256] 0.3169 0.000e+00 0.000e+00 1.000000000
Conv1dModule citrinet_like_large_regular native cuda ok [1, 256, 256] 0.1591 2.992e-08 3.836e-09 1.000000000
Conv1dModule citrinet_like_large_regular conv2d_normal cuda ok [1, 256, 256] 0.1281 2.992e-08 3.836e-09 1.000000000
Conv1dModule citrinet_like_large_regular conv2d_direct cuda ok [1, 256, 256] 0.2464 3.166e-08 3.874e-09 1.000000000
Conv1dModule citrinet_like_large_regular native hip ok [1, 256, 256] 0.0954 2.992e-08 3.836e-09 1.000000000
Conv1dModule citrinet_like_large_regular conv2d_normal hip ok [1, 256, 256] 0.0926 2.992e-08 3.836e-09 1.000000000
Conv1dModule citrinet_like_large_regular conv2d_direct hip ok [1, 256, 256] 0.2313 3.166e-08 3.874e-09 1.000000000
Conv1dModule bigvgan_like_resblock native cpu ok [1, 192, 384] 0.4739 0.000e+00 0.000e+00 1.000000000
Conv1dModule bigvgan_like_resblock conv2d_normal cpu ok [1, 192, 384] 0.4836 0.000e+00 0.000e+00 1.000000000
Conv1dModule bigvgan_like_resblock conv2d_direct cpu ok [1, 192, 384] 0.4053 0.000e+00 0.000e+00 1.000000000
Conv1dModule bigvgan_like_resblock native cuda ok [1, 192, 384] 0.1057 7.730e-08 8.944e-09 1.000000000
Conv1dModule bigvgan_like_resblock conv2d_normal cuda ok [1, 192, 384] 0.1111 7.730e-08 8.944e-09 1.000000000
Conv1dModule bigvgan_like_resblock conv2d_direct cuda ok [1, 192, 384] 0.3837 7.730e-08 8.944e-09 1.000000000
Conv1dModule bigvgan_like_resblock native hip ok [1, 192, 384] 0.1043 7.730e-08 8.944e-09 1.000000000
Conv1dModule bigvgan_like_resblock conv2d_normal hip ok [1, 192, 384] 0.1095 7.730e-08 8.944e-09 1.000000000
Conv1dModule bigvgan_like_resblock conv2d_direct hip ok [1, 192, 384] 0.3808 7.730e-08 8.944e-09 1.000000000
Conv1dModule batched_stride_regular native cpu ok [2, 128, 80] 0.0956 0.000e+00 0.000e+00 1.000000000
Conv1dModule batched_stride_regular conv2d_normal cpu ok [2, 128, 80] 0.0889 0.000e+00 0.000e+00 1.000000000
Conv1dModule batched_stride_regular conv2d_direct cpu ok [2, 128, 80] 0.0581 0.000e+00 0.000e+00 1.000000000
Conv1dModule batched_stride_regular native cuda ok [2, 128, 80] 0.0847 1.304e-08 2.207e-09 1.000000000
Conv1dModule batched_stride_regular conv2d_normal cuda ok [2, 128, 80] 0.0612 1.304e-08 2.207e-09 1.000000000
Conv1dModule batched_stride_regular conv2d_direct cuda ok [2, 128, 80] 0.0693 1.304e-08 2.207e-09 1.000000000
Conv1dModule batched_stride_regular native hip ok [2, 128, 80] 0.0689 1.304e-08 2.207e-09 1.000000000
Conv1dModule batched_stride_regular conv2d_normal hip ok [2, 128, 80] 0.0502 1.304e-08 2.207e-09 1.000000000
Conv1dModule batched_stride_regular conv2d_direct hip ok [2, 128, 80] 0.0691 1.304e-08 2.207e-09 1.000000000
Conv1dModule dilated_regular native cpu ok [1, 128, 192] 0.1667 0.000e+00 0.000e+00 1.000000000
Conv1dModule dilated_regular conv2d_normal cpu ok [1, 128, 192] 0.2090 0.000e+00 0.000e+00 1.000000000
Conv1dModule dilated_regular conv2d_direct cpu ok [1, 128, 192] 0.0476 0.000e+00 0.000e+00 1.000000000
Conv1dModule dilated_regular native cuda ok [1, 128, 192] 0.0420 2.678e-09 3.681e-10 1.000000000
Conv1dModule dilated_regular conv2d_normal cuda ok [1, 128, 192] 0.0469 2.678e-09 3.681e-10 1.000000000
Conv1dModule dilated_regular conv2d_direct cuda ok [1, 128, 192] 0.0891 3.958e-09 3.819e-10 1.000000000
Conv1dModule dilated_regular native hip ok [1, 128, 192] 0.0428 2.678e-09 3.681e-10 1.000000000
Conv1dModule dilated_regular conv2d_normal hip ok [1, 128, 192] 0.0508 2.678e-09 3.681e-10 1.000000000
Conv1dModule dilated_regular conv2d_direct hip ok [1, 128, 192] 0.0883 3.958e-09 3.819e-10 1.000000000
Conv2dModule spectrogram_small_kernel im2col_matmul cpu ok [1, 128, 20, 160] 1.3617 0.000e+00 0.000e+00 1.000000000
Conv2dModule spectrogram_small_kernel direct cpu ok [1, 128, 20, 160] 1.3871 0.000e+00 0.000e+00 1.000000000
Conv2dModule spectrogram_small_kernel im2col_matmul cuda ok [1, 128, 20, 160] 0.2041 2.235e-08 2.511e-09 1.000000000
Conv2dModule spectrogram_small_kernel direct cuda ok [1, 128, 20, 160] 0.9996 2.421e-08 2.535e-09 1.000000000
Conv2dModule spectrogram_small_kernel im2col_matmul hip ok [1, 128, 20, 160] 0.2011 2.235e-08 2.511e-09 1.000000000
Conv2dModule spectrogram_small_kernel direct hip ok [1, 128, 20, 160] 1.0004 2.421e-08 2.535e-09 1.000000000
Conv2dModule conv1d_lowered_shape im2col_matmul cpu ok [1, 256, 1, 384] 0.8973 0.000e+00 0.000e+00 1.000000000
Conv2dModule conv1d_lowered_shape direct cpu ok [1, 256, 1, 384] 0.7803 0.000e+00 0.000e+00 1.000000000
Conv2dModule conv1d_lowered_shape im2col_matmul cuda ok [1, 256, 1, 384] 0.1466 3.912e-08 5.383e-09 1.000000000
Conv2dModule conv1d_lowered_shape direct cuda ok [1, 256, 1, 384] 0.6629 4.750e-08 5.454e-09 1.000000000
Conv2dModule conv1d_lowered_shape im2col_matmul hip ok [1, 256, 1, 384] 0.1405 3.912e-08 5.383e-09 1.000000000
Conv2dModule conv1d_lowered_shape direct hip ok [1, 256, 1, 384] 0.6570 4.750e-08 5.454e-09 1.000000000
Conv2dModule batched_feature_map im2col_matmul cpu ok [2, 64, 12, 48] 0.1785 0.000e+00 0.000e+00 1.000000000
Conv2dModule batched_feature_map direct cpu ok [2, 64, 12, 48] 0.1698 0.000e+00 0.000e+00 1.000000000
Conv2dModule batched_feature_map im2col_matmul cuda ok [2, 64, 12, 48] 0.0762 3.539e-08 5.068e-09 1.000000000
Conv2dModule batched_feature_map direct cuda ok [2, 64, 12, 48] 0.1518 3.725e-08 5.142e-09 1.000000000
Conv2dModule batched_feature_map im2col_matmul hip ok [2, 64, 12, 48] 0.0838 3.539e-08 5.068e-09 1.000000000
Conv2dModule batched_feature_map direct hip ok [2, 64, 12, 48] 0.1534 3.725e-08 5.142e-09 1.000000000
DepthwiseConv1dModule conformer_like_depthwise dw2d_direct cpu ok [1, 256, 192] 0.1396 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule conformer_like_depthwise native_1d_dw cpu ok [1, 256, 192] 0.5791 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule conformer_like_depthwise dw2d_direct cuda ok [1, 256, 192] 0.0406 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule conformer_like_depthwise native_1d_dw cuda ok [1, 256, 192] 0.1554 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule conformer_like_depthwise dw2d_direct hip ok [1, 256, 192] 0.0357 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule conformer_like_depthwise native_1d_dw hip ok [1, 256, 192] 0.1506 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule tokenizer_stride_depthwise dw2d_direct cpu ok [2, 96, 128] 0.0376 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule tokenizer_stride_depthwise native_1d_dw cpu unsupported - - - - native ggml_conv_1d_dw asserts for batched rank-3 input; slice batch first
DepthwiseConv1dModule tokenizer_stride_depthwise dw2d_direct cuda ok [2, 96, 128] 0.0289 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule tokenizer_stride_depthwise native_1d_dw cuda unsupported - - - - native ggml_conv_1d_dw asserts for batched rank-3 input; slice batch first
DepthwiseConv1dModule tokenizer_stride_depthwise dw2d_direct hip ok [2, 96, 128] 0.0283 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule tokenizer_stride_depthwise native_1d_dw hip unsupported - - - - native ggml_conv_1d_dw asserts for batched rank-3 input; slice batch first
DepthwiseConv1dModule dilated_depthwise dw2d_direct cpu ok [1, 128, 160] 0.0141 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule dilated_depthwise native_1d_dw cpu ok [1, 128, 160] 0.1644 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule dilated_depthwise dw2d_direct cuda ok [1, 128, 160] 0.0199 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule dilated_depthwise native_1d_dw cuda ok [1, 128, 160] 0.0714 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule dilated_depthwise dw2d_direct hip ok [1, 128, 160] 0.0197 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule dilated_depthwise native_1d_dw hip ok [1, 128, 160] 0.0551 0.000e+00 0.000e+00 1.000000000
PointwiseConv1dModule conformer_projection conv1d_kernel1 cpu ok [1, 512, 192] 0.2804 0.000e+00 0.000e+00 1.000000000
PointwiseConv1dModule conformer_projection linear_matmul cpu ok [1, 512, 192] 0.0560 0.000e+00 0.000e+00 1.000000000
PointwiseConv1dModule conformer_projection conv1d_kernel1 cuda ok [1, 512, 192] 0.0661 2.328e-09 3.706e-10 1.000000000
PointwiseConv1dModule conformer_projection linear_matmul cuda ok [1, 512, 192] 0.0617 2.328e-09 3.730e-10 1.000000000
PointwiseConv1dModule conformer_projection conv1d_kernel1 hip ok [1, 512, 192] 0.0618 2.328e-09 3.706e-10 1.000000000
PointwiseConv1dModule conformer_projection linear_matmul hip ok [1, 512, 192] 0.0607 2.328e-09 3.730e-10 1.000000000
PointwiseConv1dModule batched_token_projection conv1d_kernel1 cpu ok [2, 384, 160] 0.3885 0.000e+00 0.000e+00 1.000000000
PointwiseConv1dModule batched_token_projection linear_matmul cpu ok [2, 384, 160] 0.0563 0.000e+00 0.000e+00 1.000000000
PointwiseConv1dModule batched_token_projection conv1d_kernel1 cuda ok [2, 384, 160] 0.0790 1.863e-09 1.344e-10 1.000000000
PointwiseConv1dModule batched_token_projection linear_matmul cuda ok [2, 384, 160] 0.0577 1.164e-09 1.389e-10 1.000000000
PointwiseConv1dModule batched_token_projection conv1d_kernel1 hip ok [2, 384, 160] 0.0789 1.863e-09 1.344e-10 1.000000000
PointwiseConv1dModule batched_token_projection linear_matmul hip ok [2, 384, 160] 0.0573 1.164e-09 1.389e-10 1.000000000
PointwiseConv1dModule vocoder_channel_mix conv1d_kernel1 cpu ok [1, 192, 384] 0.2952 0.000e+00 0.000e+00 1.000000000
PointwiseConv1dModule vocoder_channel_mix linear_matmul cpu ok [1, 192, 384] 0.0412 0.000e+00 0.000e+00 1.000000000
PointwiseConv1dModule vocoder_channel_mix conv1d_kernel1 cuda ok [1, 192, 384] 0.0483 1.630e-09 1.818e-10 1.000000000
PointwiseConv1dModule vocoder_channel_mix linear_matmul cuda ok [1, 192, 384] 0.0469 1.397e-09 1.660e-10 1.000000000
PointwiseConv1dModule vocoder_channel_mix conv1d_kernel1 hip ok [1, 192, 384] 0.0462 1.630e-09 1.818e-10 1.000000000
PointwiseConv1dModule vocoder_channel_mix linear_matmul hip ok [1, 192, 384] 0.0475 1.397e-09 1.660e-10 1.000000000
DepthwiseConv2dModule depthwise_1d_lowered_shape direct cpu ok [1, 192, 1, 384] 0.1087 0.000e+00 0.000e+00 1.000000000
DepthwiseConv2dModule depthwise_1d_lowered_shape im2col_matmul cpu unsupported - - - - conv_lowering_matrix contains unsupported backend op 'MUL_MAT' at node 5 tensor 'node_5'
DepthwiseConv2dModule depthwise_1d_lowered_shape direct cuda ok [1, 192, 1, 384] 0.0417 0.000e+00 0.000e+00 1.000000000
DepthwiseConv2dModule depthwise_1d_lowered_shape im2col_matmul cuda unsupported - - - - conv_lowering_matrix contains unsupported backend op 'MUL_MAT' at node 5 tensor 'node_5'
DepthwiseConv2dModule depthwise_1d_lowered_shape direct hip ok [1, 192, 1, 384] 0.0352 0.000e+00 0.000e+00 1.000000000
DepthwiseConv2dModule depthwise_1d_lowered_shape im2col_matmul hip unsupported - - - - conv_lowering_matrix contains unsupported backend op 'MUL_MAT' at node 5 tensor 'node_5'
DepthwiseConv2dModule image_depthwise_small direct cpu ok [1, 64, 24, 80] 0.2416 0.000e+00 0.000e+00 1.000000000
DepthwiseConv2dModule image_depthwise_small im2col_matmul cpu unsupported - - - - conv_lowering_matrix contains unsupported backend op 'MUL_MAT' at node 5 tensor 'node_5'
DepthwiseConv2dModule image_depthwise_small direct cuda ok [1, 64, 24, 80] 0.0477 0.000e+00 0.000e+00 1.000000000
DepthwiseConv2dModule image_depthwise_small im2col_matmul cuda unsupported - - - - conv_lowering_matrix contains unsupported backend op 'MUL_MAT' at node 5 tensor 'node_5'
DepthwiseConv2dModule image_depthwise_small direct hip ok [1, 64, 24, 80] 0.0480 0.000e+00 0.000e+00 1.000000000
DepthwiseConv2dModule image_depthwise_small im2col_matmul hip unsupported - - - - conv_lowering_matrix contains unsupported backend op 'MUL_MAT' at node 5 tensor 'node_5'
ConvTranspose1dModule qwen3_like_stride5_padding0 native_direct cpu ok [1, 128, 485] 1.1582 0.000e+00 0.000e+00 1.000000000
ConvTranspose1dModule qwen3_like_stride5_padding0 matmul_col2im cpu unsupported - - - - current ggml CPU backend aborts for COL2IM_1D
ConvTranspose1dModule qwen3_like_stride5_padding0 native_direct cuda ok [1, 128, 485] 1.1360 1.863e-09 1.967e-10 1.000000000
ConvTranspose1dModule qwen3_like_stride5_padding0 matmul_col2im cuda ok [1, 128, 485] 0.1072 1.048e-09 1.590e-10 1.000000000
ConvTranspose1dModule qwen3_like_stride5_padding0 native_direct hip ok [1, 128, 485] 1.1365 1.863e-09 1.967e-10 1.000000000
ConvTranspose1dModule qwen3_like_stride5_padding0 matmul_col2im hip ok [1, 128, 485] 0.0975 1.048e-09 1.590e-10 1.000000000
ConvTranspose1dModule vocoder_stride2_padding1 native_direct cpu unsupported - - - - native ggml_conv_transpose_1d supports only padding=0 and dilation=1
ConvTranspose1dModule vocoder_stride2_padding1 matmul_col2im cpu unsupported - - - - current ggml CPU backend aborts for COL2IM_1D
ConvTranspose1dModule vocoder_stride2_padding1 native_direct cuda unsupported - - - - native ggml_conv_transpose_1d supports only padding=0 and dilation=1
ConvTranspose1dModule vocoder_stride2_padding1 matmul_col2im cuda ok [1, 96, 384] 0.0648 - - -
ConvTranspose1dModule vocoder_stride2_padding1 native_direct hip unsupported - - - - native ggml_conv_transpose_1d supports only padding=0 and dilation=1
ConvTranspose1dModule vocoder_stride2_padding1 matmul_col2im hip ok [1, 96, 384] 0.0649 - - -
ConvTranspose1dModule batched_stride2_no_bias native_direct cpu ok [2, 128, 192] 0.1324 0.000e+00 0.000e+00 1.000000000
ConvTranspose1dModule batched_stride2_no_bias matmul_col2im cpu unsupported - - - - current ggml CPU backend aborts for COL2IM_1D
ConvTranspose1dModule batched_stride2_no_bias native_direct cuda ok [2, 128, 192] 0.1425 6.694e-10 1.146e-10 1.000000000
ConvTranspose1dModule batched_stride2_no_bias matmul_col2im cuda ok [2, 128, 192] 0.0600 8.149e-10 1.168e-10 1.000000000
ConvTranspose1dModule batched_stride2_no_bias native_direct hip ok [2, 128, 192] 0.1419 6.694e-10 1.146e-10 1.000000000
ConvTranspose1dModule batched_stride2_no_bias matmul_col2im hip ok [2, 128, 192] 0.0596 8.149e-10 1.168e-10 1.000000000
ConvTranspose1dModule dilated_unsupported_probe native_direct cpu unsupported - - - - native ggml_conv_transpose_1d supports only padding=0 and dilation=1
ConvTranspose1dModule dilated_unsupported_probe matmul_col2im cpu unsupported - - - - current ggml CPU backend aborts for COL2IM_1D
ConvTranspose1dModule dilated_unsupported_probe native_direct cuda unsupported - - - - native ggml_conv_transpose_1d supports only padding=0 and dilation=1
ConvTranspose1dModule dilated_unsupported_probe matmul_col2im cuda unsupported - - - - col2im lowering currently supports only dilation=1
ConvTranspose1dModule dilated_unsupported_probe native_direct hip unsupported - - - - native ggml_conv_transpose_1d supports only padding=0 and dilation=1
ConvTranspose1dModule dilated_unsupported_probe matmul_col2im hip unsupported - - - - col2im lowering currently supports only dilation=1

@0xShug0

0xShug0 commented Jul 23, 2026

Copy link
Copy Markdown
Owner

@IIIIIllllIIIIIlllll Could you try this patch? pinned to commit 615971e
You can enable logging and compare how the timing of each component changes before and after the patch.

indextts2_hip_pr48_615971e.patch

@IIIIIllllIIIIIlllll

Copy link
Copy Markdown
Author

@0xShug0 I think I'm not mistaken.
mark@MarkPC:~/App/audio.cpp-dev-rocm$ ./build_hip/bin/model_perf --backend cpu --threads 16 --id index_tts2

{"backend":"cpu","device":0,"threads":16,"cases":[{"id":"index_tts2","family":"index_tts2","case_id":"index_tts2_voice_clone","request_id":"clone","task":"clon","mode":"offline","cold":{"wall_ms":[44575.9,40399.7,40401.8],"average_wall_ms":41792.5,"duration_sec":8.62621,"rtf":4.84482},"warm":{"wall_ms":[35957.4,34474.1,34534.3],"average_wall_ms":34988.6,"duration_sec":8.62621,"rtf":4.05608}}]}

mark@MarkPC:~/App/audio.cpp-dev-rocm$ ./build_hip/bin/model_perf --backend hip --threads 16 --id index_tts2

{"backend":"hip","device":0,"threads":16,"cases":[{"id":"index_tts2","family":"index_tts2","case_id":"index_tts2_voice_clone","request_id":"clone","task":"clon","mode":"offline","cold":{"wall_ms":[26336.4,25452.8,24666],"average_wall_ms":25485.1,"duration_sec":8.62621,"rtf":2.95438},"warm":{"wall_ms":[20315.4,19934.9,19970.5],"average_wall_ms":20073.6,"duration_sec":8.62621,"rtf":2.32705}}]}

@fedeizzo

Copy link
Copy Markdown
Contributor

👋 Hey, I'm trying a rocm port on my side as well. I started from scratch and I'm stealing some ideas from this PR

So far these are my results

Metric / Stage Vulkan Backend ROCm / HIP Backend Speedup
Device Recognized AMD Radeon 8060S (RADV) AMD Radeon 8060S (gfx1151)
Talker Total Time 36,627 ms 4,306 ms ~8.50x Faster
Code Predictor Graph Compute 6,509 ms 2,208 ms ~2.95x Faster
Speech Decoder Compute 5,765 ms 4,245 ms ~1.36x Faster
Total Session Wall Clock 45,587 ms 11,780 ms ~3.87x Faster

I'm comparing generated wav files as well and diffs are in the margin of randomness.

It's still the beginning, I have several ideas to add here and there in the codebase, I'm still navigating it to understand it. As soon as I have something decent I can push and we can try to combine our PRs (if it makes sense)

@IIIIIllllIIIIIlllll

Copy link
Copy Markdown
Author

@fedeizzo Welcome aboard – it's great to have someone more professional on this! If you're willing to take over, that would be fantastic. Feel free to close my PR anytime. I'm not comfortable with these AI-generated codes since I lack the necessary expertise.

@wizardeur

Copy link
Copy Markdown

I ran the conv_lowering_matrix_test on GFX1100 (7900XTX):

module case candidate backend status shape avg_ms max_abs_vs_cpu_ref mean_abs_vs_cpu_ref cosine_vs_cpu_ref
Conv1dModule citrinet_like_large_regular native cpu ok [1, 256, 256] 0.4103 0.000e+00 0.000e+00 1.000000000
Conv1dModule citrinet_like_large_regular conv2d_normal cpu ok [1, 256, 256] 0.4443 0.000e+00 0.000e+00 1.000000000
Conv1dModule citrinet_like_large_regular conv2d_direct cpu ok [1, 256, 256] 0.5976 0.000e+00 0.000e+00 1.000000000
Conv1dModule citrinet_like_large_regular native cuda ok [1, 256, 256] 0.2517 3.912e-08 4.455e-09 1.000000000
Conv1dModule citrinet_like_large_regular conv2d_normal cuda ok [1, 256, 256] 0.0970 3.912e-08 4.455e-09 1.000000000
Conv1dModule citrinet_like_large_regular conv2d_direct cuda ok [1, 256, 256] 0.1634 3.166e-08 3.874e-09 1.000000000
Conv1dModule citrinet_like_large_regular native hip ok [1, 256, 256] 0.0870 3.912e-08 4.455e-09 1.000000000
Conv1dModule citrinet_like_large_regular conv2d_normal hip ok [1, 256, 256] 0.0908 3.912e-08 4.455e-09 1.000000000
Conv1dModule citrinet_like_large_regular conv2d_direct hip ok [1, 256, 256] 0.1596 3.166e-08 3.874e-09 1.000000000
Conv1dModule bigvgan_like_resblock native cpu ok [1, 192, 384] 0.8764 0.000e+00 0.000e+00 1.000000000
Conv1dModule bigvgan_like_resblock conv2d_normal cpu ok [1, 192, 384] 1.1064 0.000e+00 0.000e+00 1.000000000
Conv1dModule bigvgan_like_resblock conv2d_direct cpu ok [1, 192, 384] 0.9112 0.000e+00 0.000e+00 1.000000000
Conv1dModule bigvgan_like_resblock native cuda ok [1, 192, 384] 0.1068 7.637e-08 9.058e-09 1.000000000
Conv1dModule bigvgan_like_resblock conv2d_normal cuda ok [1, 192, 384] 0.1085 7.637e-08 9.058e-09 1.000000000
Conv1dModule bigvgan_like_resblock conv2d_direct cuda ok [1, 192, 384] 0.2378 7.730e-08 8.944e-09 1.000000000
Conv1dModule bigvgan_like_resblock native hip ok [1, 192, 384] 0.1026 7.637e-08 9.058e-09 1.000000000
Conv1dModule bigvgan_like_resblock conv2d_normal hip ok [1, 192, 384] 0.1077 7.637e-08 9.058e-09 1.000000000
Conv1dModule bigvgan_like_resblock conv2d_direct hip ok [1, 192, 384] 0.2376 7.730e-08 8.944e-09 1.000000000
Conv1dModule batched_stride_regular native cpu ok [2, 128, 80] 0.2170 0.000e+00 0.000e+00 1.000000000
Conv1dModule batched_stride_regular conv2d_normal cpu ok [2, 128, 80] 0.1965 0.000e+00 0.000e+00 1.000000000
Conv1dModule batched_stride_regular conv2d_direct cpu ok [2, 128, 80] 0.1519 0.000e+00 0.000e+00 1.000000000
Conv1dModule batched_stride_regular native cuda ok [2, 128, 80] 0.0881 2.142e-08 2.334e-09 1.000000000
Conv1dModule batched_stride_regular conv2d_normal cuda ok [2, 128, 80] 0.0741 2.142e-08 2.334e-09 1.000000000
Conv1dModule batched_stride_regular conv2d_direct cuda ok [2, 128, 80] 0.0789 1.304e-08 2.207e-09 1.000000000
Conv1dModule batched_stride_regular native hip ok [2, 128, 80] 0.0796 2.142e-08 2.334e-09 1.000000000
Conv1dModule batched_stride_regular conv2d_normal hip ok [2, 128, 80] 0.0667 2.142e-08 2.334e-09 1.000000000
Conv1dModule batched_stride_regular conv2d_direct hip ok [2, 128, 80] 0.0784 1.304e-08 2.207e-09 1.000000000
Conv1dModule dilated_regular native cpu ok [1, 128, 192] 0.2868 0.000e+00 0.000e+00 1.000000000
Conv1dModule dilated_regular conv2d_normal cpu ok [1, 128, 192] 0.3234 0.000e+00 0.000e+00 1.000000000
Conv1dModule dilated_regular conv2d_direct cpu ok [1, 128, 192] 0.1369 0.000e+00 0.000e+00 1.000000000
Conv1dModule dilated_regular native cuda ok [1, 128, 192] 0.0726 4.424e-09 4.048e-10 1.000000000
Conv1dModule dilated_regular conv2d_normal cuda ok [1, 128, 192] 0.0747 4.424e-09 4.048e-10 1.000000000
Conv1dModule dilated_regular conv2d_direct cuda ok [1, 128, 192] 0.0898 3.958e-09 3.819e-10 1.000000000
Conv1dModule dilated_regular native hip ok [1, 128, 192] 0.0694 4.424e-09 4.048e-10 1.000000000
Conv1dModule dilated_regular conv2d_normal hip ok [1, 128, 192] 0.0748 4.424e-09 4.048e-10 1.000000000
Conv1dModule dilated_regular conv2d_direct hip ok [1, 128, 192] 0.0900 3.958e-09 3.819e-10 1.000000000
Conv2dModule spectrogram_small_kernel im2col_matmul cpu ok [1, 128, 20, 160] 3.1690 0.000e+00 0.000e+00 1.000000000
Conv2dModule spectrogram_small_kernel direct cpu ok [1, 128, 20, 160] 3.0238 0.000e+00 0.000e+00 1.000000000
Conv2dModule spectrogram_small_kernel im2col_matmul cuda ok [1, 128, 20, 160] 0.2523 2.608e-08 2.508e-09 1.000000000
Conv2dModule spectrogram_small_kernel direct cuda ok [1, 128, 20, 160] 0.4973 2.421e-08 2.535e-09 1.000000000
Conv2dModule spectrogram_small_kernel im2col_matmul hip ok [1, 128, 20, 160] 0.2433 2.608e-08 2.508e-09 1.000000000
Conv2dModule spectrogram_small_kernel direct hip ok [1, 128, 20, 160] 0.4909 2.421e-08 2.535e-09 1.000000000
Conv2dModule conv1d_lowered_shape im2col_matmul cpu ok [1, 256, 1, 384] 1.3331 0.000e+00 0.000e+00 1.000000000
Conv2dModule conv1d_lowered_shape direct cpu ok [1, 256, 1, 384] 1.3664 0.000e+00 0.000e+00 1.000000000
Conv2dModule conv1d_lowered_shape im2col_matmul cuda ok [1, 256, 1, 384] 0.1499 4.843e-08 5.716e-09 1.000000000
Conv2dModule conv1d_lowered_shape direct cuda ok [1, 256, 1, 384] 0.3591 4.750e-08 5.454e-09 1.000000000
Conv2dModule conv1d_lowered_shape im2col_matmul hip ok [1, 256, 1, 384] 0.1476 4.843e-08 5.716e-09 1.000000000
Conv2dModule conv1d_lowered_shape direct hip ok [1, 256, 1, 384] 0.3591 4.750e-08 5.454e-09 1.000000000
Conv2dModule batched_feature_map im2col_matmul cpu ok [2, 64, 12, 48] 0.5015 0.000e+00 0.000e+00 1.000000000
Conv2dModule batched_feature_map direct cpu ok [2, 64, 12, 48] 0.5529 0.000e+00 0.000e+00 1.000000000
Conv2dModule batched_feature_map im2col_matmul cuda ok [2, 64, 12, 48] 0.0746 3.539e-08 5.049e-09 1.000000000
Conv2dModule batched_feature_map direct cuda ok [2, 64, 12, 48] 0.1079 3.725e-08 5.142e-09 1.000000000
Conv2dModule batched_feature_map im2col_matmul hip ok [2, 64, 12, 48] 0.0725 3.539e-08 5.049e-09 1.000000000
Conv2dModule batched_feature_map direct hip ok [2, 64, 12, 48] 0.1078 3.725e-08 5.142e-09 1.000000000
DepthwiseConv1dModule conformer_like_depthwise dw2d_direct cpu ok [1, 256, 192] 0.2696 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule conformer_like_depthwise native_1d_dw cpu ok [1, 256, 192] 1.0455 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule conformer_like_depthwise dw2d_direct cuda ok [1, 256, 192] 0.0560 3.725e-09 1.057e-10 1.000000000
DepthwiseConv1dModule conformer_like_depthwise native_1d_dw cuda ok [1, 256, 192] 0.0893 3.725e-09 1.057e-10 1.000000000
DepthwiseConv1dModule conformer_like_depthwise dw2d_direct hip ok [1, 256, 192] 0.0478 3.725e-09 1.057e-10 1.000000000
DepthwiseConv1dModule conformer_like_depthwise native_1d_dw hip ok [1, 256, 192] 0.0884 3.725e-09 1.057e-10 1.000000000
DepthwiseConv1dModule tokenizer_stride_depthwise dw2d_direct cpu ok [2, 96, 128] 0.0904 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule tokenizer_stride_depthwise native_1d_dw cpu unsupported - - - - native ggml_conv_1d_dw asserts for batched rank-3 input; slice batch first
DepthwiseConv1dModule tokenizer_stride_depthwise dw2d_direct cuda ok [2, 96, 128] 0.0447 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule tokenizer_stride_depthwise native_1d_dw cuda unsupported - - - - native ggml_conv_1d_dw asserts for batched rank-3 input; slice batch first
DepthwiseConv1dModule tokenizer_stride_depthwise dw2d_direct hip ok [2, 96, 128] 0.0434 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule tokenizer_stride_depthwise native_1d_dw hip unsupported - - - - native ggml_conv_1d_dw asserts for batched rank-3 input; slice batch first
DepthwiseConv1dModule dilated_depthwise dw2d_direct cpu ok [1, 128, 160] 0.0219 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule dilated_depthwise native_1d_dw cpu ok [1, 128, 160] 0.2605 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule dilated_depthwise dw2d_direct cuda ok [1, 128, 160] 0.0361 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule dilated_depthwise native_1d_dw cuda ok [1, 128, 160] 0.0536 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule dilated_depthwise dw2d_direct hip ok [1, 128, 160] 0.0358 0.000e+00 0.000e+00 1.000000000
DepthwiseConv1dModule dilated_depthwise native_1d_dw hip ok [1, 128, 160] 0.0527 0.000e+00 0.000e+00 1.000000000
PointwiseConv1dModule conformer_projection conv1d_kernel1 cpu ok [1, 512, 192] 0.5764 0.000e+00 0.000e+00 1.000000000
PointwiseConv1dModule conformer_projection linear_matmul cpu ok [1, 512, 192] 0.1320 0.000e+00 0.000e+00 1.000000000
PointwiseConv1dModule conformer_projection conv1d_kernel1 cuda ok [1, 512, 192] 0.0698 2.328e-09 3.737e-10 1.000000000
PointwiseConv1dModule conformer_projection linear_matmul cuda ok [1, 512, 192] 0.0624 2.328e-09 3.732e-10 1.000000000
PointwiseConv1dModule conformer_projection conv1d_kernel1 hip ok [1, 512, 192] 0.0681 2.328e-09 3.737e-10 1.000000000
PointwiseConv1dModule conformer_projection linear_matmul hip ok [1, 512, 192] 0.0599 2.328e-09 3.732e-10 1.000000000
PointwiseConv1dModule batched_token_projection conv1d_kernel1 cpu ok [2, 384, 160] 0.7275 0.000e+00 0.000e+00 1.000000000
PointwiseConv1dModule batched_token_projection linear_matmul cpu ok [2, 384, 160] 0.1495 0.000e+00 0.000e+00 1.000000000
PointwiseConv1dModule batched_token_projection conv1d_kernel1 cuda ok [2, 384, 160] 0.0817 1.164e-09 1.381e-10 1.000000000
PointwiseConv1dModule batched_token_projection linear_matmul cuda ok [2, 384, 160] 0.0616 1.164e-09 1.379e-10 1.000000000
PointwiseConv1dModule batched_token_projection conv1d_kernel1 hip ok [2, 384, 160] 0.0835 1.164e-09 1.381e-10 1.000000000
PointwiseConv1dModule batched_token_projection linear_matmul hip ok [2, 384, 160] 0.0630 1.164e-09 1.379e-10 1.000000000
PointwiseConv1dModule vocoder_channel_mix conv1d_kernel1 cpu ok [1, 192, 384] 0.4952 0.000e+00 0.000e+00 1.000000000
PointwiseConv1dModule vocoder_channel_mix linear_matmul cpu ok [1, 192, 384] 0.1160 0.000e+00 0.000e+00 1.000000000
PointwiseConv1dModule vocoder_channel_mix conv1d_kernel1 cuda ok [1, 192, 384] 0.0523 1.979e-09 1.919e-10 1.000000000
PointwiseConv1dModule vocoder_channel_mix linear_matmul cuda ok [1, 192, 384] 0.0519 1.979e-09 1.877e-10 1.000000000
PointwiseConv1dModule vocoder_channel_mix conv1d_kernel1 hip ok [1, 192, 384] 0.0507 1.979e-09 1.919e-10 1.000000000
PointwiseConv1dModule vocoder_channel_mix linear_matmul hip ok [1, 192, 384] 0.0528 1.979e-09 1.877e-10 1.000000000
DepthwiseConv2dModule depthwise_1d_lowered_shape direct cpu ok [1, 192, 1, 384] 0.2575 0.000e+00 0.000e+00 1.000000000
DepthwiseConv2dModule depthwise_1d_lowered_shape im2col_matmul cpu unsupported - - - - conv_lowering_matrix contains unsupported backend op 'MUL_MAT' at node 5 tensor 'node_5'
DepthwiseConv2dModule depthwise_1d_lowered_shape direct cuda ok [1, 192, 1, 384] 0.0478 0.000e+00 0.000e+00 1.000000000
DepthwiseConv2dModule depthwise_1d_lowered_shape im2col_matmul cuda unsupported - - - - conv_lowering_matrix contains unsupported backend op 'MUL_MAT' at node 5 tensor 'node_5'
DepthwiseConv2dModule depthwise_1d_lowered_shape direct hip ok [1, 192, 1, 384] 0.0450 0.000e+00 0.000e+00 1.000000000
DepthwiseConv2dModule depthwise_1d_lowered_shape im2col_matmul hip unsupported - - - - conv_lowering_matrix contains unsupported backend op 'MUL_MAT' at node 5 tensor 'node_5'
DepthwiseConv2dModule image_depthwise_small direct cpu ok [1, 64, 24, 80] 0.4945 0.000e+00 0.000e+00 1.000000000
DepthwiseConv2dModule image_depthwise_small im2col_matmul cpu unsupported - - - - conv_lowering_matrix contains unsupported backend op 'MUL_MAT' at node 5 tensor 'node_5'
DepthwiseConv2dModule image_depthwise_small direct cuda ok [1, 64, 24, 80] 0.0490 0.000e+00 0.000e+00 1.000000000
DepthwiseConv2dModule image_depthwise_small im2col_matmul cuda unsupported - - - - conv_lowering_matrix contains unsupported backend op 'MUL_MAT' at node 5 tensor 'node_5'
DepthwiseConv2dModule image_depthwise_small direct hip ok [1, 64, 24, 80] 0.0509 0.000e+00 0.000e+00 1.000000000
DepthwiseConv2dModule image_depthwise_small im2col_matmul hip unsupported - - - - conv_lowering_matrix contains unsupported backend op 'MUL_MAT' at node 5 tensor 'node_5'
ConvTranspose1dModule qwen3_like_stride5_padding0 native_direct cpu ok [1, 128, 485] 1.5366 0.000e+00 0.000e+00 1.000000000
ConvTranspose1dModule qwen3_like_stride5_padding0 matmul_col2im cpu unsupported - - - - current ggml CPU backend aborts for COL2IM_1D
ConvTranspose1dModule qwen3_like_stride5_padding0 native_direct cuda ok [1, 128, 485] 0.6430 1.863e-09 1.967e-10 1.000000000
ConvTranspose1dModule qwen3_like_stride5_padding0 matmul_col2im cuda ok [1, 128, 485] 0.0968 9.313e-10 1.638e-10 1.000000000
ConvTranspose1dModule qwen3_like_stride5_padding0 native_direct hip ok [1, 128, 485] 0.6432 1.863e-09 1.967e-10 1.000000000
ConvTranspose1dModule qwen3_like_stride5_padding0 matmul_col2im hip ok [1, 128, 485] 0.0866 9.313e-10 1.638e-10 1.000000000
ConvTranspose1dModule vocoder_stride2_padding1 native_direct cpu unsupported - - - - native ggml_conv_transpose_1d supports only padding=0 and dilation=1
ConvTranspose1dModule vocoder_stride2_padding1 matmul_col2im cpu unsupported - - - - current ggml CPU backend aborts for COL2IM_1D
ConvTranspose1dModule vocoder_stride2_padding1 native_direct cuda unsupported - - - - native ggml_conv_transpose_1d supports only padding=0 and dilation=1
ConvTranspose1dModule vocoder_stride2_padding1 matmul_col2im cuda ok [1, 96, 384] 0.0631 - - -
ConvTranspose1dModule vocoder_stride2_padding1 native_direct hip unsupported - - - - native ggml_conv_transpose_1d supports only padding=0 and dilation=1
ConvTranspose1dModule vocoder_stride2_padding1 matmul_col2im hip ok [1, 96, 384] 0.0633 - - -
ConvTranspose1dModule batched_stride2_no_bias native_direct cpu ok [2, 128, 192] 0.2874 0.000e+00 0.000e+00 1.000000000
ConvTranspose1dModule batched_stride2_no_bias matmul_col2im cpu unsupported - - - - current ggml CPU backend aborts for COL2IM_1D
ConvTranspose1dModule batched_stride2_no_bias native_direct cuda ok [2, 128, 192] 0.1419 6.694e-10 1.146e-10 1.000000000
ConvTranspose1dModule batched_stride2_no_bias matmul_col2im cuda ok [2, 128, 192] 0.0749 6.112e-10 1.166e-10 1.000000000
ConvTranspose1dModule batched_stride2_no_bias native_direct hip ok [2, 128, 192] 0.1411 6.694e-10 1.146e-10 1.000000000
ConvTranspose1dModule batched_stride2_no_bias matmul_col2im hip ok [2, 128, 192] 0.0747 6.112e-10 1.166e-10 1.000000000
ConvTranspose1dModule dilated_unsupported_probe native_direct cpu unsupported - - - - native ggml_conv_transpose_1d supports only padding=0 and dilation=1
ConvTranspose1dModule dilated_unsupported_probe matmul_col2im cpu unsupported - - - - current ggml CPU backend aborts for COL2IM_1D
ConvTranspose1dModule dilated_unsupported_probe native_direct cuda unsupported - - - - native ggml_conv_transpose_1d supports only padding=0 and dilation=1
ConvTranspose1dModule dilated_unsupported_probe matmul_col2im cuda unsupported - - - - col2im lowering currently supports only dilation=1
ConvTranspose1dModule dilated_unsupported_probe native_direct hip unsupported - - - - native ggml_conv_transpose_1d supports only padding=0 and dilation=1
ConvTranspose1dModule dilated_unsupported_probe matmul_col2im hip unsupported - - - - col2im lowering currently supports only dilation=1

@hartmark

Copy link
Copy Markdown

I had to install this package on arch linux
sudo pacman -S rocm-hip-sdk

I have a Radeon RX 9060 XT

I got some errors with the build and got junie to help me out.

https://github.com/hartmark/audio.cpp/tree/fix/hip-build-rdna3

Anyone have any scripts to download models and kickstart some transcribing? 🐌

@0xShug0

0xShug0 commented Jul 25, 2026

Copy link
Copy Markdown
Owner

@hartmark Thank you for testing! You can download all models from https://huggingface.co/audio-cpp/audio.cpp-gguf/tree/main.

@IIIIIllllIIIIIlllll @fedeizzo @wizardeur Should we first prepare a merge-ready PR for ROCm support, along with documentation tracking the current testing status? It looks like some models already work out of the box. We can then use follow-up PRs to update the test results and add performance optimizations.

@hartmark

Copy link
Copy Markdown

@hartmark Thank you for testing! You can download all models from https://huggingface.co/audio-cpp/audio.cpp-gguf/tree/main.

It's a bit of a jungle for me as I have mostly just messing around with stable diffusion and LLMs.

What model is a good first step to test on 16GB vram?

@0xShug0

0xShug0 commented Jul 25, 2026

Copy link
Copy Markdown
Owner

@hartmark Thank you for testing! You can download all models from https://huggingface.co/audio-cpp/audio.cpp-gguf/tree/main.

It's a bit of a jungle for me as I have mostly just messing around with stable diffusion and LLMs.

What model is a good first step to test on 16GB vram?

Try OmniVoice for TTS and Nemotron-3.5-ASR-Streaming-0.6B for ASR.

@hartmark

Copy link
Copy Markdown

got a crash using the 16bit omnivoice models

markus@kozel /data/code/audio.cpp/models (fix/hip-build-rdna3) $ ../build_hip/bin/audiocpp_cli --task tts --family omnivoice --model omnivoice-bf16.gguf --backend cuda --language en --text "Hello there.. Obiwan Kenobi. Nice to see you" --voice-id M1 --out out.wav
ggml_cuda_init: found 1 ROCm devices (Total VRAM: 16304 MiB):
  Device 0: AMD Radeon RX 9060 XT, gfx1200 (0x1200), VMM: no, Wave Size: 32, VRAM: 16304 MiB
ggml_backend_cuda_graph_compute: CUDA graph warmup complete
/data/code/audio.cpp/external/ggml/src/ggml-cuda/binbcast.cu:475: GGML_ASSERT(src1->type == GGML_TYPE_F32 || src1->type == GGML_TYPE_F16) failed
[New LWP 3702729]
[New LWP 3702585]
[New LWP 3702584]

This GDB supports auto-downloading debuginfo from the following URLs:
  <https://debuginfod.archlinux.org>
Enable debuginfod for this session? (y or [n]) [answered N; input not from terminal]
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
0x00007f170f49fff2 in ?? () from /usr/lib/libc.so.6
#0  0x00007f170f49fff2 in ?? () from /usr/lib/libc.so.6
#1  0x00007f170f49403c in ?? () from /usr/lib/libc.so.6
#2  0x00007f170f494084 in ?? () from /usr/lib/libc.so.6
#3  0x00007f170f50494f in wait4 () from /usr/lib/libc.so.6
#4  0x0000557b685043f6 in ggml_print_backtrace ()
#5  0x0000557b6851b569 in ggml_abort ()
#6  0x0000557b67c7169e in void ggml_cuda_op_bin_bcast<bin_bcast_cuda<&(op_add(float, float)), 1> >(ggml_tensor const*, ggml_tensor const*, ggml_tensor*, void const*, void const*, void*, ihipStream_t*) ()
#7  0x0000557b67c6c3a3 in ggml_cuda_op_add(ggml_backend_cuda_context&, ggml_tensor*) ()
#8  0x0000557b67c12b26 in ggml_cuda_graph_evaluate_and_capture(ggml_backend_cuda_context*, ggml_cgraph*, bool, bool, void const*) ()
#9  0x0000557b67c10666 in ggml_backend_cuda_graph_compute(ggml_backend*, ggml_cgraph*) ()
#10 0x0000557b685202cc in ggml_backend_graph_compute ()
#11 0x0000557b6745d076 in engine::models::omnivoice::OmniVoiceAudioTokenizerRuntime::decode_audio_tokens(engine::models::omnivoice::OmniVoiceGeneratedAudioTokens const&) ()
#12 0x0000557b6743e440 in engine::models::omnivoice::OmniVoiceSession::run(engine::runtime::TaskRequest const&) ()
#13 0x0000557b673089ad in audiocpp_cli_main(int, char**) ()
#14 0x00007f170f427741 in ?? () from /usr/lib/libc.so.6
#15 0x00007f170f427879 in __libc_start_main () from /usr/lib/libc.so.6
#16 0x0000557b67304585 in _start ()
[Inferior 1 (process 3702563) detached]
[1]    3702563 abort (core dumped)  ../build_hip/bin/audiocpp_cli --task tts --family omnivoice --model  --backen

Generating with supertonic works however:

markus@kozel /data/code/audio.cpp/models (fix/hip-build-rdna3) $ ../build_hip/bin/audiocpp_cli --task tts --family supertonic --model supertonic-3-orig.gguf --backend cuda --language en --text "Hello there Obiwan Kenobi! Nice to see you" --voice-id M1 --out out.wav
ggml_cuda_init: found 1 ROCm devices (Total VRAM: 16304 MiB):
  Device 0: AMD Radeon RX 9060 XT, gfx1200 (0x1200), VMM: no, Wave Size: 32, VRAM: 16304 MiB
ggml_backend_cuda_graph_compute: CUDA graph warmup complete
family=supertonic
task=tts
mode=offline
audio_out=out.wav

@0xShug0

0xShug0 commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Unfortunately, I don’t have access to a ROCm machine to debug this.

This is exactly why runtime testing is essential when adding support for a new backend.

@IIIIIllllIIIIIlllll

Copy link
Copy Markdown
Author

got a crash using the 16bit omnivoice models

markus@kozel /data/code/audio.cpp/models (fix/hip-build-rdna3) $ ../build_hip/bin/audiocpp_cli --task tts --family omnivoice --model omnivoice-bf16.gguf --backend cuda --language en --text "Hello there.. Obiwan Kenobi. Nice to see you" --voice-id M1 --out out.wav
ggml_cuda_init: found 1 ROCm devices (Total VRAM: 16304 MiB):
  Device 0: AMD Radeon RX 9060 XT, gfx1200 (0x1200), VMM: no, Wave Size: 32, VRAM: 16304 MiB
ggml_backend_cuda_graph_compute: CUDA graph warmup complete
/data/code/audio.cpp/external/ggml/src/ggml-cuda/binbcast.cu:475: GGML_ASSERT(src1->type == GGML_TYPE_F32 || src1->type == GGML_TYPE_F16) failed
[New LWP 3702729]
[New LWP 3702585]
[New LWP 3702584]

This GDB supports auto-downloading debuginfo from the following URLs:
  <https://debuginfod.archlinux.org>
Enable debuginfod for this session? (y or [n]) [answered N; input not from terminal]
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
0x00007f170f49fff2 in ?? () from /usr/lib/libc.so.6
#0  0x00007f170f49fff2 in ?? () from /usr/lib/libc.so.6
#1  0x00007f170f49403c in ?? () from /usr/lib/libc.so.6
#2  0x00007f170f494084 in ?? () from /usr/lib/libc.so.6
#3  0x00007f170f50494f in wait4 () from /usr/lib/libc.so.6
#4  0x0000557b685043f6 in ggml_print_backtrace ()
#5  0x0000557b6851b569 in ggml_abort ()
#6  0x0000557b67c7169e in void ggml_cuda_op_bin_bcast<bin_bcast_cuda<&(op_add(float, float)), 1> >(ggml_tensor const*, ggml_tensor const*, ggml_tensor*, void const*, void const*, void*, ihipStream_t*) ()
#7  0x0000557b67c6c3a3 in ggml_cuda_op_add(ggml_backend_cuda_context&, ggml_tensor*) ()
#8  0x0000557b67c12b26 in ggml_cuda_graph_evaluate_and_capture(ggml_backend_cuda_context*, ggml_cgraph*, bool, bool, void const*) ()
#9  0x0000557b67c10666 in ggml_backend_cuda_graph_compute(ggml_backend*, ggml_cgraph*) ()
#10 0x0000557b685202cc in ggml_backend_graph_compute ()
#11 0x0000557b6745d076 in engine::models::omnivoice::OmniVoiceAudioTokenizerRuntime::decode_audio_tokens(engine::models::omnivoice::OmniVoiceGeneratedAudioTokens const&) ()
#12 0x0000557b6743e440 in engine::models::omnivoice::OmniVoiceSession::run(engine::runtime::TaskRequest const&) ()
#13 0x0000557b673089ad in audiocpp_cli_main(int, char**) ()
#14 0x00007f170f427741 in ?? () from /usr/lib/libc.so.6
#15 0x00007f170f427879 in __libc_start_main () from /usr/lib/libc.so.6
#16 0x0000557b67304585 in _start ()
[Inferior 1 (process 3702563) detached]
[1]    3702563 abort (core dumped)  ../build_hip/bin/audiocpp_cli --task tts --family omnivoice --model  --backen

Generating with supertonic works however:

markus@kozel /data/code/audio.cpp/models (fix/hip-build-rdna3) $ ../build_hip/bin/audiocpp_cli --task tts --family supertonic --model supertonic-3-orig.gguf --backend cuda --language en --text "Hello there Obiwan Kenobi! Nice to see you" --voice-id M1 --out out.wav
ggml_cuda_init: found 1 ROCm devices (Total VRAM: 16304 MiB):
  Device 0: AMD Radeon RX 9060 XT, gfx1200 (0x1200), VMM: no, Wave Size: 32, VRAM: 16304 MiB
ggml_backend_cuda_graph_compute: CUDA graph warmup complete
family=supertonic
task=tts
mode=offline
audio_out=out.wav

Let me try.

@IIIIIllllIIIIIlllll

IIIIIllllIIIIIlllll commented Jul 26, 2026

Copy link
Copy Markdown
Author

@hartmark Sorry to disappoint you. My test showed that the original safetensor model works. I'm now checking if it's a problem with the GGUF model.

Could you provide a download link for your GGUF model? Thanks! :)

@hartmark

hartmark commented Jul 26, 2026

Copy link
Copy Markdown

I downloaded the GGUF model from the repo that @0xShug0 linked:
https://huggingface.co/audio-cpp/audio.cpp-gguf/tree/main

For context on my environment, I'm currently running on a custom branch (fix/hip-build-rdna3) to resolve some HIP build issues specific to my AMD GFX1200 (RDNA 4) architecture.

To get it compiling, a couple of fixes were applied:

  1. Language Mismatch Error: Added the -xhip flag so Clang correctly treats .cu files as HIP instead of CUDA (which was previously throwing an unsupported CUDA gpu architecture error).
  2. Illegal Instruction DPP Error: Forced at least -O2 optimization for the HIP backend. This works around a known LLVM bug (ROCm #5826) where unoptimized builds emit illegal instructions for GFX10+ GPUs (wavefront shifts are not supported).

Let me know if you think these compiler workarounds might be causing the issue with the GGUF model, or if there's anything else you'd like me to test!

IIIIIllllIIIIIlllll and others added 2 commits July 26, 2026 19:25
Bias tensors were loaded with native storage, so BF16 GGUF checkpoints
fed BF16 tensors directly into elementwise add ops. The ggml CUDA/HIP
binary broadcast path only supports F32/F16 src1 and asserted in
binbcast.cu during decoder graph warmup. Norm weights and snake alpha
were already forced to F32; do the same for all bias loads. Widening
BF16 to F32 is lossless, so numerics and parity are unchanged.
Co-authored-by: Junie <junie@jetbrains.com>
@IIIIIllllIIIIIlllll

Copy link
Copy Markdown
Author

@hartmark Thank you! I have fixed both issues: omnivoice-bf16.gguf failure and compilation problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants