gpu-compute: Add mmap functionality to GPURenderDriver

dGPUs mmap the GPURenderDriver, however it doesn't appear that they do
anything with it. This patch implements the mmap function by just
returning the address provided, while not doing anything else

Change-Id: Ia010a2aebcf7e2c75e22d93dfb440937d1bef3b1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/47523
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Kyle Roarty
2021-06-30 15:54:33 -05:00
committed by Matt Sinclair
parent 1fd4b1ce7d
commit 76888a9cca
2 changed files with 14 additions and 1 deletions

View File

@@ -41,7 +41,7 @@ GPURenderDriver::GPURenderDriver(const GPURenderDriverParams &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
* descriptor when opened.
*/
int
GPURenderDriver::open(ThreadContext *tc, int mode, int flags)
@@ -52,4 +52,14 @@ GPURenderDriver::open(ThreadContext *tc, int mode, int flags)
return tgt_fd;
}
/* DGPUs try to mmap the driver file. It doesn't appear they do anything
* with it, so we just return the address that's provided
*/
Addr GPURenderDriver::mmap(ThreadContext *tc, Addr start, uint64_t length,
int prot, int tgt_flags, int tgt_fd, off_t offset)
{
warn_once("GPURenderDriver::mmap returning start address %#x", start);
return start;
}
} // namespace gem5

View File

@@ -50,6 +50,9 @@ class GPURenderDriver final : public EmulatedDriver
{
return -EBADF;
}
Addr mmap(ThreadContext *tc, Addr start, uint64_t length,
int prot, int tgt_flags, int tgt_fd, off_t offset) override;
};
} // namespace gem5