dev-amdgpu: Update SDMA checkpointing
Patch https://gem5-review.googlesource.com/c/public/gem5/+/70040 added support for a variable number of SDMA engines to support newer GPU models. As part of this an SDMA IDs map was added to map from SDMA ID number to the SDMA SimObject pointer. In order to get the correct pointer in unserialize now, we need to store the ID in the checkpoint and use that to index the new map. We can't simply assign using the loop variable as the SDMAs might not be in order in the checkpoint and additionally the checkpoint contains both the gfx and page offset for the SDMA engines, so each SDMA is inserted into the SDMA offset map (sdmaEngs) twice. Change-Id: I08e9a8d785f467b6eebff8ab0a9336851c87258d Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/70878 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:
@@ -604,7 +604,7 @@ AMDGPUDevice::serialize(CheckpointOut &cp) const
|
||||
idx = 0;
|
||||
for (auto & it : sdmaEngs) {
|
||||
sdma_engs_offset[idx] = it.first;
|
||||
sdma_engs[idx] = idx;
|
||||
sdma_engs[idx] = it.second->getId();
|
||||
++idx;
|
||||
}
|
||||
|
||||
@@ -675,8 +675,9 @@ AMDGPUDevice::unserialize(CheckpointIn &cp)
|
||||
UNSERIALIZE_ARRAY(sdma_engs, sizeof(sdma_engs)/sizeof(sdma_engs[0]));
|
||||
|
||||
for (int idx = 0; idx < sdma_engs_size; ++idx) {
|
||||
assert(sdmaIds.count(idx));
|
||||
SDMAEngine *sdma = sdmaIds[idx];
|
||||
int sdma_id = sdma_engs[idx];
|
||||
assert(sdmaIds.count(sdma_id));
|
||||
SDMAEngine *sdma = sdmaIds[sdma_id];
|
||||
sdmaEngs.insert(std::make_pair(sdma_engs_offset[idx], sdma));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,6 +165,7 @@ class SDMAEngine : public DmaVirtDevice
|
||||
void setGPUDevice(AMDGPUDevice *gpu_device);
|
||||
|
||||
void setId(int _id) { id = _id; }
|
||||
int getId() const { return id; }
|
||||
/**
|
||||
* Returns the client id for the Interrupt Handler.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user