Kyle Roarty has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/32678 )

Change subject: misc: Fix db_offset calculation
......................................................................

misc: Fix db_offset calculation

db_offset used to be calculated through pointer arithmetic. Pointer
arithmetic increments the address by the size of the data type the
pointer is pointing at. In the previous db_offset calculation, that
was a uint32_t, which means the input was multiplied by 4, which is
sizeof(uint32_t)

This patch multiplies the input value by sizeof(uint32_t) before
assigning it to db_offset.

Change-Id: I9042560303ae6b8b1054b98e9a16a9da27843bb2
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32678
Reviewed-by: Matt Sinclair <mattdsincl...@gmail.com>
Reviewed-by: Alexandru Duțu <alexandru.d...@amd.com>
Maintainer: Matt Sinclair <mattdsincl...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/dev/hsa/hw_scheduler.cc
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Alexandru Duțu: Looks good to me, approved
Matt Sinclair: Looks good to me, but someone else must approve; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/dev/hsa/hw_scheduler.cc b/src/dev/hsa/hw_scheduler.cc
index 8523be9..f25839d 100644
--- a/src/dev/hsa/hw_scheduler.cc
+++ b/src/dev/hsa/hw_scheduler.cc
@@ -95,7 +95,7 @@
     // #define VOID_PTR_ADD32(ptr,n)
     //     (void*)((uint32_t*)(ptr) + n)/*ptr + offset*/
     // (Addr)VOID_PTR_ADD32(0, queue_id)
-    Addr db_offset = queue_id;
+    Addr db_offset = sizeof(uint32_t)*queue_id;
     if (dbMap.find(db_offset) != dbMap.end()) {
         panic("Creating an already existing queue (queueID %d)", queue_id);
     }
@@ -346,7 +346,7 @@
     // #define VOID_PTR_ADD32(ptr,n)
     //     (void*)((uint32_t*)(ptr) + n)/*ptr + offset*/
     // (Addr)VOID_PTR_ADD32(0, queue_id)
-    Addr db_offset = queue_id;
+    Addr db_offset = sizeof(uint32_t)*queue_id;
     auto dbmap_iter = dbMap.find(db_offset);
     if (dbmap_iter == dbMap.end()) {
         panic("Destroying a non-existing queue (db_offset %x)",

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

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I9042560303ae6b8b1054b98e9a16a9da27843bb2
Gerrit-Change-Number: 32678
Gerrit-PatchSet: 3
Gerrit-Owner: Kyle Roarty <kyleroarty1...@gmail.com>
Gerrit-Reviewer: Alexandru Duțu <alexandru.d...@amd.com>
Gerrit-Reviewer: Anthony Gutierrez <anthony.gutier...@amd.com>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: Kyle Roarty <kyleroarty1...@gmail.com>
Gerrit-Reviewer: Matt Sinclair <mattdsincl...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-CC: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-CC: Bradford Beckmann <bradford.beckm...@gmail.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to