From 48e7b3a1f8af101b6d73bb47986bc3afe961d20e Mon Sep 17 00:00:00 2001 From: Danylo Piliaiev Date: Thu, 1 Dec 2022 14:14:23 +0100 Subject: [PATCH] ir3: Reduce the maximum allowed imm offset for shared var load/store STL/LDL have 13 bits to store imm offset. However the most significant bit in the offset is a sign bit, so the positive offset is limited by 12 bits. nir_opt_offsets only has the upper limit and doesn't deal with negative offsets, so shared_max should be changed to `(1 << 12) - 1`. The issue was found in "Monster Hunter: World". Fixes: 0b2da9d795610df15346a594384c39a096be338f ("ir3: Limit the maximum imm offset in nir_opt_offset for shared vars") Signed-off-by: Danylo Piliaiev Part-of: (cherry picked from commit 8f0177b3345f8bcc3673b8a2a7c36ea36cbaa029) --- .pick_status.json | 2 +- src/freedreno/ir3/ir3_nir.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index b8504d9..412a176 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -5080,7 +5080,7 @@ "description": "ir3: Reduce the maximum allowed imm offset for shared var load/store", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "0b2da9d795610df15346a594384c39a096be338f" }, diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c index ef4ad88..4c68b30 100644 --- a/src/freedreno/ir3/ir3_nir.c +++ b/src/freedreno/ir3/ir3_nir.c @@ -134,7 +134,10 @@ ir3_optimize_loop(struct ir3_compiler *compiler, nir_shader *s) */ .uniform_max = (1 << 9) - 1, - .shared_max = (1 << 13) - 1, + /* STL/LDL have 13b for offset with MSB being a sign bit, but this opt + * doesn't deal with negative offsets. + */ + .shared_max = (1 << 12) - 1, .buffer_max = ~0, }; -- 2.7.4