gpu-compute: Set LDS and Scratch apertures in FS
The LDS and scratch aperture base and limits are hardcoded to some values that are useful for SE mode. In reality, these are chosen by the driver so we need to honor whatever values the driver passes so that when addresses are calculated they fall into the correct aperture to route flat instructions to those apertures. This overwrites the default hardcoded values for LDS and scratch base and limit using the values providing by the driver in a MAP_PROCESS packet. Change-Id: I0e194a26631f697819d8aaecf1bf346a7b7c7026 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/61656 Maintainer: Matt Sinclair <mattdsinclair@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
This commit is contained in:
@@ -619,6 +619,16 @@ PM4PacketProcessor::mapProcess(PM4Queue *q, PM4MapProcess *pkt)
|
||||
gpuDevice->getVM().setPageTableBase(vmid, pkt->ptBase);
|
||||
gpuDevice->CP()->shader()->setHwReg(HW_REG_SH_MEM_BASES, pkt->shMemBases);
|
||||
|
||||
// Setup the apertures that gem5 uses. These values are bits [63:48].
|
||||
Addr lds_base = (Addr)bits(pkt->shMemBases, 31, 16) << 48;
|
||||
Addr scratch_base = (Addr)bits(pkt->shMemBases, 15, 0) << 48;
|
||||
|
||||
// There does not seem to be any register for the limit, but the driver
|
||||
// assumes scratch and LDS have a 4GB aperture, so use that.
|
||||
gpuDevice->CP()->shader()->setLdsApe(lds_base, lds_base + 0xFFFFFFFF);
|
||||
gpuDevice->CP()->shader()->setScratchApe(scratch_base,
|
||||
scratch_base + 0xFFFFFFFF);
|
||||
|
||||
delete pkt;
|
||||
decodeNext(q);
|
||||
}
|
||||
|
||||
@@ -136,12 +136,26 @@ class Shader : public ClockedObject
|
||||
return _ldsApe;
|
||||
}
|
||||
|
||||
void
|
||||
setLdsApe(Addr base, Addr limit)
|
||||
{
|
||||
_ldsApe.base = base;
|
||||
_ldsApe.limit = limit;
|
||||
}
|
||||
|
||||
const ApertureRegister&
|
||||
scratchApe() const
|
||||
{
|
||||
return _scratchApe;
|
||||
}
|
||||
|
||||
void
|
||||
setScratchApe(Addr base, Addr limit)
|
||||
{
|
||||
_scratchApe.base = base;
|
||||
_scratchApe.limit = limit;
|
||||
}
|
||||
|
||||
bool
|
||||
isGpuVmApe(Addr addr) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user