arch-gcn3: Fix stride bug in buffer OOB detection logic

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>
This commit is contained in:
Michael LeBeane
2019-05-20 16:39:40 -04:00
committed by Anthony Gutierrez
parent 4c1dc827bc
commit f509fa735c

View 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: "