Anthony Gutierrez has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/29940 )
Change subject: gpu-compute: Fix LDS out-of-bounds behavior
......................................................................
gpu-compute: Fix LDS out-of-bounds behavior
The LDS is capable of handling out-of-bounds accesses,
that is, accesses that are outside the bounds of the
chunk allocated to a WG. Currently, the simulator asserts
on these accesses. This patch changes the behavior of the
LDS to return 0 for reads and dropping writes that are
out-of-bounds.
Change-Id: I5f467d0f52113e8565e1a3029e82fb89cc6f07ea
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/29940
Maintainer: Anthony Gutierrez <anthony.gutier...@amd.com>
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Matt Sinclair <mattdsincl...@gmail.com>
---
M src/gpu-compute/lds_state.hh
1 file changed, 16 insertions(+), 6 deletions(-)
Approvals:
Matt Sinclair: Looks good to me, approved
Anthony Gutierrez: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/gpu-compute/lds_state.hh b/src/gpu-compute/lds_state.hh
index 58171e3..d793f0f 100644
--- a/src/gpu-compute/lds_state.hh
+++ b/src/gpu-compute/lds_state.hh
@@ -69,9 +69,14 @@
T
read(const uint32_t index)
{
- fatal_if(!chunk.size(), "cannot read from an LDS chunk of size 0");
- fatal_if(index >= chunk.size(), "out-of-bounds access to an LDS "
- "chunk");
+ /**
+ * For reads that are outside the bounds of the LDS
+ * chunk allocated to this WG we return 0.
+ */
+ if (index >= chunk.size()) {
+ return (T)0;
+ }
+
T *p0 = (T *) (&(chunk.at(index)));
return *p0;
}
@@ -83,9 +88,14 @@
void
write(const uint32_t index, const T value)
{
- fatal_if(!chunk.size(), "cannot write to an LDS chunk of size 0");
- fatal_if(index >= chunk.size(), "out-of-bounds access to an LDS "
- "chunk");
+ /**
+ * Writes that are outside the bounds of the LDS
+ * chunk allocated to this WG are dropped.
+ */
+ if (index >= chunk.size()) {
+ return;
+ }
+
T *p0 = (T *) (&(chunk.at(index)));
*p0 = value;
}
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/29940
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: I5f467d0f52113e8565e1a3029e82fb89cc6f07ea
Gerrit-Change-Number: 29940
Gerrit-PatchSet: 7
Gerrit-Owner: Anthony Gutierrez <anthony.gutier...@amd.com>
Gerrit-Reviewer: Anthony Gutierrez <anthony.gutier...@amd.com>
Gerrit-Reviewer: Matt Sinclair <mattdsincl...@gmail.com>
Gerrit-Reviewer: Tony Gutierrez <anthony.gutier...@amd.com>
Gerrit-Reviewer: Tuan Ta <q...@cornell.edu>
Gerrit-Reviewer: kokoro <noreply+kok...@google.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