ROCm 7 fix for rocm-core on linux mint

So ROCm 7 just dropped and I encountered a bug on my linux mint machines. The short version is that the postinst script has == rather than =~ comparisons, which fail for linux mint, but pass for Ubuntu. Fixing this was easy, and I sent a diff to Anush E and a few others.

Process to fix, before installing rocm, but after updating the sources.list.d entries.

  • Download rocm-core and unpack
  • Apply patch below
  • Repack rocm-core
  • Install new rocm-core
  • apt install rocm
--- rocm-core/DEBIAN/postinst   2025-08-16 17:15:55.000000000 -0400
+++ rocm-core-new/DEBIAN/postinst       2025-09-16 16:16:11.652323983 -0400
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -x
 set -e

 do_update_alternatives(){
@@ -46,7 +46,7 @@
        if [ -d "$loc" ]
        then
            mkdir -p "$loc/rocm"
-           if [[ ${ID_LIKE:-$ID} == "debian" ]] ; then
+           if [[ ${ID_LIKE:-$ID} =~ "debian" ]] ; then
                update-alternatives --install "$loc/rocm/7.0.0" "rocmmod7.0.0" "/opt/rocm-7.0.0/lib/rocmmod" "$altscore"
            else
                update-alternatives --install "$loc/rocm/7.0.0" "rocmmod7.0.0" "$RPM_INSTALL_PREFIX0/lib/rocmmod" "$altscore"
@@ -57,7 +57,7 @@
     true
 }

-if [ -e /etc/os-release ] && source /etc/os-release && [[ ${ID_LIKE:-$ID} == "debian" ]]
+if [ -e /etc/os-release ] && source /etc/os-release && [[ ${ID_LIKE:-$ID} =~ "debian" ]]
 then
     case "$1" in
        (configure)

Now I have ROCm 7 working nicely on my 3 linux mint machines, and my debian 12 server.

I notice my gpu_load.jl being much faster than with ROCm 6.x.

#!/usr/bin/env -S julia -t8

using AMDGPU, ProgressMeter

Ngpus = length(AMDGPU.devices())

f     = 0.01 # 0.0 <= f <= 1.0

s     = [0 for i in 1:Ngpus]
mem   = [0 for i in 1:Ngpus]

strms =  [  ]
x_d   =  Array{Union{Missing,Any}}(undef,8)
y_d   =  Array{Union{Missing,Any}}(undef,8)
z_d   =  Array{Union{Missing,Any}}(undef,8)

# first pass for compiler
h = Float16(1.0)
bytes = sizeof(typeof(h))

function Init(gpu::Int,f::Real=1.0)
    AMDGPU.device!(AMDGPU.devices()[gpu])
    _m          = Int(round(AMDGPU.HIP.properties(HIPDevice(gpu)).totalGlobalMem * f))
    maxs        = Int(2^round(log2(sqrt(_m / sizeof(typeof(h)) /4 ))))
    push!(strms,AMDGPU.HIPStream(:high))
    @info "gpu = $(gpu), mem = $(_m), s = $(maxs)"
    mem[gpu]    = _m
    s[gpu]      = maxs
    # try the fast version of random number gen, default to slower with copy
    try
        x_d[gpu] =  AMDGPU.rand(Float16,s,s) .- Float16(0.5)
        x_d[gpu] =  AMDGPU.rand(Float16,s,s) .- Float16(0.5)
        x_d[gpu] =  AMDGPU.rand(Float16,s,s) .- Float16(0.5)
    catch
        x_d[gpu] = ROCMatrix(rand(Float16,maxs,maxs) .- Float16(0.5));
        y_d[gpu] = ROCMatrix(rand(Float16,maxs,maxs) .- Float16(0.5));
        z_d[gpu] = ROCMatrix(rand(Float16,maxs,maxs) .- Float16(0.5));
    end
end

function Load(gpu::Int)
    AMDGPU.device!(AMDGPU.devices()[gpu])
    AMDGPU.synchronize()
    start = time_ns()
    z_d[gpu] = AMDGPU.rocBLAS.gemm('N','N',h,x_d[gpu],y_d[gpu]) ;
    AMDGPU.synchronize()
    dt = (time_ns() - start)/1e9
    TFLOPS = s[gpu]^3 * 2 / dt / 1e12
    print("gpu=$(gpu), TFLOPS=$(TFLOPS), dt=$(dt)\n")
    nothing
end

function main()
    # initialize arrays
    @showprogress for _it in 1:100
        Threads.@threads for i in 1:Ngpus
            @info "starting on gpu = $(i)"
            Load(i)
            @info "complete on gpu = $(i)"
        end
    end
end

@sync begin
    Threads.@spawn for i in 1:Ngpus
        @info "Initializing gpu = $(i)"
        Init(i,f);
    end
end

This is the case on my 9070XT, my RX6600, and my laptops with Mobile Radeon 780.