NAME
Rex::GPU::AMD::Hardware - AMD GPU hardware data: PCI device ID to gfx target, gfx target to ROCm support (experimental)
VERSION
version 0.006
SYNOPSIS
use Rex::GPU::AMD::Hardware;
my $gfx = Rex::GPU::AMD::Hardware->gfx_target_for_device_id('1586'); # 'gfx1151'
my $row = Rex::GPU::AMD::Hardware->target($gfx);
print "ROCm-capable\n" if $row && $row->{compute};
# Your own rows, kept in your project's lib/
package My::AMD::Hardware;
use parent 'Rex::GPU::AMD::Hardware';
sub devices {
my ( $class ) = @_;
return (
{ ids => [qw( 744c )], gfx_target => 'gfx1100', product => 'RX 7900 XTX',
source => 'site inventory' },
$class->SUPER::devices,
);
}
DESCRIPTION
Experimental. The AMD hardware knowledge of Rex::GPU: which LLVM gfx target a PCI device ID is ("devices"), and what AMD supports for a gfx target ("targets") -- whether it is ROCm-capable (compute), integrated, and which kernel driver AMD supports for it. Rex::GPU::Detect asks it for every AMD GPU it finds (through "amd_hardware_class" in Rex::GPU::Detect), Rex::GPU::AMD for "install_driver" in Rex::GPU::AMD's choice of driver (through "hardware_class" in Rex::GPU::AMD).
A device ID without a row is unknown: gfx_target comes from the running driver if there is one, everything else stays undef, and "gpu_setup" in Rex::GPU installs no driver for it.
targets
my @rows = Rex::GPU::AMD::Hardware->targets;
Experimental. What AMD supports for each LLVM gfx target, one hashref per target:
{ gfx_target => 'gfx1151', # required, "gfx" and lowercase hex
compute => 1, # 1 ROCm-capable, 0 known not, undef unknown
integrated => 1, # 1 integrated (APU), 0 discrete, undef unknown
driver => 'inbox', # kernel driver AMD supports: 'inbox' (the
# distribution kernel's amdgpu), 'dkms'
# (amdgpu-dkms from repo.radeon.com), undef
matrix => 'ryzen', # the table of AMD's ROCm compatibility
# matrix listing it: 'instinct', 'radeon',
# 'ryzen' (Ryzen APU), undef (none)
family => 'RDNA 3.5 ...', # for messages
source => '...', # where the row comes from
rocm_last => '6.4', # optional: last ROCm release supporting it
}
compute is the truthful "ROCm-capable" flag: "gpu_setup" in Rex::GPU installs a driver only for compute => 1 (and an integrated one only with amd_integrated => 1). driver is what "install_driver" in Rex::GPU::AMD's method => 'auto' follows. A target without a row has all three undef. Croaks, naming the row, for a row without a valid gfx_target, a compute or integrated other than 0, 1 or undef, a driver other than inbox, dkms or undef, or a matrix other than instinct, radeon, ryzen or undef.
The built-in rows, all checked 2026-10-31 (the source comment above the tables in the module has every URL and revision):
compute => 1: every target AMD lists for Linux in ROCm Core SDK 10.1.0, the latest release -- Instinctgfx950,gfx942,gfx90a,gfx908; Radeongfx1201,gfx1200,gfx1100,gfx1101,gfx1102,gfx1030; Ryzen APUsgfx1151,gfx1150,gfx1152,gfx1153,gfx1103. The old ROCm line's last release (7.2.4) lists none that 10.1.0 lacks. The verdict is per target: the Radeon RX 6800/6900 (gfx1030) count although AMD names only the PRO W6800 and V620 for it.compute => 0:gfx906(MI50/MI60, Radeon VII; deprecated in ROCm 6.0-6.3.3, unsupported from 6.4.0,rocm_last => '6.3.3'),gfx900(MI25, Vega 10; unsupported in every release checked), and the older or integrated targets no release checked (5.7.1, 6.0.0-7.2.4, 7.14.0-10.1.0) lists:gfx700,gfx701,gfx801,gfx802,gfx803,gfx902,gfx904,gfx90c,gfx1010-gfx1013,gfx1031-gfx1036.gfx1036is what the running driver reports for the Raphael and Mendocino iGPUs (Ryzen 7000 desktop and server CPUs).No row (unknown): targets the kernel and LLVM know but AMD makes no support statement for --
gfx1154,gfx1170-gfx1172,gfx1250,gfx1251.integrated: LLVM's dGPU/APU column (AMDGPUUsage).gfx942covers the MI300X and the MI300A (an APU); it is0-- LLVM files it as dGPU, and the MI300A is a datacenter accelerator, not client integrated graphics.driver:dkmsfor the Instinct and Radeon targets (AMD: "For Instinct and Radeon devices, install the AMD GPU Driver (amdgpu)", which isamdgpu-dkms),inboxfor the Ryzen APU targets (AMD: "Supported Ryzen APUs require the inbox kernel driver included with Ubuntu"),undeffor everycompute => 0target.matrix: the table of AMD's ROCm 10.1.0 compatibility matrix that lists the target --instinct(gfx950,gfx942,gfx90a,gfx908),radeon(gfx1201,gfx1200,gfx1100,gfx1101,gfx1102,gfx1030),ryzen(the Ryzen APU table:gfx1151,gfx1150,gfx1152,gfx1153,gfx1103) -- andundeffor everycompute => 0target. Each table has its own supported operating systems; this field, notfamily, tells an Instinct from a Radeon. No built-in target is in two tables (gfx942is the MI300X and the MI300A, both Instinct). Only the value is checked: a row of your own withoutmatrixstays valid.
devices
my @rows = Rex::GPU::AMD::Hardware->devices;
Experimental. Which gfx target a PCI device ID (vendor 1002) is, one hashref per group of IDs:
{ ids => [qw( 1586 )], # required: explicit four-hex-digit IDs
gfx_target => 'gfx1151', # required
product => 'Radeon 8065S ...', # for messages
source => '...' }
The IDs are an explicit list, never a range: AMD interleaves GPU families in its device ID space. Croaks, naming the row, for a row without IDs, with an ID that is not four hex digits, or without a valid gfx_target.
The built-in rows, all checked 2026-10-31: an ID is listed only when a source maps it to its gfx target (the Linux kernel's amdgpu ID table and KFD, AMD's rocm_agent_enumerator, libhsakmt or rocprofiler-compute, or an AMD product list joined with libdrm's amdgpu.ids names), the ID itself is known (kernel, libdrm or pci.ids), and no source contradicts it. Every listed ID has one gfx target across all its known revisions. Left out on purpose, so they fall back to the running driver's report, else stay unknown:
1902(Radeon 820M/840M): rocprofiler-compute saysgfx1153, but AMD's own pages list the 820M on it asgfx1152, and disagree with each other for the 840M.7460,7461(Radeon PRO V710):gfx1101per AMD's ROCm documentation,gfx1100perrocm_agent_enumerator.164ERaphael,1506Mendocino,13C0Granite Ridge -- the Radeon 610M iGPUs of Ryzen 7000/9000 desktop and server CPUs: no AMD source maps them. Onceamdgpuruns, it reports Raphael and Mendocino asgfx1036(compute => 0).98E4(Stoney, sources disagree), IDs only named in libdrm orpci.ids(744BW7900D, Navi 3373F0,7487,748B,749F), and IDs found in one tool's table and in no device list (74B4,74BC,75A2,75B2,75C1,75D1,13F3).
target
my $row = Rex::GPU::AMD::Hardware->target('gfx1151'); # hashref or undef
Experimental. The first "targets" row for a gfx target (case does not matter), or undef.
for_device_id
my $row = Rex::GPU::AMD::Hardware->for_device_id('1586'); # hashref or undef
Experimental. The first "devices" row listing a PCI device ID (four hex digits, with or without 0x, any case), or undef -- also for undef and anything malformed.
gfx_target_for_device_id
my $gfx = Rex::GPU::AMD::Hardware->gfx_target_for_device_id('1586'); # 'gfx1151'
Experimental. The gfx_target of "for_device_id", or undef.
gfx_target_from_version
my $gfx = Rex::GPU::AMD::Hardware->gfx_target_from_version(110501); # 'gfx1151'
Experimental. The LLVM target name for a KFD topology gfx_target_version (decimal major*10000 + minor*100 + stepping): gfx, the major version in decimal, minor and stepping as one hex digit each -- 110501 is gfx1151, 90010 gfx90a, 90402 gfx942. undef for 0 (a CPU node), undef and anything that is not a number, or a minor/stepping above 15.
resolve
my $hw = Rex::GPU::AMD::Hardware->resolve(
device_id => '1586', # optional
kfd_gfx_target => 'gfx1151', # optional: what the running driver reports
name => '...', # optional, for the message
);
# { gfx_target => 'gfx1151', compute => 1, integrated => 1, driver => 'inbox',
# matrix => 'ryzen', family => '...' }
Experimental. The verdict for one GPU: the gfx target the running driver reports (KFD topology) wins over the "devices" table; when both are known and differ, a warning names both and the KFD one is used. The other keys (compute, integrated, driver, matrix, family) come from that target's "targets" row, all undef without one (and without a gfx target).
SEE ALSO
Rex::GPU::AMD, Rex::GPU::Detect, https://rocm.docs.amd.com/en/latest/compatibility/compatibility-matrix.html
SUPPORT
Issues
Please report bugs and feature requests at https://github.com/Getty/rex-gpu/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <getty@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.