configs,gpu-compute: Add support for gfx902/Raven

This patch adds support for a gfx902 Vega APU, ripping the
appropriate values for device_id from the ROCm Thunk
(src/topology.c).

Note: gfx902 isn't officially supported by ROCm. This
means that it may not work for all programs. In particular,
rocBLAS is incompatible with gfx902, so anything that uses
rocBLAS won't be able to run with gfx902.

Change-Id: I48893e7cc9c7e52275fdfd22314f371a9db8e90a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/47530
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Kyle Roarty
2021-06-30 16:47:49 -05:00
committed by Bobby R. Bruce
parent 897c0c11ed
commit e2e18d41e1
5 changed files with 19 additions and 5 deletions

View File

@@ -189,7 +189,9 @@ parser.add_argument("--m-type", type=int, default=5,
"between 0-7")
parser.add_argument("--gfx-version", type=str, default='gfx801',
help="Gfx version for gpu: gfx801, gfx803, gfx900")
choices=GfxVersion.vals,
help="Gfx version for gpu"
"Note: gfx902 is not fully supported by ROCm")
Ruby.define_options(parser)
@@ -683,7 +685,7 @@ if args.dgpu:
elif args.gfx_version == 'gfx900':
hsaTopology.createVegaTopology(args)
else:
assert (args.gfx_version in ['gfx801']),\
assert (args.gfx_version in ['gfx801', 'gfx902']),\
"Incorrect gfx version for APU"
hsaTopology.createCarrizoTopology(args)

View File

@@ -434,14 +434,19 @@ def createCarrizoTopology(options):
# must show valid kaveri gpu id or massive meltdown
file_append((node_dir, 'gpu_id'), 2765)
gfx_dict = { "gfx801": {"name": "Carrizo\n", "id": 39028},
"gfx902": {"name": "Raven\n", "id": 5597}}
# must have marketing name
file_append((node_dir, 'name'), 'Carrizo\n')
file_append((node_dir, 'name'), gfx_dict[options.gfx_version]["name"])
mem_banks_cnt = 1
# Should be the same as the render driver filename (dri/renderD<drm_num>)
drm_num = 128
device_id = gfx_dict[options.gfx_version]["id"]
# populate global node properties
# NOTE: SIMD count triggers a valid GPU agent creation
node_prop = 'cpu_cores_count %s\n' % options.num_cpus + \
@@ -462,7 +467,7 @@ def createCarrizoTopology(options):
'simd_per_cu %s\n' % options.simds_per_cu + \
'max_slots_scratch_cu 32\n' + \
'vendor_id 4098\n' + \
'device_id 39028\n' + \
'device_id %s\n' % device_id + \
'location_id 8\n' + \
'drm_render_minor %s\n' % drm_num + \
'max_engine_clk_fcompute %s\n' \

View File

@@ -52,6 +52,7 @@ class GfxVersion(ScopedEnum): vals = [
'gfx801',
'gfx803',
'gfx900',
'gfx902',
]
class PoolManager(SimObject):

View File

@@ -351,6 +351,7 @@ GPUComputeDriver::ioctl(ThreadContext *tc, unsigned req, Addr ioc_buf)
break;
case GfxVersion::gfx803:
case GfxVersion::gfx900:
case GfxVersion::gfx902:
// Taken from SVM_USE_BASE in Linux kernel
args->process_apertures[i].gpuvm_base = 0x1000000ull;
// Taken from AMDGPU_GMC_HOLE_START in Linux kernel
@@ -384,6 +385,7 @@ GPUComputeDriver::ioctl(ThreadContext *tc, unsigned req, Addr ioc_buf)
} else {
switch (gfxVersion) {
case GfxVersion::gfx801:
case GfxVersion::gfx902:
args->process_apertures[i].gpu_id = 2765;
break;
default:
@@ -644,6 +646,7 @@ GPUComputeDriver::ioctl(ThreadContext *tc, unsigned req, Addr ioc_buf)
break;
case GfxVersion::gfx803:
case GfxVersion::gfx900:
case GfxVersion::gfx902:
// Taken from SVM_USE_BASE in Linux kernel
ape_args->gpuvm_base = 0x1000000ull;
// Taken from AMDGPU_GMC_HOLE_START in Linux kernel
@@ -668,6 +671,7 @@ GPUComputeDriver::ioctl(ThreadContext *tc, unsigned req, Addr ioc_buf)
} else {
switch (gfxVersion) {
case GfxVersion::gfx801:
case GfxVersion::gfx902:
ape_args->gpu_id = 2765;
break;
default:
@@ -717,7 +721,7 @@ GPUComputeDriver::ioctl(ThreadContext *tc, unsigned req, Addr ioc_buf)
TypedBufferArg<kfd_ioctl_alloc_memory_of_gpu_args> args(ioc_buf);
args.copyIn(virt_proxy);
assert(isdGPU);
assert(isdGPU || gfxVersion == GfxVersion::gfx902);
assert((args->va_addr % TheISA::PageBytes) == 0);
GEM5_VAR_USED Addr mmap_offset = 0;

View File

@@ -90,8 +90,10 @@ class GPUComputeDriver final : public EmulatedDriver
switch (gfxVersion) {
case GfxVersion::gfx801:
case GfxVersion::gfx803:
case GfxVersion::gfx902:
return 4;
case GfxVersion::gfx900:
// gfx900 supports large BAR, so it has a larger doorbell
return 8;
default:
fatal("Invalid GPU type\n");