lib/Rex/GPU/AMD/Hardware.pm

filter: Statementstmt 100% 69 / 69 Branchbran 84.3% 27 / 32 Conditioncond 68.2% 43 / 63 MC/DCmcdc 50.0% 17 / 34 Subroutinesub 100% 14 / 14 Podpod 100% 7 / 7 totaltotal 80.8% 177 / 219 CC 43 SCAR 22.9
CC
43
Cov
85%
_check_device_row
22.5
_check_target_row
14.3
resolve
8.0
CRAP 9.9
« lib/Rex/GPU/NVIDIA/Setup/UbuntuDrivers.pm ↑ Summary lib/Rex/GPU/AMD.pm »
1 # ABSTRACT: AMD GPU hardware data: PCI device ID to gfx target, gfx target to ROCm support (experimental)
2  
3 package Rex::GPU::AMD::Hardware;
4 41 our $VERSION = '0.006';
5 41 ▶use v5.14.4;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 41 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 41 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
9 41 ▶use Rex::Logger;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # ============================================================
12 # Sources
13 # ============================================================
14 #
15 # Every row names its source (source => '...'), a primary one: AMD's ROCm
16 # documentation (compatibility matrix, GPU specifications, release notes),
17 # the Linux kernel / libdrm sources, or a live read of the hardware. A GPU
18 # without a row stays unknown -- compute undef, no driver from gpu_setup --
19 # never a guessed row. Rows are added by research with a citation, not from
20 # memory.
21 #
22 # All checked 2026-10-31 (karr k1, hardware curator):
23 #
24 # [rocm-10.1-matrix] https://rocm.docs.amd.com/en/latest/compatibility/compatibility-matrix.html
25 # ROCm Core SDK 10.1.0 (2026-10-05), the latest release. The
26 # docs-10.0.0, docs-7.14.1 and docs-7.14.0 matrices list the
27 # same targets.
28 # [rocm-10.1-specs] https://rocm.docs.amd.com/en/latest/reference/gpu-arch-specs.html
29 # (10.1.0): product -> LLVM target
30 # [rocm-10.1-install] https://rocm.docs.amd.com/en/latest/install/rocm.html (10.1.0):
31 # "For Instinct and Radeon devices, install the AMD GPU Driver
32 # (amdgpu)"; "Supported Ryzen APUs require the inbox kernel
33 # driver included with Ubuntu" (amdgpu-install ... --no-dkms)
34 # [amdgpu-31.60] https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/install/detailed-install/package-manager/package-manager-ubuntu.html
35 # AMD GPU Driver (amdgpu) 31.60.0 is "apt install amdgpu-dkms"
36 # from repo.radeon.com/amdgpu/31.60
37 # [rocm-hist] https://rocm.docs.amd.com/en/docs-7.2.4/downloads/compatibility-matrix-historical-6.0.csv
38 # ROCm 6.0.0 .. 7.2.4 (7.2.4, 2026-05-29: last release of the
39 # old ROCm line)
40 # [rocm-sysreq] https://rocm.docs.amd.com/projects/install-on-linux/en/docs-VERSION/reference/system-requirements.html
41 # for 6.0.0 6.1.0 6.1.2 6.2.0 6.2.4 6.3.0 6.3.3 6.4.0 6.4.3 7.0.0,
42 # and https://rocm.docs.amd.com/en/docs-5.7.1/release/gpu_os_support.html
43 # [rocm-ryzen] https://rocm.docs.amd.com/projects/radeon-ryzen/en/latest/docs/compatibility/compatibilityryz/native_linux/native_linux_compatibility.html
44 # (ROCm on Ryzen, Linux: 6.4.4, 7.0.2, 7.1.1, 7.2.1)
45 # [rocm-all] all of the release lists above: 5.7.1, 6.0.0 .. 7.2.4,
46 # 7.14.0 .. 10.1.0 (5.0 .. 5.7.0 and older not checked)
47 # [llvm] https://llvm.org/docs/AMDGPUUsage.html, processor table,
48 # column "dGPU/APU" (LLVM 24.0.0git docs)
49 # [kernel] Linux, torvalds master a9547379cb38 (2026-10-30, 7.3.0-dev):
50 # drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c pciidlist (ID ->
51 # CHIP_*), amdgpu_discovery.c (the GC version of the chips
52 # without a discovery table), amdkfd/kfd_device.c
53 # kgd2kfd_probe (chip or GC version -> gfx_target_version)
54 # [rae] github.com/ROCm/rocm-systems develop,
55 # projects/rocminfo/rocm_agent_enumerator @ bde60920b5a5
56 # (2026-09-22): ISA_TO_ID, gfx target -> device IDs
57 # [hsakmt] github.com/ROCm/rocm-systems develop @ 6a167157e268
58 # (2026-10-30), projects/rocr-runtime/libhsakmt/src/topology.c:
59 # gfxip_lookup_table, device ID -> gfx version
60 # [rocprof] github.com/ROCm/rocm-systems develop @ 9d29a1da3124
61 # (2026-08-07), projects/rocprofiler-compute/src/utils/
62 # mi_gpu_spec.yaml: gpu_arch -> chip_ids (decimal)
63 # [libdrm] gitlab.freedesktop.org/mesa/drm main @ 3b5e41a44cd1
64 # (2026-10-27), data/amdgpu.ids: (device ID, revision) ->
65 # marketing name
66 # [synapse-kfd] live read on a Strix Halo test host, 2026-10-31: PCI 1002:1586,
67 # class 0380, rev da; KFD gfx_target_version 110501 (gfx1151);
68 # Ryzen AI Max+ PRO 495 / Radeon 8065S
69 # pci.ids 2026.10.30 names and codenames only; it never decides a row.
70 #
71 # Two tables, both lists of hashrefs returned by an overridable class method
72 # (like Rex::GPU::NVIDIA::Requirement's generations): targets() says what AMD
73 # supports for an LLVM gfx target, devices() which gfx target a PCI device ID
74 # is. A subclass adds or replaces rows by returning its own rows before
75 # $class->SUPER::targets / ->SUPER::devices -- the first matching row wins.
76 #
77 # targets, compute: 1 for a gfx target listed for Linux in the latest release
78 # of a ROCm line AMD still ships -- ROCm Core SDK 10.1.0 [rocm-10.1-matrix];
79 # the old line's last release, 7.2.4, with its Ryzen/Radeon 7.2.1 pages, lists
80 # no target that 10.1.0 lacks. 0 for a released target that no current release
81 # lists: gfx906 (deprecated 6.0.0-6.3.3, "Unsupported" from 6.4.0), gfx900
82 # ("Unsupported" in every release checked), and the older and integrated
83 # targets that no release of [rocm-all] lists. The host gets only the kernel
84 # driver, but compute means "ROCm-capable today", as for NVIDIA (Kepler is 0
85 # though old CUDA still runs on it); rocm_last names the last release where
86 # one is known, for a subclass that wants an older ROCm. gfx1154, gfx1170,
87 # gfx1171, gfx1172, gfx1250 and gfx1251 (KFD and LLVM know them, AMD makes no
88 # support statement) have no row: unknown. The verdict is per gfx target, not
89 # per product -- ROCm ships code per target -- so the Radeon RX 6800/6900
90 # (gfx1030) and the W7500/W7400 (gfx1102) are 1 although AMD names other
91 # products of those targets.
92 #
93 # targets, integrated: LLVM's dGPU/APU column [llvm]. gfx942 covers the
94 # MI300X (discrete) and the MI300A (an APU); LLVM files it as dGPU, and the
95 # MI300A is a datacenter accelerator, not client integrated graphics:
96 # integrated => 0 (karr k1). gfx942 is the only target covering both.
97 #
98 # targets, driver: 'dkms' for every target of the 10.1.0 Instinct and Radeon
99 # tables ([rocm-10.1-matrix] "Supported AMD GPU Driver (amdgpu) versions"
100 # 31.60.0 ...; [rocm-10.1-install] "For Instinct and Radeon devices, install
101 # the AMD GPU Driver (amdgpu)", which is amdgpu-dkms [amdgpu-31.60]); 'inbox'
102 # for the Ryzen APU table ([rocm-10.1-matrix] "Inbox kernel driver in supported
103 # Ubuntu version"; [rocm-10.1-install]); undef where AMD says nothing, i.e.
104 # every compute 0 target.
105 #
106 # targets, matrix: the table of [rocm-10.1-matrix] that lists the gfx target,
107 # as the row's source names it -- 'instinct' (Instinct table), 'radeon'
108 # (Radeon table), 'ryzen' (Ryzen APU table) -- and undef for every compute 0
109 # target (no table lists it). Each table has its own operating systems, so
110 # this field, never the free text in family, tells an Instinct from a Radeon
111 # (karr k82). Per target, like compute: the RX 6800/6900 are 'radeon' with
112 # gfx1030. No compute 1 target is in two tables: gfx942 covers the MI300X and
113 # the MI300A, both in the Instinct table; gfx906 (MI50/MI60 and Radeon VII)
114 # is in none. In the rows below matrix is set exactly when compute is 1,
115 # 'ryzen' goes with driver 'inbox', 'instinct' and 'radeon' with 'dkms'.
116 # _check_target_row checks only the value, as for driver: a subclass row
117 # written without the field stays valid.
118 #
119 # devices: an ID gets a row only when (a) a source maps it to its gfx target --
120 # the kernel (pciidlist chip -> KFD case), [rae], [hsakmt], [rocprof], or an
121 # AMD product -> target list ([rocm-10.1-matrix], [rocm-10.1-specs], [llvm])
122 # joined with [libdrm]'s (ID, revision) -> product name; (b) the kernel's
123 # pciidlist, [libdrm] or pci.ids lists the ID; and (c) no source contradicts
124 # it. Every ID below has one gfx target across all its known revisions, so no
125 # row needs the PCI revision. Left out on purpose -- they fall back to what the
126 # running driver reports (KFD), else stay unknown:
127 # 1902 [rocprof] gfx1153 ("rdna35_gorgon_point"), but [libdrm] puts the
128 # Radeon 820M on 1902, and [rocm-10.1-matrix] and
129 # [rocm-10.1-specs] list the 820M (Ryzen AI 5 330) as gfx1152. The
130 # two disagree on the 840M too: the matrix files Ryzen AI 7 445,
131 # AI 5 PRO 435, AI 5 435 and AI 5 430 as gfx1153, the specs page
132 # as gfx1152 (it has no gfx1153 at all). The gfx target picks the
133 # ROCm package, so no guess.
134 # 7460 7461 Radeon PRO V710 (and MxGPU): gfx1101 per [rocm-10.1-matrix],
135 # [rocm-10.1-specs] and [rocm-sysreq] 6.4.3, gfx1100 per [rae]
136 # ("Navi31 ... Pro V710").
137 # 98e4 Stoney: [rae] gfx801, [llvm] stoney = gfx810, and the [kernel]
138 # KFD has no Stoney case (no KFD node at all).
139 # 164e 1506 13c0
140 # Raphael, Mendocino, Granite Ridge (Ryzen 7000/9000 desktop and
141 # server CPUs, "Radeon 610M"): no AMD source maps these IDs. A
142 # running amdgpu reports Raphael and Mendocino (GC 10.3.6/10.3.7)
143 # as gfx1036 [kernel] -- compute 0.
144 # 744b 73f0 7487 748b 749f
145 # W7900D and Navi 33 SKUs: names only ([libdrm], pci.ids).
146 # 74b4 74bc 75a2 75b2
147 # only in [rocprof] (MI300A VF, MI308X HF VF, "MI358" and its VF),
148 # in no device listing; its VF IDs follow a pattern (physical +
149 # 0x14 for gfx942, + 0x10 for gfx950).
150 # 75c1 75d1 [rocprof] gfx1250, a target without a row.
151 # 13f3 only [rae] (gfx1013), in no device listing.
152 # SI, Bonaire, Kabini, Mullins, Topaz: the [kernel] KFD has no case for them.
153  
154 41 my %DRIVERS = map { $_ => 1 } qw( inbox dkms );
155 41 my %MATRICES = map { $_ => 1 } qw( instinct radeon ryzen );
156  
157  
158 455 ▶sub targets {
Subroutine targets: called CC=1 SCAR=0.0
Pod documented
159 return (
160 # --- CDNA, Instinct (discrete; AMD: AMD GPU Driver = amdgpu-dkms) ----------
161 455 { gfx_target => 'gfx950', compute => 1, integrated => 0, driver => 'dkms', matrix => 'instinct',
162 family => 'CDNA 4 (Instinct MI350X, MI355X, MI350P)',
163 source => '[rocm-10.1-matrix] Instinct table, AMD GPU Driver 31.60.0..30.10.2; '
164 .'listed 7.0.0-7.2.4 [rocm-hist] and 7.14.0-10.1.0; [llvm] dGPU' },
165 { gfx_target => 'gfx942', compute => 1, integrated => 0, driver => 'dkms', matrix => 'instinct',
166 family => 'CDNA 3 (Instinct MI300X, MI300A, MI325X)',
167 source => '[rocm-10.1-matrix] Instinct table, AMD GPU Driver 31.60.0..30.10.2; '
168 .'listed 6.0.0-7.2.4 [rocm-hist] and 7.14.0-10.1.0; [llvm] dGPU (the MI300A is an '
169 .'APU, but a datacenter accelerator: integrated 0, karr k1)' },
170 { gfx_target => 'gfx90a', compute => 1, integrated => 0, driver => 'dkms', matrix => 'instinct',
171 family => 'CDNA 2 (Instinct MI250X, MI250, MI210)',
172 source => '[rocm-10.1-matrix] Instinct table, AMD GPU Driver 31.60.0..30.10.2; '
173 .'listed 5.7.1 [rocm-sysreq], 6.0.0-7.2.4 [rocm-hist] and 7.14.0-10.1.0; [llvm] dGPU' },
174 { gfx_target => 'gfx908', compute => 1, integrated => 0, driver => 'dkms', matrix => 'instinct',
175 family => 'CDNA (Instinct MI100)',
176 source => '[rocm-10.1-matrix] Instinct table, AMD GPU Driver 31.60.0..30.10.2; '
177 .'listed 5.7.1 [rocm-sysreq], 6.0.0-7.2.4 [rocm-hist] and 7.14.0-10.1.0; [llvm] dGPU' },
178  
179 # --- RDNA, Radeon (discrete; AMD: AMD GPU Driver = amdgpu-dkms) -----------
180 { gfx_target => 'gfx1201', compute => 1, integrated => 0, driver => 'dkms', matrix => 'radeon',
181 family => 'RDNA 4 (Navi 48: Radeon RX 9070 XT/GRE/9070, '
182 .'AI PRO R9700/R9700S/R9600D/R9600)',
183 source => '[rocm-10.1-matrix] Radeon table, AMD GPU Driver 31.60.0/31.50.0; '
184 .'listed 6.4.1-7.2.4 [rocm-hist] and 7.14.0-10.1.0; [llvm] dGPU' },
185 { gfx_target => 'gfx1200', compute => 1, integrated => 0, driver => 'dkms', matrix => 'radeon',
186 family => 'RDNA 4 (Navi 44: Radeon RX 9060 XT/9060, RX 9050)',
187 source => '[rocm-10.1-matrix] Radeon table, AMD GPU Driver 31.60.0/31.50.0; '
188 .'listed 6.4.1-7.2.4 [rocm-hist] and 7.14.0-10.1.0; [llvm] dGPU' },
189 { gfx_target => 'gfx1100', compute => 1, integrated => 0, driver => 'dkms', matrix => 'radeon',
190 family => 'RDNA 3 (Navi 31: Radeon RX 7900 XTX/XT/GRE, PRO W7900, PRO W7800)',
191 source => '[rocm-10.1-matrix] Radeon table, AMD GPU Driver 31.60.0/31.50.0; '
192 .'listed 5.7.1 [rocm-sysreq], 6.0.0-7.2.4 [rocm-hist] and 7.14.0-10.1.0; [llvm] dGPU' },
193 { gfx_target => 'gfx1101', compute => 1, integrated => 0, driver => 'dkms', matrix => 'radeon',
194 family => 'RDNA 3 (Navi 32: Radeon RX 7800 XT/7700 XT/7700, PRO W7700, PRO V710)',
195 source => '[rocm-10.1-matrix] Radeon table, AMD GPU Driver 31.60.0/31.50.0; '
196 .'listed 6.4.1-7.2.4 [rocm-hist] and 7.14.0-10.1.0; [llvm] dGPU' },
197 { gfx_target => 'gfx1102', compute => 1, integrated => 0, driver => 'dkms', matrix => 'radeon',
198 family => 'RDNA 3 (Navi 33: Radeon RX 7600)',
199 source => '[rocm-10.1-matrix] Radeon table (RX 7600 only), AMD GPU Driver '
200 .'31.60.0/31.50.0; listed 7.14.0-10.1.0 only, not in [rocm-hist]; [llvm] dGPU' },
201 { gfx_target => 'gfx1030', compute => 1, integrated => 0, driver => 'dkms', matrix => 'radeon',
202 family => 'RDNA 2 (Navi 21: Radeon PRO W6800, PRO V620, RX 6800/6900)',
203 source => '[rocm-10.1-matrix] Radeon table (PRO W6800 and PRO V620 only), AMD GPU '
204 .'Driver 31.60.0/31.50.0; listed 5.7.1 [rocm-sysreq], 6.0.0-7.2.4 [rocm-hist] and '
205 .'7.14.0-10.1.0; [llvm] dGPU' },
206  
207 # --- RDNA 3.5 / 3, Ryzen APUs (integrated; AMD: inbox driver only) --------
208 { gfx_target => 'gfx1151', compute => 1, integrated => 1, driver => 'inbox', matrix => 'ryzen',
209 family => 'RDNA 3.5 Ryzen AI Max APU (Strix Halo / Gorgon Halo)',
210 source => '[rocm-10.1-matrix] Ryzen APU table: gfx1151, "Inbox kernel driver in '
211 .'supported Ubuntu version"; listed [rocm-ryzen] 6.4.4-7.2.1 and 7.14.0-10.1.0; '
212 .'[llvm] APU; [synapse-kfd]' },
213 { gfx_target => 'gfx1150', compute => 1, integrated => 1, driver => 'inbox', matrix => 'ryzen',
214 family => 'RDNA 3.5 Ryzen AI APU (Strix Point / Gorgon Point: Radeon 890M, 880M)',
215 source => '[rocm-10.1-matrix] Ryzen APU table, inbox kernel driver; listed '
216 .'[rocm-ryzen] 6.4.4-7.2.1 and 7.14.0-10.1.0; [llvm] APU' },
217 { gfx_target => 'gfx1152', compute => 1, integrated => 1, driver => 'inbox', matrix => 'ryzen',
218 family => 'RDNA 3.5 Ryzen AI APU (Krackan Point: Radeon 860M, 840M, 820M)',
219 source => '[rocm-10.1-matrix] Ryzen APU table, inbox kernel driver; listed '
220 .'7.14.0-10.1.0 only; [llvm] APU' },
221 { gfx_target => 'gfx1153', compute => 1, integrated => 1, driver => 'inbox', matrix => 'ryzen',
222 family => 'RDNA 3.5 Ryzen AI 400 APU (Radeon 840M)',
223 source => '[rocm-10.1-matrix] Ryzen APU table (Ryzen AI 7 445, AI 5 PRO 435, '
224 .'AI 5 435, AI 5 430), inbox kernel driver; listed 7.14.0-10.1.0 only; '
225 .'[rocm-10.1-specs] lists those parts as gfx1152 and has no gfx1153; [llvm] APU' },
226 { gfx_target => 'gfx1103', compute => 1, integrated => 1, driver => 'inbox', matrix => 'ryzen',
227 family => 'RDNA 3 Ryzen APU (Phoenix / Hawk Point: Radeon 780M, 760M, 740M)',
228 source => '[rocm-10.1-matrix] Ryzen APU table (Ryzen 200 / PRO 200), inbox kernel '
229 .'driver; [rocm-10.1-specs] also the Ryzen 7 7840U; listed 7.14.0-10.1.0 only; '
230 .'[llvm] APU' },
231  
232 # --- known, not supported by any current ROCm release ---------------------
233 { gfx_target => 'gfx906', compute => 0, integrated => 0, driver => undef, matrix => undef,
234 rocm_last => '6.3.3',
235 family => 'GCN 5.1 (Vega 20: Instinct MI50/MI60, Radeon VII, Radeon PRO VII)',
236 source => '[rocm-sysreq] supported 5.7.1, deprecated 6.0.0-6.3.3 (6.0.0: MI50 '
237 .'deprecated, PRO VII and VII supported), "Unsupported" 6.4.0-7.0.0; absent from '
238 .'[rocm-hist] and [rocm-10.1-matrix]; [llvm] dGPU' },
239 { gfx_target => 'gfx900', compute => 0, integrated => 0, driver => undef, matrix => undef,
240 family => 'GCN 5 (Vega 10: Instinct MI25, Radeon RX Vega 56/64)',
241 source => '[rocm-sysreq] "Unsupported" 5.7.1-7.0.0; [llvm] dGPU' },
242 { gfx_target => 'gfx904', compute => 0, integrated => 0, driver => undef, matrix => undef,
243 family => 'GCN 5 (Vega 12)',
244 source => 'in no release of [rocm-all]; [kernel] KFD 90004; [llvm] dGPU' },
245 { gfx_target => 'gfx902', compute => 0, integrated => 1, driver => undef, matrix => undef,
246 family => 'GCN 5 Ryzen APU (Raven Ridge / Picasso)',
247 source => 'in no release of [rocm-all]; [kernel] KFD 90002; [llvm] APU' },
248 { gfx_target => 'gfx90c', compute => 0, integrated => 1, driver => undef, matrix => undef,
249 family => 'GCN 5 Ryzen APU (Renoir / Lucienne / Cezanne / Barcelo)',
250 source => 'in no release of [rocm-all]; [kernel] KFD 90012; [llvm] APU' },
251 { gfx_target => 'gfx803', compute => 0, integrated => 0, driver => undef, matrix => undef,
252 family => 'GCN 3/4 (Fiji, Polaris, Vega M)',
253 source => 'in no release of [rocm-all]; [kernel] KFD 80003; [llvm] dGPU' },
254 { gfx_target => 'gfx802', compute => 0, integrated => 0, driver => undef, matrix => undef,
255 family => 'GCN 3 (Tonga)',
256 source => 'in no release of [rocm-all]; [kernel] KFD 80002; [llvm] dGPU' },
257 { gfx_target => 'gfx801', compute => 0, integrated => 1, driver => undef, matrix => undef,
258 family => 'GCN 3 APU (Carrizo)',
259 source => 'in no release of [rocm-all]; [kernel] KFD 80001; [llvm] APU' },
260 { gfx_target => 'gfx701', compute => 0, integrated => 0, driver => undef, matrix => undef,
261 family => 'GCN 2 (Hawaii)',
262 source => 'in no release of [rocm-all]; [kernel] KFD 70001, only with '
263 .'amdgpu.exp_hw_support; [llvm] dGPU' },
264 { gfx_target => 'gfx700', compute => 0, integrated => 1, driver => undef, matrix => undef,
265 family => 'GCN 2 APU (Kaveri)',
266 source => 'in no release of [rocm-all]; [kernel] KFD 70000; [llvm] APU' },
267 { gfx_target => 'gfx1010', compute => 0, integrated => 0, driver => undef, matrix => undef,
268 family => 'RDNA 1 (Navi 10)',
269 source => 'in no release of [rocm-all]; [kernel] KFD 100100; [llvm] dGPU' },
270 { gfx_target => 'gfx1011', compute => 0, integrated => 0, driver => undef, matrix => undef,
271 family => 'RDNA 1 (Navi 12)',
272 source => 'in no release of [rocm-all]; [kernel] KFD 100101; [llvm] dGPU' },
273 { gfx_target => 'gfx1012', compute => 0, integrated => 0, driver => undef, matrix => undef,
274 family => 'RDNA 1 (Navi 14)',
275 source => 'in no release of [rocm-all]; [kernel] KFD 100102; [llvm] dGPU' },
276 { gfx_target => 'gfx1013', compute => 0, integrated => 1, driver => undef, matrix => undef,
277 family => 'RDNA 1 APU (Cyan Skillfish)',
278 source => 'in no release of [rocm-all]; [kernel] KFD 100103; [llvm] APU' },
279 { gfx_target => 'gfx1031', compute => 0, integrated => 0, driver => undef, matrix => undef,
280 family => 'RDNA 2 (Navi 22)',
281 source => 'in no release of [rocm-all]; [kernel] KFD 100301; [llvm] dGPU' },
282 { gfx_target => 'gfx1032', compute => 0, integrated => 0, driver => undef, matrix => undef,
283 family => 'RDNA 2 (Navi 23)',
284 source => 'in no release of [rocm-all]; [kernel] KFD 100302; [llvm] dGPU' },
285 { gfx_target => 'gfx1033', compute => 0, integrated => 1, driver => undef, matrix => undef,
286 family => 'RDNA 2 APU (Van Gogh)',
287 source => 'in no release of [rocm-all]; [kernel] KFD 100303; [llvm] APU' },
288 { gfx_target => 'gfx1034', compute => 0, integrated => 0, driver => undef, matrix => undef,
289 family => 'RDNA 2 (Navi 24)',
290 source => 'in no release of [rocm-all]; [kernel] KFD 100304; [llvm] dGPU' },
291 { gfx_target => 'gfx1035', compute => 0, integrated => 1, driver => undef, matrix => undef,
292 family => 'RDNA 2 Ryzen APU (Rembrandt)',
293 source => 'in no release of [rocm-all]; [kernel] KFD 100305; [llvm] APU' },
294 { gfx_target => 'gfx1036', compute => 0, integrated => 1, driver => undef, matrix => undef,
295 family => 'RDNA 2 Ryzen APU (Raphael / Mendocino)',
296 source => 'in no release of [rocm-all]; [kernel] KFD 100306 for GC 10.3.6 and '
297 .'10.3.7; [llvm] APU' },
298 );
299 }
300  
301  
302 359 ▶sub devices {
Subroutine devices: called CC=1 SCAR=0.0
Pod documented
303 return (
304 # --- Instinct ---------------------------------------------------------------
305 359 { ids => [qw( 75a0 75a3 75a8 )], gfx_target => 'gfx950',
306 product => 'Instinct MI350X (75a0), MI355X (75a3), MI350P (75a8)',
307 source => '[rocprof] gfx950; [libdrm] names, gfx950 per [rocm-10.1-matrix]' },
308 { ids => [qw( 75b0 75b3 75b8 )], gfx_target => 'gfx950',
309 product => 'Instinct MI350X / MI355X / MI350P VF (SR-IOV)',
310 source => '[rocprof] gfx950 (virtual); [libdrm] names' },
311 { ids => [qw( 74a0 74a1 74a2 74a5 74a8 74a9 )], gfx_target => 'gfx942',
312 product => 'Instinct MI300A (74a0), MI300X (74a1), MI308X (74a2; rev A1: MI300X), '
313 .'MI325X (74a5), MI308X HF (74a8), MI300X HF (74a9)',
314 source => '[rocprof] gfx942; [rae] gfx942 (74a1 74a2 74a5 74a9); [libdrm] names' },
315 { ids => [qw( 74b5 74b6 74b9 74bd )], gfx_target => 'gfx942',
316 product => 'Instinct MI300X (74b5), MI308X (74b6), MI325X (74b9), MI300X HF (74bd) '
317 .'VF (SR-IOV)',
318 source => '[rocprof] gfx942 (virtual); [rae] gfx942 (74b5 74b6 74bd); [libdrm] names' },
319 { ids => [qw( 7408 740c 740f 7410 )], gfx_target => 'gfx90a',
320 product => 'Instinct MI250X (7408), MI250X / MI250 (740c), MI210 (740f), MI210 VF (7410)',
321 source => '[kernel] CHIP_ALDEBARAN, KFD 90010; [rae]; [hsakmt]; [libdrm] names' },
322 { ids => [qw( 738c 7388 738e 7390 )], gfx_target => 'gfx908',
323 product => 'Instinct MI100 (Arcturus)',
324 source => '[kernel] CHIP_ARCTURUS, KFD 90008; [rae]; [hsakmt]; [rocprof] (738c)' },
325  
326 # --- Radeon -----------------------------------------------------------------
327 { ids => [qw( 7550 7551 )], gfx_target => 'gfx1201',
328 product => 'Navi 48: Radeon RX 9070 XT/GRE/9070 (7550), AI PRO R9700/R9700S/R9600D (7551)',
329 source => '[rae] gfx1201; [libdrm] names, gfx1201 per [rocm-10.1-matrix]' },
330 { ids => [qw( 7590 )], gfx_target => 'gfx1200',
331 product => 'Navi 44: Radeon RX 9060 XT/XT LP/9060, RX 9050',
332 source => '[rae] gfx1200; [libdrm] names, gfx1200 per [rocm-10.1-matrix]' },
333 { ids => [qw( 7448 7449 744a 744c 745e )], gfx_target => 'gfx1100',
334 product => 'Navi 31: Radeon PRO W7900 (7448), PRO W7800 48GB (7449), PRO W7900 Dual Slot '
335 .'(744a), RX 7900 XTX/XT/GRE/7900M (744c), PRO W7800 (745e)',
336 source => '[rae] gfx1100; [libdrm] names, gfx1100 per [rocm-10.1-matrix]' },
337 { ids => [qw( 7470 747e )], gfx_target => 'gfx1101',
338 product => 'Navi 32: Radeon PRO W7700 (7470), RX 7800 XT/7700 XT/7700/7800M (747e)',
339 source => '[rae] gfx1101; [libdrm] names, gfx1101 per [rocm-10.1-matrix]' },
340 { ids => [qw( 7480 7481 7483 7489 7499 )], gfx_target => 'gfx1102',
341 product => 'Navi 33: Radeon RX 7600/7600 XT/7650 GRE, PRO W7600 (7480), Steam Machine '
342 .'(7481), RX 7600M (7483), PRO W7500 (7489), PRO W7400, RX 7400/7300 (7499)',
343 source => '[rae] gfx1102; [libdrm] names: RX 7600 (7480 rev CF) gfx1102 per '
344 .'[rocm-10.1-matrix], RX 7600 XT (7480 rev C0) per [llvm]' },
345 { ids => [qw( 73a0 73a1 73a2 73a3 73a5 73a8 73a9 73ab 73ac 73ad 73ae 73af 73bf )],
346 gfx_target => 'gfx1030',
347 product => 'Navi 21: Radeon PRO V620 (73a1, MxGPU 73ae), PRO W6800 (73a3), RX 6950 XT '
348 .'(73a5), RX 6900 XT (73af), RX 6800/6800 XT/6900 XT (73bf)',
349 source => '[kernel] CHIP_SIENNA_CICHLID, KFD 100300; [rae]; [hsakmt] (not 73af); '
350 .'[libdrm] names' },
351  
352 # --- Ryzen APUs ---------------------------------------------------------------
353 { ids => [qw( 1586 )], gfx_target => 'gfx1151',
354 product => 'Strix Halo iGPU (seen as Radeon 8065S, Ryzen AI Max+ PRO 495)',
355 source => '[synapse-kfd]; [rocprof] gfx1151; [libdrm] Radeon 8060S/8050S, gfx1151 per '
356 .'[rocm-10.1-matrix]' },
357 { ids => [qw( 150e )], gfx_target => 'gfx1150',
358 product => 'Strix Point iGPU (Radeon 890M / 880M)',
359 source => '[rocprof] gfx1150; [libdrm] Radeon 890M/880M, gfx1150 per [rocm-10.1-matrix] '
360 .'and [rocm-10.1-specs]' },
361 { ids => [qw( 1114 )], gfx_target => 'gfx1152',
362 product => 'Krackan Point iGPU (Radeon 860M / 840M)',
363 source => '[rocprof] gfx1152; [libdrm] Radeon 860M/840M -- the 860M is gfx1152 only, in '
364 .'[rocm-10.1-matrix] and [rocm-10.1-specs]' },
365 { ids => [qw( 15bf 15c8 1900 1901 )], gfx_target => 'gfx1103',
366 product => 'Phoenix1 (15bf), Phoenix2 (15c8), HawkPoint1 (1900), HawkPoint2 (1901) iGPU: '
367 .'Radeon 780M / 760M / 740M',
368 source => '[libdrm] Radeon 780M/760M/740M -- gfx1103 only, in [rocm-10.1-matrix] (Ryzen '
369 .'200 / PRO 200) and [rocm-10.1-specs] (also Ryzen 7 7840U); [kernel] KFD 110003 for '
370 .'GC 11.0.1 and 11.0.4; codenames: pci.ids' },
371  
372 # --- compute 0 targets ----------------------------------------------------------
373 { ids => [qw( 66a0 66a1 66a2 66a3 66a4 66a7 66af )], gfx_target => 'gfx906',
374 product => 'Vega 20: Instinct MI50/MI60, Radeon PRO VII (66a1), Radeon VII (66af)',
375 source => '[kernel] CHIP_VEGA20, KFD 90006; [rae]; [hsakmt]' },
376 { ids => [qw( 6860 6861 6862 6863 6864 6867 6868 6869 686a 686b 686c 686d 686e 686f 687f )],
377 gfx_target => 'gfx900',
378 product => 'Vega 10: Instinct MI25, PRO V340 (6860), Vega Frontier Edition (6863), '
379 .'RX Vega 56/64 (687f)',
380 source => '[kernel] CHIP_VEGA10, KFD 90000; [rae]; [hsakmt] (not 686f)' },
381 { ids => [qw( 69a0 69a1 69a2 69a3 69af )], gfx_target => 'gfx904',
382 product => 'Vega 12',
383 source => '[kernel] CHIP_VEGA12, KFD 90004; [rae]; [hsakmt]' },
384 { ids => [qw( 15dd 15d8 )], gfx_target => 'gfx902',
385 product => 'Raven Ridge (15dd), Picasso / Raven 2 (15d8) iGPU',
386 source => '[kernel] CHIP_RAVEN, KFD 90002; [rae]; [hsakmt]' },
387 { ids => [qw( 15e7 1636 1638 164c )], gfx_target => 'gfx90c',
388 product => 'Barcelo (15e7), Renoir (1636), Cezanne (1638), Lucienne (164c) iGPU',
389 source => '[kernel] CHIP_RENOIR, KFD 90012; [rae]; [hsakmt]' },
390 { ids => [qw( 7300 730f 67c0 67c1 67c2 67c4 67c7 67c8 67c9 67ca 67cc 67cf 67d0 67d4 67df
391 6fdf 67e0 67e1 67e3 67e7 67e8 67e9 67eb 67ef 67ff 6980 6981 6985 6986 6987
392 698f 6995 6997 699f 694c 694e 694f )],
393 gfx_target => 'gfx803',
394 product => 'Fiji, Polaris 10/11/12, Vega M',
395 source => '[kernel] CHIP_FIJI/POLARIS10/POLARIS11/POLARIS12/VEGAM, KFD 80003; [rae] and '
396 .'[hsakmt] (not 67d4, 698f)' },
397 { ids => [qw( 6920 6921 6928 6929 692b 692f 6930 6938 6939 693b )], gfx_target => 'gfx802',
398 product => 'Tonga',
399 source => '[kernel] CHIP_TONGA, KFD 80002; [rae] and [hsakmt] (not 693b)' },
400 { ids => [qw( 9870 9874 9875 9876 9877 )], gfx_target => 'gfx801',
401 product => 'Carrizo iGPU',
402 source => '[kernel] CHIP_CARRIZO, KFD 80001; [rae]; [hsakmt]' },
403 { ids => [qw( 67a0 67a1 67a2 67a8 67a9 67aa 67b0 67b1 67b8 67b9 67ba 67be )],
404 gfx_target => 'gfx701',
405 product => 'Hawaii: FirePro W9100, Radeon R9 290/390',
406 source => '[kernel] CHIP_HAWAII, KFD 70001 (only with amdgpu.exp_hw_support); [rae]; '
407 .'[hsakmt]' },
408 { ids => [qw( 1304 1305 1306 1307 1309 130a 130b 130c 130d 130e 130f 1310 1311 1312 1313
409 1315 1316 1317 1318 131b 131c 131d )],
410 gfx_target => 'gfx700',
411 product => 'Kaveri iGPU',
412 source => '[kernel] CHIP_KAVERI, KFD 70000; [rae]; [hsakmt]' },
413 { ids => [qw( 7310 7312 7318 7319 731a 731b 731e 731f )], gfx_target => 'gfx1010',
414 product => 'Navi 10: Radeon RX 5700/5700 XT/5600 XT, PRO W5700X',
415 source => '[kernel] CHIP_NAVI10, KFD 100100; [rae]; [hsakmt] (not 7319, 731b)' },
416 { ids => [qw( 7360 7362 )], gfx_target => 'gfx1011',
417 product => 'Navi 12: Radeon PRO V520/V540, PRO 5600M',
418 source => '[kernel] CHIP_NAVI12, KFD 100101; [rae]; [hsakmt]' },
419 { ids => [qw( 7340 7341 7347 734f )], gfx_target => 'gfx1012',
420 product => 'Navi 14: Radeon RX 5500/5500 XT/5300M, PRO W5300M',
421 source => '[kernel] CHIP_NAVI14, KFD 100102; [rae]; [hsakmt] (not 734f)' },
422 { ids => [qw( 13db 13f9 13fa 13fb 13fc 13fe 143f )], gfx_target => 'gfx1013',
423 product => 'Cyan Skillfish APU',
424 source => '[kernel] CHIP_CYAN_SKILLFISH, KFD 100103 for both its GC versions, 10.1.3 '
425 .'and 10.1.4 (13fe/143f read theirs from the hardware); [rae] (13f9 13fa 13fb 13fc); '
426 .'[hsakmt] (not 13db)' },
427 { ids => [qw( 73c0 73c1 73c3 73da 73db 73dc 73dd 73de 73df )], gfx_target => 'gfx1031',
428 product => 'Navi 22: Radeon RX 6700/6700 XT/6750 XT',
429 source => '[kernel] CHIP_NAVY_FLOUNDER, KFD 100301; [rae]; [hsakmt]' },
430 { ids => [qw( 73e0 73e1 73e2 73e3 73e8 73e9 73ea 73eb 73ec 73ed 73ef 73ff )],
431 gfx_target => 'gfx1032',
432 product => 'Navi 23: Radeon RX 6600/6600 XT',
433 source => '[kernel] CHIP_DIMGREY_CAVEFISH, KFD 100302; [rae]; [hsakmt] (not 73e3)' },
434 { ids => [qw( 163f )], gfx_target => 'gfx1033',
435 product => 'Van Gogh APU (AMD Custom GPU 0405)',
436 source => '[rae]; [hsakmt]; [kernel] KFD 100303 for GC 10.3.1 (Van Gogh)' },
437 { ids => [qw( 7420 7421 7422 7423 7424 743f )], gfx_target => 'gfx1034',
438 product => 'Navi 24: Radeon RX 6300 (7424), RX 6400/6500 XT (743f)',
439 source => '[kernel] CHIP_BEIGE_GOBY, KFD 100304; [rae] and [hsakmt] (not 7424)' },
440 { ids => [qw( 164d 1681 )], gfx_target => 'gfx1035',
441 product => 'Rembrandt iGPU (Radeon 660M / 680M)',
442 source => '[kernel] CHIP_YELLOW_CARP, KFD 100305; [rae]; [hsakmt]' },
443 );
444 }
445  
446  
447 467 ▶sub target {
Subroutine target: called CC=5 SCAR=16.1
Pod documented
448 467 my ( $class, $gfx ) = @_;
449 467 ▶ return unless defined $gfx && $gfx =~ /\Agfx[0-9a-f]+\z/i;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $gfx and $gfx =~ /\Agfx[0-9a-f]+\z/iu 7 460 467
Condition100%3/3
defined $gfx and $gfx =~ /\Agfx[0-9a-f]+\z/iu
!ll&&!rl&&r
61460
MC/DC100%2/2
defined $gfx and $gfx =~ /\Agfx[0-9a-f]+\z/iu
defined $gfx $gfx =~ /\Agfx[0-9a-f]+\z/iu
Truth table100%3/3
A and B
A= defined $gfxB= $gfx =~ /\Agfx[0-9a-f]+\z/iu
ABresult
0X0
100
111
450 460 $gfx = lc $gfx;
451 460 for my $row ($class->targets) {
452 3053 $class->_check_target_row($row);
453 3050 ▶ return $row if $row->{gfx_target} eq $gfx;
Branch: 1 branch
BranchTrueFalseTotal
if $row->{"gfx_target"} eq $gfx 454 2596 3050
454 }
455 3 return;
456 }
457  
458  
459 367 ▶sub for_device_id {
Subroutine for_device_id: called CC=4 SCAR=13.9
Pod documented
460 367 my ( $class, $id ) = @_;
461 367 ▶ $id = $class->_device_id($id) // return;
Condition100%2/2
$class->_device_id($id) // (return)
l!l
3589
MC/DC100%1/1
$class->_device_id($id) // (return)
$class->_device_id($id)
Truth table100%2/2
A
A= $class->_device_id($id)
Aresult
11
00
462 358 for my $row ($class->devices) {
463 2448 $class->_check_device_row($row);
464 2448 ▶ return $row if grep { lc($_) eq $id } @{ $row->{ids} };
Branch: 1 branch
BranchTrueFalseTotal
if grep {lc $_ eq $id;} @{$$row{"ids"};} 347 2101 2448
465 }
466 11 return;
467 }
468  
469 358 ▶sub gfx_target_for_device_id {
Subroutine gfx_target_for_device_id: called CC=2 SCAR=6.9
Pod documented
470 358 my ( $class, $id ) = @_;
471 358 ▶ my $row = $class->for_device_id($id) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $row = $class->for_device_id($id) or return 347 11 358
472 347 return lc $row->{gfx_target};
473 }
474  
475  
476 133 ▶sub gfx_target_from_version {
Subroutine gfx_target_from_version: called CC=7 SCAR=19.5
Pod documented
477 133 my ( $class, $version ) = @_;
478 133 ▶ return unless defined $version && $version =~ /\A\d+\z/ && $version > 0;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $version and $version =~ /\A\d+\z/u and $version > 0 32 101 133
Condition100%6/6
defined $version and $version =~ /\A\d+\z/u and $version > 0
!ll&&!rl&&r
428101
defined $version and $version =~ /\A\d+\z/u
!ll&&!rl&&r
13129
MC/DC100%3/3
defined $version and $version =~ /\A\d+\z/u and $version > 0
defined $version $version =~ /\A\d+\z/u $version > 0
Truth table100%4/4
A and B and C
A= defined $versionB= $version =~ /\A\d+\z/uC= $version > 0
ABCresult
0XX0
10X0
1100
1111
479 101 my $major = int($version / 10000) % 100;
480 101 my $minor = int($version / 100) % 100;
481 101 my $stepping = $version % 100;
482 101 ▶ return if $major == 0 || $minor > 15 || $stepping > 15;
Branch: 1 branch
BranchTrueFalseTotal
if $major == 0 or $minor > 15 or $stepping > 15 2 99 101
Condition83%5/6
$major == 0 or $minor > 15 or $stepping > 15
l!l&&r!l&&!r
1199
$major == 0 or $minor > 15
l!l&&r!l&&!r
01100
MC/DC66%2/3
$major == 0 or $minor > 15 or $stepping > 15
$major == 0 $minor > 15 $stepping > 15
Truth table75%3/4
A or B or C
A= $major == 0B= $minor > 15C= $stepping > 15
ABCresult
1XX1
01X1
0011
0000
483 99 return sprintf 'gfx%d%x%x', $major, $minor, $stepping;
484 }
485  
486  
487 349 ▶sub resolve {
Subroutine resolve: called CC=8 SCAR=20.8
Pod documented
488 349 my ( $class, %arg ) = @_;
489 349 my $table = $class->gfx_target_for_device_id($arg{device_id});
490 349 ▶ my $kfd = defined $arg{kfd_gfx_target} ? lc $arg{kfd_gfx_target} : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $arg{'kfd_gfx_target'} ? : 47 302 349
491 349 ▶ if (defined $kfd && defined $table && $kfd ne $table) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $kfd and defined $table and $kfd ne $table) 3 346 349
Condition100%6/6
defined $kfd and defined $table and $kfd ne $table
!ll&&!rl&&r
307393
defined $kfd and defined $table
!ll&&!rl&&r
302542
MC/DC100%3/3
defined $kfd and defined $table and $kfd ne $table
defined $kfd defined $table $kfd ne $table
Truth table100%4/4
A and B and C
A= defined $kfdB= defined $tableC= $kfd ne $table
ABCresult
0XX0
10X0
1100
1111
492 Rex::Logger::info(' AMD '.( $arg{name} // 'GPU' ).' [1002:'.$class->_device_id($arg{device_id})
493 3 ▶ .']: the running driver (KFD) reports '.$kfd.', the device table says '.$table
Condition50%1/2
$arg{"name"} // "GPU"
l!l
30
MC/DC0%0/1
$arg{"name"} // "GPU"
$arg{"name"}
Truth table50%1/2
A
A= $arg{"name"}
Aresult
11
00
494 .' -- using '.$kfd, 'warn');
495 }
496 349 ▶ my $gfx = $kfd // $table;
Condition100%3/3
$kfd // $table
l!l&&r!l&&!r
472966
MC/DC100%2/2
$kfd // $table
$kfd $table
Truth table100%3/3
A // B
A= $kfdB= $table
ABresult
1X1
011
000
497 349 my $row = $class->target($gfx);
498 return {
499 gfx_target => $gfx,
500 348 ▶ map { $_ => ( $row ? $row->{$_} : undef ) } qw( compute integrated driver matrix family )
Branch: 1 branch
BranchTrueFalseTotal
$row ? : 1705 35 1740
501 };
502 }
503  
504 # '0x1586' / '1586' / '1586\n' => '1586'; anything else => undef.
505 370 ▶sub _device_id {
Subroutine _device_id: called CC=3 SCAR=11.0
506 370 my ( $class, $id ) = @_;
507 370 ▶ return defined $id && $id =~ /\A(?:0x)?([0-9a-f]{4})\s*\z/i ? lc $1 : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $id && $id =~ /\A(?:0x)?([0-9a-f]{4})\s*\z/iu ? : 361 9 370
Condition100%3/3
defined $id and $id =~ /\A(?:0x)?([0-9a-f]{4})\s*\z/iu
!ll&&!rl&&r
36361
MC/DC100%2/2
defined $id and $id =~ /\A(?:0x)?([0-9a-f]{4})\s*\z/iu
defined $id $id =~ /\A(?:0x)?([0-9a-f]{4})\s*\z/iu
Truth table100%3/3
A and B
A= defined $idB= $id =~ /\A(?:0x)?([0-9a-f]{4})\s*\z/iu
ABresult
0X0
100
111
508 }
509  
510 3053 ▶sub _check_target_row {
Subroutine _check_target_row: called CC=11 SCAR=26.6
511 3053 my ( $class, $row ) = @_;
512 croak $class.'->targets: every row needs a gfx_target like gfx1151'
513 unless ref $row eq 'HASH' && defined $row->{gfx_target}
514 3053 ▶ && $row->{gfx_target} =~ /\Agfx[0-9a-f]+\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $row eq "HASH" and defined $row->{"gfx_target"} and $row->{"gfx_target"} =~ /\Agfx[0-9a-f]+\z/u 0 3053 3053
Condition33%2/6
ref $row eq "HASH" and defined $row->{"gfx_target"} and $row->{"gfx_target"} =~ /\Agfx[0-9a-f]+\z/u
!ll&&!rl&&r
003053
ref $row eq "HASH" and defined $row->{"gfx_target"}
!ll&&!rl&&r
003053
MC/DC0%0/3
ref $row eq "HASH" and defined $row->{"gfx_target"} and $row->{"gfx_target"} =~ /\Agfx[0-9a-f]+\z/u
ref $row eq "HASH" defined $row->{"gfx_target"} $row->{"gfx_target"} =~ /\Agfx[0-9a-f]+\z/u
Truth table25%1/4
A and B and C
A= ref $row eq "HASH"B= defined $row->{"gfx_target"}C= $row->{"gfx_target"} =~ /\Agfx[0-9a-f]+\z/u
ABCresult
0XX0
10X0
1100
1111
515 3053 for my $flag (qw( compute integrated )) {
516 croak $class.'->targets: '.$row->{gfx_target}.' '.$flag.' must be 0, 1 or undef'
517 6106 ▶ if defined $row->{$flag} && $row->{$flag} !~ /\A[01]\z/;
Branch: 1 branch
BranchTrueFalseTotal
if defined $row->{$flag} and not $row->{$flag} =~ /\A[01]\z/u 0 6106 6106
Condition66%2/3
defined $row->{$flag} and not $row->{$flag} =~ /\A[01]\z/u
!ll&&!rl&&r
161050
MC/DC0%0/2
defined $row->{$flag} and not $row->{$flag} =~ /\A[01]\z/u
defined $row->{$flag} not $row->{$flag} =~ /\A[01]\z/u
Truth table66%2/3
A and not(B)
A= defined $row->{$flag}B= not $row->{$flag} =~ /\A[01]\z/u
ABresult
0X0
100
111
518 }
519 croak $class.'->targets: '.$row->{gfx_target}.' driver must be inbox, dkms or undef'
520 3053 ▶ if defined $row->{driver} && !$DRIVERS{ $row->{driver} };
Branch: 1 branch
BranchTrueFalseTotal
if defined $row->{"driver"} and not $DRIVERS{$row->{"driver"}} 0 3053 3053
Condition66%2/3
defined $row->{"driver"} and not $DRIVERS{$row->{"driver"}}
!ll&&!rl&&r
35426990
MC/DC0%0/2
defined $row->{"driver"} and not $DRIVERS{$row->{"driver"}}
defined $row->{"driver"} not $DRIVERS{$row->{"driver"}}
Truth table66%2/3
A and not(B)
A= defined $row->{"driver"}B= not $DRIVERS{$row->{"driver"}}
ABresult
0X0
100
111
521 croak $class.'->targets: '.$row->{gfx_target}.' matrix must be instinct, radeon, ryzen or undef'
522 3053 ▶ if defined $row->{matrix} && !$MATRICES{ $row->{matrix} };
Branch: 1 branch
BranchTrueFalseTotal
if defined $row->{"matrix"} and not $MATRICES{$row->{"matrix"}} 3 3050 3053
Condition100%3/3
defined $row->{"matrix"} and not $MATRICES{$row->{"matrix"}}
!ll&&!rl&&r
36126893
MC/DC100%2/2
defined $row->{"matrix"} and not $MATRICES{$row->{"matrix"}}
defined $row->{"matrix"} not $MATRICES{$row->{"matrix"}}
Truth table100%3/3
A and not(B)
A= defined $row->{"matrix"}B= not $MATRICES{$row->{"matrix"}}
ABresult
0X0
100
111
523 3050 return;
524 }
525  
526 2448 ▶sub _check_device_row {
Subroutine _check_device_row: called CC=10 SCAR=31.1
527 2448 my ( $class, $row ) = @_;
528 croak $class.'->devices: every row needs ids => [...] and a gfx_target like gfx1151'
529 2448 unless ref $row eq 'HASH' && ref $row->{ids} eq 'ARRAY' && @{ $row->{ids} }
530 2448 ▶ && defined $row->{gfx_target} && $row->{gfx_target} =~ /\Agfx[0-9a-f]+\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $row eq "HASH" and ref $row->{"ids"} eq "ARRAY" and @{$row->{"ids"};} and defined $row->{"gfx_target"} and $row->{"gfx_target"} =~ /\Agfx[0-9a-f]+\z/u 0 2448 2448
Condition33%4/12
ref $row eq "HASH" and ref $row->{"ids"} eq "ARRAY" and @{$row->{"ids"};} and defined $row->{"gfx_target"} and $row->{"gfx_target"} =~ /\Agfx[0-9a-f]+\z/u
!ll&&!rl&&r
002448
ref $row eq "HASH" and ref $row->{"ids"} eq "ARRAY" and @{$row->{"ids"};} and defined $row->{"gfx_target"}
!ll&&!rl&&r
002448
ref $row eq "HASH" and ref $row->{"ids"} eq "ARRAY" and @{$row->{"ids"};}
!ll&&!rl&&r
002448
ref $row eq "HASH" and ref $row->{"ids"} eq "ARRAY"
!ll&&!rl&&r
002448
MC/DC0%0/5
ref $row eq "HASH" and ref $row->{"ids"} eq "ARRAY" and @{$row->{"ids"};} and defined $row->{"gfx_target"} and $row->{"gfx_target"} =~ /\Agfx[0-9a-f]+\z/u
ref $row eq "HASH" ref $row->{"ids"} eq "ARRAY" @{$row->{"ids"};} defined $row->{"gfx_target"} $row->{"gfx_target"} =~ /\Agfx[0-9a-f]+\z/u
Truth table16%1/6
A and B and C and D and E
A= ref $row eq "HASH"B= ref $row->{"ids"} eq "ARRAY"C= @{$row->{"ids"};}D= defined $row->{"gfx_target"}E= $row->{"gfx_target"} =~ /\Agfx[0-9a-f]+\z/u
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
531 2448 for my $id (@{ $row->{ids} }) {
532 10630 ▶ croak $class.'->devices: '.$row->{gfx_target}.' has a device ID that is not four hex '
Branch: 1 branch
BranchTrueFalseTotal
unless defined $id and $id =~ /\A[0-9a-f]{4}\z/iu 0 10630 10630
Condition20%1/5
defined $id and $id =~ /\A[0-9a-f]{4}\z/iu
!ll&&!rl&&r
0010630
$id // "undef"
l!l
00
MC/DC0%0/2
defined $id and $id =~ /\A[0-9a-f]{4}\z/iu
defined $id $id =~ /\A[0-9a-f]{4}\z/iu
MC/DC0%0/1
$id // "undef"
$id
Truth table33%1/3
A and B
A= defined $idB= $id =~ /\A[0-9a-f]{4}\z/iu
ABresult
0X0
100
111
Truth table0%0/2
A
A= $id
Aresult
11
00
533 .'digits: '.( $id // 'undef' )
534 unless defined $id && $id =~ /\A[0-9a-f]{4}\z/i;
535 }
536 2448 return;
537 }
538  
539 41 1;
540  
541 __END__
« lib/Rex/GPU/NVIDIA/Setup/UbuntuDrivers.pm ↑ Summary lib/Rex/GPU/AMD.pm »