arch-gcn3: Fix stride bug in buffer OOB detection logic
authorMichael LeBeane <Michael.Lebeane@amd.com>
Mon, 20 May 2019 20:39:40 +0000 (16:39 -0400)
committerAnthony Gutierrez <anthony.gutierrez@amd.com>
Fri, 17 Jul 2020 16:34:07 +0000 (16:34 +0000)
The out-of-range logic for buffer accesses is missing the top 4 bits of
const_stride when dealing with scratch buffers.  This can cause
perfectly valid scratch acceses to be suppressed when const_stride is
large.

Change-Id: I8f94d44c242fda26cf6dfb75db04fa3aca934b3e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/29968
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/arch/gcn3/insts/op_encodings.hh

index 202dd1d822115295fa5632ddd1eda4f2a5617926..b35fb3d6898cab703b1b951b83f1adaffb61df50 100644 (file)
@@ -651,7 +651,7 @@ namespace Gcn3ISA
                      * non-formatted accesses, this is done on a per-lane
                      * basis.
                      */
-                    if (rsrc_desc.stride == 0 || !rsrc_desc.swizzleEn) {
+                    if (stride == 0 || !rsrc_desc.swizzleEn) {
                         if (buf_off + stride * buf_idx >=
                             rsrc_desc.numRecords - s_offset.rawData()) {
                             DPRINTF(GCN3, "mubuf out-of-bounds condition 1: "
@@ -659,13 +659,13 @@ namespace Gcn3ISA
                                     "const_stride = %llx, "
                                     "const_num_records = %llx\n",
                                     lane, buf_off + stride * buf_idx,
-                                    rsrc_desc.stride, rsrc_desc.numRecords);
+                                    stride, rsrc_desc.numRecords);
                             oobMask.set(lane);
                             continue;
                         }
                     }
 
-                    if (rsrc_desc.stride != 0 && rsrc_desc.swizzleEn) {
+                    if (stride != 0 && rsrc_desc.swizzleEn) {
                         if (buf_idx >= rsrc_desc.numRecords ||
                             buf_off >= stride) {
                             DPRINTF(GCN3, "mubuf out-of-bounds condition 2: "