gem5-dev@gem5.org

The gem5 Developer List

View all threads

[XS] Change in gem5/gem5[develop]: dev-amdgpu: Update SDMA checkpointing

MP
Matthew Poremba (Gerrit)
Tue, May 23, 2023 2:28 PM

Matthew Poremba has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/70878?usp=email )

Change subject: dev-amdgpu: Update SDMA checkpointing
......................................................................

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

M src/dev/amdgpu/amdgpu_device.cc
M src/dev/amdgpu/sdma_engine.hh
2 files changed, 5 insertions(+), 3 deletions(-)

Approvals:
Matt Sinclair: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass

diff --git a/src/dev/amdgpu/amdgpu_device.cc
b/src/dev/amdgpu/amdgpu_device.cc
index f58d1f7..7037e6f 100644
--- a/src/dev/amdgpu/amdgpu_device.cc
+++ b/src/dev/amdgpu/amdgpu_device.cc
@@ -604,7 +604,7 @@
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 @@
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));
        }
    }
    

diff --git a/src/dev/amdgpu/sdma_engine.hh b/src/dev/amdgpu/sdma_engine.hh
index 1e4f965..bcbd497 100644
--- a/src/dev/amdgpu/sdma_engine.hh
+++ b/src/dev/amdgpu/sdma_engine.hh
@@ -165,6 +165,7 @@
void setGPUDevice(AMDGPUDevice *gpu_device);

  void setId(int _id) { id = _id; }
  • int getId() const { return id; }
    /**
    • Returns the client id for the Interrupt Handler.
      */

--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/70878?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I08e9a8d785f467b6eebff8ab0a9336851c87258d
Gerrit-Change-Number: 70878
Gerrit-PatchSet: 2
Gerrit-Owner: Matthew Poremba matthew.poremba@amd.com
Gerrit-Reviewer: Matt Sinclair mattdsinclair@gmail.com
Gerrit-Reviewer: Matthew Poremba matthew.poremba@amd.com
Gerrit-Reviewer: VISHNU RAMADAS vramadas@wisc.edu
Gerrit-Reviewer: kokoro noreply+kokoro@google.com

Matthew Poremba has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/70878?usp=email ) Change subject: dev-amdgpu: Update SDMA checkpointing ...................................................................... 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> --- M src/dev/amdgpu/amdgpu_device.cc M src/dev/amdgpu/sdma_engine.hh 2 files changed, 5 insertions(+), 3 deletions(-) Approvals: Matt Sinclair: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/dev/amdgpu/amdgpu_device.cc b/src/dev/amdgpu/amdgpu_device.cc index f58d1f7..7037e6f 100644 --- a/src/dev/amdgpu/amdgpu_device.cc +++ b/src/dev/amdgpu/amdgpu_device.cc @@ -604,7 +604,7 @@ 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 @@ 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)); } } diff --git a/src/dev/amdgpu/sdma_engine.hh b/src/dev/amdgpu/sdma_engine.hh index 1e4f965..bcbd497 100644 --- a/src/dev/amdgpu/sdma_engine.hh +++ b/src/dev/amdgpu/sdma_engine.hh @@ -165,6 +165,7 @@ void setGPUDevice(AMDGPUDevice *gpu_device); void setId(int _id) { id = _id; } + int getId() const { return id; } /** * Returns the client id for the Interrupt Handler. */ -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/70878?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I08e9a8d785f467b6eebff8ab0a9336851c87258d Gerrit-Change-Number: 70878 Gerrit-PatchSet: 2 Gerrit-Owner: Matthew Poremba <matthew.poremba@amd.com> Gerrit-Reviewer: Matt Sinclair <mattdsinclair@gmail.com> Gerrit-Reviewer: Matthew Poremba <matthew.poremba@amd.com> Gerrit-Reviewer: VISHNU RAMADAS <vramadas@wisc.edu> Gerrit-Reviewer: kokoro <noreply+kokoro@google.com>