upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/pe_loader.cpp
diff options
context:
space:
mode:
authorShadman PC <iamanthonytony@gmail.com>2026-11-22 19:14:40 +0600
committerShadman PC <iamanthonytony@gmail.com>2026-11-22 19:35:54 +0600
commit931e676018db9c4a27d0cc383486931ecffd4f96 (patch)
tree3f77a46e9cd2e733bd85b7bcbbc03cb53f53c97d /runtime/src/pe_loader.cpp
parent296caac93c2beefebea90265bd454eb10646e87a (diff)
perf(translator): fold constant scalar ALU operations and s_buffer_load descriptor bounds
In RDNA2 shaders, constant calculations and scalar descriptor bounds checking occur frequently across compute and graphics stages. - Fold constant scalar ALU operations (s_and_b32, s_or_b32, s_xor_b32, s_not_b32, s_lshl_b32, s_lshr_b32, s_mul_i32) into immediate constants and constant SCC writes at translate time, eliminating runtime OpBitwise*, OpShift*, OpNot, and OpIMul. - In s_buffer_load (SMEM), evaluate limit = NUM_RECORDS * stride at compile time when descriptor words 1 and 2 are known in sgpr_imm, eliminating 6 runtime SPIR-V instructions (OpBitFieldUExtract, OpUConvert, OpIMul, OpIEqual, OpSelect). - When offset and limit are constants, fold per-dword bounds statically: in-range dwords emit straight-line OpAccessChain and OpLoad without branch diamonds (OpSelectionMerge, OpBranchConditional, OpPhi), and out-of-range dwords emit constant zero without issuing memory loads. - When scalar load offset is passed via an SGPR with known literal, fold into immediate constant without runtime OpBitwiseAnd, OpUConvert, and OpIAdd. - Updated docs/design.md with static bounds folding behavior. - Added tests in tests/semantic/test_scalar_alu_and_smem_folding.py covering all cases.
Diffstat (limited to 'runtime/src/pe_loader.cpp')
0 files changed, 0 insertions, 0 deletions