agx: use immediate load ts/ss forms

Honeykrisp appreciates this. Funny looking fossil stats:

Totals:
Preamble instrs: 10638975 -> 10435998 (-1.91%); split: -1.91%, +0.00%

Totals from 23612 (43.71% of 54019) affected shaders:
Preamble instrs: 5104103 -> 4901126 (-3.98%); split: -3.98%, +0.00%

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36257>
This commit is contained in:
Alyssa Rosenzweig
2025-07-18 21:04:20 -04:00
committed by Marge Bot
parent 3a798e58e5
commit a60755c015
3 changed files with 11 additions and 9 deletions
+3 -1
View File
@@ -4,6 +4,7 @@
*/
#include "agx_compiler.h"
#include "agx_opcodes.h"
bool
agx_allows_16bit_immediate(agx_instr *I)
@@ -13,7 +14,8 @@ agx_allows_16bit_immediate(agx_instr *I)
(I->op == AGX_OPCODE_STACK_LOAD) ||
(I->op == AGX_OPCODE_STACK_STORE) ||
(I->op == AGX_OPCODE_UNIFORM_STORE) || (I->op == AGX_OPCODE_ATOMIC) ||
(I->op == AGX_OPCODE_PHI);
(I->op == AGX_OPCODE_PHI) || (I->op == AGX_OPCODE_TEX_STATE_STORE) ||
(I->op == AGX_OPCODE_SAMPLER_STATE_STORE);
}
unsigned
+1 -3
View File
@@ -571,9 +571,7 @@ agx_optimizer_forward(agx_context *ctx)
/* Inline immediates if we can. TODO: systematic */
if (I->op != AGX_OPCODE_COLLECT && I->op != AGX_OPCODE_IMAGE_LOAD &&
I->op != AGX_OPCODE_TEXTURE_LOAD &&
I->op != AGX_OPCODE_UNIFORM_STORE && I->op != AGX_OPCODE_EXPORT &&
I->op != AGX_OPCODE_TEX_STATE_STORE &&
I->op != AGX_OPCODE_SAMPLER_STATE_STORE)
I->op != AGX_OPCODE_UNIFORM_STORE && I->op != AGX_OPCODE_EXPORT)
agx_optimizer_inline_imm(defs, I);
if (I->op == AGX_OPCODE_IF_ICMP) {
+7 -5
View File
@@ -88,7 +88,7 @@ agx_pack_texture(const agx_instr *I, agx_index base, agx_index index,
pack_assert(I, base.type == AGX_INDEX_UNIFORM);
pack_assert(I, base.size == AGX_SIZE_64);
pack_assert(I, (base.value & 3) == 0);
pack_assert(I, index.size == AGX_SIZE_32);
pack_assert(I, index.size <= AGX_SIZE_32);
/* Bindless */
*packed_base = base.value >> 2;
@@ -928,12 +928,14 @@ agx_pack_instr(struct util_dynarray *emission, struct util_dynarray *fixups,
pack_assert(I, U < (1 << 4));
pack_assert(I, (T & 1) == 0);
pack_assert(I, T < (1 << 8));
pack_assert(I, T < (1 << 24));
pack_assert(I, I->imm < (1 << 7));
uint64_t raw = agx_opcodes_info[I->op].encoding.exact | (I->imm << 8) |
(I->scoreboard << 16) | ((uint64_t)(T >> 1) << 27) |
((uint64_t)(U << 1) << 58);
uint64_t raw =
agx_opcodes_info[I->op].encoding.exact | (I->imm << 8) |
(I->scoreboard << 16) | ((uint64_t)T << 26) |
((I->src[1].type == AGX_INDEX_IMMEDIATE) ? (1ul << 58) : 0) |
((uint64_t)U << 59);
memcpy(util_dynarray_grow_bytes(emission, 1, 8), &raw, 8);
break;