Matt Sinclair has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/51127 )
Change subject: arch-gcn3: Fix MUBUF out-of-bounds case 1
......................................................................
arch-gcn3: Fix MUBUF out-of-bounds case 1
This patch upates the out-of-bounds check to properly check
against the correct buffer_offset, which is different depending
on if the const_swizzle_enable is true or false.
Change-Id: I5c687c09ee7f8e446618084b8545b74a84211d4d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/51127
Reviewed-by: Matt Sinclair <[email protected]>
Reviewed-by: Matthew Poremba <[email protected]>
Reviewed-by: Alex Dutu <[email protected]>
Maintainer: Matt Sinclair <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/arch/amdgpu/gcn3/insts/op_encodings.hh
1 file changed, 42 insertions(+), 20 deletions(-)
Approvals:
Alex Dutu: Looks good to me, approved
Matthew Poremba: 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/arch/amdgpu/gcn3/insts/op_encodings.hh
b/src/arch/amdgpu/gcn3/insts/op_encodings.hh
index 24edfa7..be96924 100644
--- a/src/arch/amdgpu/gcn3/insts/op_encodings.hh
+++ b/src/arch/amdgpu/gcn3/insts/op_encodings.hh
@@ -634,6 +634,7 @@
Addr stride = 0;
Addr buf_idx = 0;
Addr buf_off = 0;
+ Addr buffer_offset = 0;
BufferRsrcDescriptor rsrc_desc;
std::memcpy((void*)&rsrc_desc, s_rsrc_desc.rawDataPtr(),
@@ -656,6 +657,26 @@
buf_off = v_off[lane] + inst_offset;
+ if (rsrc_desc.swizzleEn) {
+ Addr idx_stride = 8 << rsrc_desc.idxStride;
+ Addr elem_size = 2 << rsrc_desc.elemSize;
+ Addr idx_msb = buf_idx / idx_stride;
+ Addr idx_lsb = buf_idx % idx_stride;
+ Addr off_msb = buf_off / elem_size;
+ Addr off_lsb = buf_off % elem_size;
+ DPRINTF(GCN3, "mubuf swizzled lane %d: "
+ "idx_stride = %llx, elem_size = %llx, "
+ "idx_msb = %llx, idx_lsb = %llx, "
+ "off_msb = %llx, off_lsb = %llx\n",
+ lane, idx_stride, elem_size, idx_msb,
idx_lsb,
+ off_msb, off_lsb);
+
+ buffer_offset =(idx_msb * stride + off_msb *
elem_size)
+ * idx_stride + idx_lsb * elem_size + off_lsb;
+ } else {
+ buffer_offset = buf_off + stride * buf_idx;
+ }
+
/**
* Range check behavior causes out of range accesses to
@@ -665,7 +686,7 @@
* basis.
*/
if (rsrc_desc.stride == 0 || !rsrc_desc.swizzleEn) {
- if (buf_off + stride * buf_idx >=
+ if (buffer_offset >=
rsrc_desc.numRecords - s_offset.rawData()) {
DPRINTF(GCN3, "mubuf out-of-bounds condition
1: "
"lane = %d, buffer_offset = %llx, "
@@ -692,25 +713,7 @@
}
}
- if (rsrc_desc.swizzleEn) {
- Addr idx_stride = 8 << rsrc_desc.idxStride;
- Addr elem_size = 2 << rsrc_desc.elemSize;
- Addr idx_msb = buf_idx / idx_stride;
- Addr idx_lsb = buf_idx % idx_stride;
- Addr off_msb = buf_off / elem_size;
- Addr off_lsb = buf_off % elem_size;
- DPRINTF(GCN3, "mubuf swizzled lane %d: "
- "idx_stride = %llx, elem_size = %llx, "
- "idx_msb = %llx, idx_lsb = %llx, "
- "off_msb = %llx, off_lsb = %llx\n",
- lane, idx_stride, elem_size, idx_msb,
idx_lsb,
- off_msb, off_lsb);
-
- vaddr += ((idx_msb * stride + off_msb * elem_size)
- * idx_stride + idx_lsb * elem_size + off_lsb);
- } else {
- vaddr += buf_off + stride * buf_idx;
- }
+ vaddr += buffer_offset;
DPRINTF(GCN3, "Calculating mubuf address for lane %d: "
"vaddr = %llx, base_addr = %llx, "
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/51127
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: I5c687c09ee7f8e446618084b8545b74a84211d4d
Gerrit-Change-Number: 51127
Gerrit-PatchSet: 2
Gerrit-Owner: Kyle Roarty <[email protected]>
Gerrit-Reviewer: Alex Dutu <[email protected]>
Gerrit-Reviewer: Matt Sinclair <[email protected]>
Gerrit-Reviewer: Matthew Poremba <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s