| 1 | # ABSTRACT: AMD driver setup for Ubuntu 22.04, 24.04 and 26.04 (experimental) | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | package Rex::GPU::AMD::Setup::Ubuntu; | ||||||||||||||||||||||||||||
| 4 | 40 | our $VERSION = '0.006'; | |||||||||||||||||||||||||||
| 5 | 40 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 40 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 40 | extends 'Rex::GPU::AMD::Setup::Apt'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | # Sources, checked 2026-10-30: | ||||||||||||||||||||||||||||
| 11 | # ROCm 10.1 compatibility matrix | ||||||||||||||||||||||||||||
| 12 | # https://rocm.docs.amd.com/en/latest/compatibility/compatibility-matrix.html | ||||||||||||||||||||||||||||
| 13 | # Instinct (amdgpu-dkms): 26.04.1 GA 7.0, 24.04.5 GA 6.8, 22.04.5 GA 5.15; | ||||||||||||||||||||||||||||
| 14 | # Radeon (amdgpu-dkms): 26.04.1 GA 7.0, 24.04.5 HWE 7.0, 22.04.5 HWE 6.8; | ||||||||||||||||||||||||||||
| 15 | # Ryzen APUs: "Inbox kernel driver in supported Ubuntu version", 26.04.1 GA | ||||||||||||||||||||||||||||
| 16 | # 7.0 and 24.04.5 HWE 7.0 only. AMD's Ryzen install page names 24.04.4 | ||||||||||||||||||||||||||||
| 17 | # with the OEM kernel 6.14 instead (hardware curator, k1). The matrix is | ||||||||||||||||||||||||||||
| 18 | # followed, so an APU on 6.14 dies before any change. The Radeon list | ||||||||||||||||||||||||||||
| 19 | # binds every GPU of the Radeon table (matrix => 'radeon'), whatever | ||||||||||||||||||||||||||||
| 20 | # the method (k82): a Radeon on 24.04 GA 6.8 or 22.04 GA 5.15 dies. | ||||||||||||||||||||||||||||
| 21 | # install_rocm binds the Radeon and Ryzen APU targets the same way (k91). | ||||||||||||||||||||||||||||
| 22 | # amdgpu 31.60 install guide (instinct.docs.amd.com/projects/amdgpu-docs, | ||||||||||||||||||||||||||||
| 23 | # docs-31.60.0): suites resolute/noble/jammy; linux-headers-$K, and on | ||||||||||||||||||||||||||||
| 24 | # 24.04/22.04 linux-modules-extra-$K. | ||||||||||||||||||||||||||||
| 25 | # synapse (Ubuntu 24.04, 7.0.0-42-generic), 2026-10-31: no package | ||||||||||||||||||||||||||||
| 26 | # linux-modules-extra-7.0.0-42-generic (amdgpu.ko is in linux-modules), so | ||||||||||||||||||||||||||||
| 27 | # linux-modules-extra-$K is installed only where apt has a candidate. | ||||||||||||||||||||||||||||
| 28 | # Firmware: linux-firmware-amd-graphics (noble-updates, resolute), split off | ||||||||||||||||||||||||||||
| 29 | # linux-firmware, which depends on it from that version on; an older | ||||||||||||||||||||||||||||
| 30 | # linux-firmware still carries the files -- either one installed suffices. | ||||||||||||||||||||||||||||
| 31 | 40 | my %RELEASE = ( | |||||||||||||||||||||||||||
| 32 | '26.04' => { suite => 'resolute', dkms => [qw( 7.0 )], inbox_only => [qw( 7.0 )], | ||||||||||||||||||||||||||||
| 33 | radeon => [qw( 7.0 )], | ||||||||||||||||||||||||||||
| 34 | firmware => [qw( linux-firmware-amd-graphics linux-firmware )], | ||||||||||||||||||||||||||||
| 35 | modules_extra => 0, rocm => 'ubuntu2604' }, | ||||||||||||||||||||||||||||
| 36 | '24.04' => { suite => 'noble', dkms => [qw( 6.8 7.0 )], inbox_only => [qw( 7.0 )], | ||||||||||||||||||||||||||||
| 37 | radeon => [qw( 7.0 )], | ||||||||||||||||||||||||||||
| 38 | firmware => [qw( linux-firmware-amd-graphics linux-firmware )], | ||||||||||||||||||||||||||||
| 39 | modules_extra => 1, rocm => 'ubuntu2404' }, | ||||||||||||||||||||||||||||
| 40 | '22.04' => { suite => 'jammy', dkms => [qw( 5.15 6.8 )], inbox_only => [], | ||||||||||||||||||||||||||||
| 41 | radeon => [qw( 6.8 )], | ||||||||||||||||||||||||||||
| 42 | firmware => [qw( linux-firmware )], | ||||||||||||||||||||||||||||
| 43 | modules_extra => 1, rocm => 'ubuntu2204' }, | ||||||||||||||||||||||||||||
| 44 | ); | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 344 | ▶ | sub release_data { $RELEASE{ $_[0]->os_version } } | ||||||||||||||||||||||||||
|
Subroutine
release_data: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 137 | ▶ | sub kernel_series { | ||||||||||||||||||||||||||
|
Subroutine
kernel_series: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 50 | 137 | my ( $self ) = @_; | |||||||||||||||||||||||||||
| 51 | 137 | ▶ | return $self->kernel =~ /\A(\d+\.\d+)\.\d+-\d+-generic\z/ ? $1 : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 68 | ▶ | sub dkms_suite { | ||||||||||||||||||||||||||
|
Subroutine
dkms_suite: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 55 | 68 | my ( $self ) = @_; | |||||||||||||||||||||||||||
| 56 | 68 | ▶ | my $row = $self->release_data or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | 68 | return $row->{suite}; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 71 | ▶ | sub dkms_unsupported { | ||||||||||||||||||||||||||
|
Subroutine
dkms_unsupported: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 61 | 71 | my ( $self ) = @_; | |||||||||||||||||||||||||||
| 62 | 71 | ▶ | my $row = $self->release_data | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 63 | or return 'amdgpu-dkms '.$self->amdgpu_release.' supports Ubuntu 22.04, 24.04 and 26.04, not ' | ||||||||||||||||||||||||||||
| 64 | .$self->os_label; | ||||||||||||||||||||||||||||
| 65 | 71 | return $self->_kernel_unsupported('amdgpu-dkms '.$self->amdgpu_release, $row->{dkms}); | |||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 56 | ▶ | sub inbox_only_unsupported { | ||||||||||||||||||||||||||
|
Subroutine
inbox_only_unsupported: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 69 | 56 | my ( $self ) = @_; | |||||||||||||||||||||||||||
| 70 | 56 | my $row = $self->release_data; | |||||||||||||||||||||||||||
| 71 | 56 | ▶ | return $self->SUPER::inbox_only_unsupported unless $row && @{ $row->{inbox_only} }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$row and @{$row->{"inbox_only"};}
MC/DC50%1/2
$row and @{$row->{"inbox_only"};}
$row
@{$row->{"inbox_only"};}
Truth table66%2/3
A and B
A= $rowB= @{$row->{"inbox_only"};}
| |||||||||||||||||||||||||||||
| 72 | 48 | ▶ | my $why = $self->_kernel_unsupported('AMD (inbox driver only)', $row->{inbox_only}) // return; | ||||||||||||||||||||||||||
|
Condition100%2/2
$self->_kernel_unsupported("AMD (inbox driver only)", $row->{"inbox_only"}) // (return)
MC/DC100%1/1
$self->_kernel_unsupported("AMD (inbox driver only)", $row->{"inbox_only"}) // (return)
$self->_kernel_unsupported("AMD (inbox driver only)", $row->{"inbox_only"})
Truth table100%2/2
A
A= $self->_kernel_unsupported("AMD (inbox driver only)", $row->{"inbox_only"})
| |||||||||||||||||||||||||||||
| 73 | 5 | return $why.' -- '.$self->inbox_only_supported; | |||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 18 | ▶ | sub radeon_unsupported { | ||||||||||||||||||||||||||
|
Subroutine
radeon_unsupported: called CC=4 SCAR=14.3
Pod
documented
| |||||||||||||||||||||||||||||
| 77 | 18 | my ( $self ) = @_; | |||||||||||||||||||||||||||
| 78 | 18 | my $row = $self->release_data; | |||||||||||||||||||||||||||
| 79 | 18 | ▶ | return $self->SUPER::radeon_unsupported unless $row && @{ $row->{radeon} }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$row and @{$row->{"radeon"};}
MC/DC0%0/2
$row and @{$row->{"radeon"};}
$row
@{$row->{"radeon"};}
Truth table33%1/3
A and B
A= $rowB= @{$row->{"radeon"};}
| |||||||||||||||||||||||||||||
| 80 | 18 | ▶ | my $why = $self->_kernel_unsupported('AMD (Radeon GPUs)', $row->{radeon}) // return; | ||||||||||||||||||||||||||
|
Condition100%2/2
$self->_kernel_unsupported("AMD (Radeon GPUs)", $row->{"radeon"}) // (return)
MC/DC100%1/1
$self->_kernel_unsupported("AMD (Radeon GPUs)", $row->{"radeon"}) // (return)
$self->_kernel_unsupported("AMD (Radeon GPUs)", $row->{"radeon"})
Truth table100%2/2
A
A= $self->_kernel_unsupported("AMD (Radeon GPUs)", $row->{"radeon"})
| |||||||||||||||||||||||||||||
| 81 | 9 | return $why.' -- '.$self->radeon_supported; | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 137 | ▶ | sub _kernel_unsupported { | ||||||||||||||||||||||||||
|
Subroutine
_kernel_unsupported: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 85 | 137 | my ( $self, $what, $series ) = @_; | |||||||||||||||||||||||||||
| 86 | 137 | my $have = $self->kernel_series; | |||||||||||||||||||||||||||
| 87 | 137 | ▶ | return if defined $have && grep { $_ eq $have } @$series; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $have and grep {$_ eq $have;} @$series
MC/DC100%2/2
defined $have and grep {$_ eq $have;} @$series
defined $have
grep {$_ eq $have;} @$series
Truth table100%3/3
A and B
A= defined $haveB= grep {$_ eq $have;} @$series
| |||||||||||||||||||||||||||||
| 88 | 16 | return $what.' supports '.$self->os_label.' with kernel '.join(' or ', @$series) | |||||||||||||||||||||||||||
| 89 | .' (-generic); this host runs '.$self->kernel; | ||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 67 | ▶ | sub kernel_header_packages { 'linux-headers-'.$_[0]->kernel } | ||||||||||||||||||||||||||
|
Subroutine
kernel_header_packages: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 71 | ▶ | sub optional_packages { | ||||||||||||||||||||||||||
|
Subroutine
optional_packages: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||
| 95 | 71 | my ( $self ) = @_; | |||||||||||||||||||||||||||
| 96 | 71 | ▶ | my $row = $self->release_data or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | 71 | ▶ | return $row->{modules_extra} ? 'linux-modules-extra-'.$self->kernel : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 4 | ▶ | sub inbox_module_packages { $_[0]->optional_packages } | ||||||||||||||||||||||||||
|
Subroutine
inbox_module_packages: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 7 | ▶ | sub firmware_packages { | ||||||||||||||||||||||||||
|
Subroutine
firmware_packages: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 103 | 7 | my ( $self ) = @_; | |||||||||||||||||||||||||||
| 104 | 7 | ▶ | my $row = $self->release_data or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 105 | 7 | return @{ $row->{firmware} }; | |||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 53 | ▶ | sub rocm_repo_dir { | ||||||||||||||||||||||||||
|
Subroutine
rocm_repo_dir: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 109 | 53 | my ( $self ) = @_; | |||||||||||||||||||||||||||
| 110 | 53 | ▶ | my $row = $self->release_data or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 111 | 52 | return $row->{rocm}; | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 40 | 1; | |||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | __END__ | ||||||||||||||||||||||||||||