configs,gpu-compute: Add render driver needed for ROCm 4
ROCm 4 utilizes the render driver located at /dev/dri/renderDXXX. This patch implements a very simple driver that just returns a file descriptor when opened, as testing has shown that's all that's needed Change-Id: I65602346cbf17b2dc80e114046ebf5c9830a1507 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/46244 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
This commit is contained in:
@@ -436,6 +436,9 @@ gpu_driver = GPUComputeDriver(filename = "kfd", isdGPU = args.dgpu,
|
||||
gfxVersion = args.gfx_version,
|
||||
dGPUPoolID = 1, m_type = args.m_type)
|
||||
|
||||
renderDriNum = 128
|
||||
render_driver = GPURenderDriver(filename = f'dri/renderD{renderDriNum}')
|
||||
|
||||
# Creating the GPU kernel launching components: that is the HSA
|
||||
# packet processor (HSAPP), GPU command processor (CP), and the
|
||||
# dispatcher.
|
||||
@@ -498,7 +501,8 @@ else:
|
||||
"HSA_ENABLE_SDMA=0"]
|
||||
|
||||
process = Process(executable = executable, cmd = [args.cmd]
|
||||
+ args.options.split(), drivers = [gpu_driver], env = env)
|
||||
+ args.options.split(),
|
||||
drivers = [gpu_driver, render_driver], env = env)
|
||||
|
||||
for cpu in cpu_list:
|
||||
cpu.createThreads()
|
||||
|
||||
@@ -156,6 +156,9 @@ def createVegaTopology(options):
|
||||
file_append((node_dir, 'gpu_id'), 22124)
|
||||
file_append((node_dir, 'name'), 'Vega\n')
|
||||
|
||||
# Should be the same as the render driver filename (dri/renderD<drm_num>)
|
||||
drm_num = 128
|
||||
|
||||
# 96 in real Vega
|
||||
# Random comment for comparison purposes
|
||||
caches = 0
|
||||
@@ -200,7 +203,7 @@ def createVegaTopology(options):
|
||||
'vendor_id 4098\n' + \
|
||||
'device_id 26720\n' + \
|
||||
'location_id 1024\n' + \
|
||||
'drm_render_minor 128\n' + \
|
||||
'drm_render_minor %s\n' % drm_num + \
|
||||
'hive_id 0\n' + \
|
||||
'num_sdma_engines 2\n' + \
|
||||
'num_sdma_xgmi_engines 0\n' + \
|
||||
@@ -329,6 +332,9 @@ def createFijiTopology(options):
|
||||
file_append((node_dir, 'gpu_id'), 50156)
|
||||
file_append((node_dir, 'name'), 'Fiji\n')
|
||||
|
||||
# Should be the same as the render driver filename (dri/renderD<drm_num>)
|
||||
drm_num = 128
|
||||
|
||||
# Real Fiji shows 96, but building that topology is complex and doesn't
|
||||
# appear to be required for anything.
|
||||
caches = 0
|
||||
@@ -373,6 +379,7 @@ def createFijiTopology(options):
|
||||
'vendor_id 4098\n' + \
|
||||
'device_id 29440\n' + \
|
||||
'location_id 512\n' + \
|
||||
'drm_render_minor %s\n' % drm_num + \
|
||||
'max_engine_clk_fcompute %s\n' \
|
||||
% int(toFrequency(options.gpu_clock) / 1e6) + \
|
||||
'local_mem_size 4294967296\n' + \
|
||||
@@ -424,6 +431,9 @@ def createCarrizoTopology(options):
|
||||
|
||||
mem_banks_cnt = 1
|
||||
|
||||
# Should be the same as the render driver filename (dri/renderD<drm_num>)
|
||||
drm_num = 128
|
||||
|
||||
# populate global node properties
|
||||
# NOTE: SIMD count triggers a valid GPU agent creation
|
||||
node_prop = 'cpu_cores_count %s\n' % options.num_cpus + \
|
||||
@@ -446,6 +456,7 @@ def createCarrizoTopology(options):
|
||||
'vendor_id 4098\n' + \
|
||||
'device_id 39028\n' + \
|
||||
'location_id 8\n' + \
|
||||
'drm_render_minor %s\n' % drm_num + \
|
||||
'max_engine_clk_fcompute %s\n' \
|
||||
% int(toFrequency(options.gpu_clock) / 1e6) + \
|
||||
'local_mem_size 0\n' + \
|
||||
|
||||
@@ -254,6 +254,10 @@ class GPUComputeDriver(EmulatedDriver):
|
||||
# default value: 5/C_RO_S (only allow caching in GL2 for read. Shared)
|
||||
m_type = Param.Int("Default MTYPE for cache. Valid values between 0-7");
|
||||
|
||||
class GPURenderDriver(EmulatedDriver):
|
||||
type = 'GPURenderDriver'
|
||||
cxx_header = 'gpu-compute/gpu_render_driver.hh'
|
||||
|
||||
class GPUDispatcher(SimObject):
|
||||
type = 'GPUDispatcher'
|
||||
cxx_header = 'gpu-compute/dispatcher.hh'
|
||||
|
||||
@@ -52,6 +52,7 @@ Source('gpu_command_processor.cc')
|
||||
Source('gpu_compute_driver.cc')
|
||||
Source('gpu_dyn_inst.cc')
|
||||
Source('gpu_exec_context.cc')
|
||||
Source('gpu_render_driver.cc')
|
||||
Source('gpu_static_inst.cc')
|
||||
Source('gpu_tlb.cc')
|
||||
Source('lds_state.cc')
|
||||
|
||||
50
src/gpu-compute/gpu_render_driver.cc
Normal file
50
src/gpu-compute/gpu_render_driver.cc
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Kyle Roarty
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met: redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer;
|
||||
* redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution;
|
||||
* neither the name of the copyright holders nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "gpu-compute/gpu_render_driver.hh"
|
||||
|
||||
#include "params/GPURenderDriver.hh"
|
||||
#include "sim/fd_entry.hh"
|
||||
|
||||
GPURenderDriver::GPURenderDriver(const GPURenderDriverParams &p)
|
||||
: EmulatedDriver(p)
|
||||
{
|
||||
}
|
||||
|
||||
/* ROCm 4 utilizes the render driver located at /dev/dri/renderDXXX. This
|
||||
* patch implements a very simple driver that just returns a file
|
||||
* descriptor when opened, as testing has shown that's all that's needed
|
||||
*/
|
||||
int
|
||||
GPURenderDriver::open(ThreadContext *tc, int mode, int flags)
|
||||
{
|
||||
auto process = tc->getProcessPtr();
|
||||
auto device_fd_entry = std::make_shared<DeviceFDEntry>(this, filename);
|
||||
int tgt_fd = process->fds->allocFD(device_fd_entry);
|
||||
return tgt_fd;
|
||||
}
|
||||
52
src/gpu-compute/gpu_render_driver.hh
Normal file
52
src/gpu-compute/gpu_render_driver.hh
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Kyle Roarty
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met: redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer;
|
||||
* redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution;
|
||||
* neither the name of the copyright holders nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __GPU_COMPUTE_GPU_RENDER_DRIVER_HH__
|
||||
#define __GPU_COMPUTE_GPU_RENDER_DRIVER_HH__
|
||||
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "sim/emul_driver.hh"
|
||||
#include "sim/process.hh"
|
||||
|
||||
struct GPURenderDriverParams;
|
||||
|
||||
class GPURenderDriver final : public EmulatedDriver
|
||||
{
|
||||
public:
|
||||
GPURenderDriver(const GPURenderDriverParams &p);
|
||||
|
||||
int open(ThreadContext *tc, int mode, int flags) override;
|
||||
|
||||
int
|
||||
ioctl(ThreadContext *tc, unsigned req, Addr buf)
|
||||
{
|
||||
return -EBADF;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user