Mesa (main): intel/fs: Lower uniform pull constant load message to LSC dataport
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 30 16:30:46 UTC 2021
Module: Mesa
Branch: main
Commit: f5876dfdb9b3ce0d8dc882f4930f62924344f50d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f5876dfdb9b3ce0d8dc882f4930f62924344f50d
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Sat Jun 26 11:11:09 2021 -0500
intel/fs: Lower uniform pull constant load message to LSC dataport
Reviewed-by: Sagar Ghuge <sagar.ghuge at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11600>
---
src/intel/compiler/brw_fs.cpp | 54 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 52 insertions(+), 2 deletions(-)
diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp
index 3c62bebcf29..7dbebfd3c83 100644
--- a/src/intel/compiler/brw_fs.cpp
+++ b/src/intel/compiler/brw_fs.cpp
@@ -3856,14 +3856,64 @@ fs_visitor::lower_uniform_pull_constant_loads()
if (inst->opcode != FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD)
continue;
- if (devinfo->ver >= 7) {
+ const fs_reg& surface = inst->src[0];
+ const fs_reg& offset_B = inst->src[1];
+ assert(offset_B.file == IMM);
+
+ if (devinfo->has_lsc) {
+ const fs_builder ubld =
+ fs_builder(this, block, inst).group(8, 0).exec_all();
+
+ const fs_reg payload = ubld.vgrf(BRW_REGISTER_TYPE_UD);
+ ubld.MOV(payload, offset_B);
+
+ inst->sfid = GFX12_SFID_UGM;
+ inst->desc = lsc_msg_desc(devinfo, LSC_OP_LOAD,
+ 1 /* simd_size */,
+ LSC_ADDR_SURFTYPE_BTI,
+ LSC_ADDR_SIZE_A32,
+ 1 /* num_coordinates */,
+ LSC_DATA_SIZE_D32,
+ inst->size_written / 4,
+ true /* transpose */,
+ LSC_CACHE_LOAD_L1STATE_L3MOCS,
+ true /* has_dest */);
+
+ fs_reg ex_desc;
+ if (surface.file == IMM) {
+ ex_desc = brw_imm_ud(lsc_bti_ex_desc(devinfo, surface.ud));
+ } else {
+ /* We only need the first component for the payload so we can use
+ * one of the other components for the extended descriptor
+ */
+ ex_desc = component(payload, 1);
+ ubld.group(1, 0).SHL(ex_desc, surface, brw_imm_ud(24));
+ }
+
+ /* Update the original instruction. */
+ inst->opcode = SHADER_OPCODE_SEND;
+ inst->mlen = lsc_msg_desc_src0_len(devinfo, inst->desc);
+ inst->ex_mlen = 0;
+ inst->header_size = 0;
+ inst->send_has_side_effects = false;
+ inst->send_is_volatile = true;
+ inst->exec_size = 1;
+
+ /* Finally, the payload */
+ inst->resize_sources(3);
+ inst->src[0] = brw_imm_ud(0); /* desc */
+ inst->src[1] = ex_desc;
+ inst->src[2] = payload;
+
+ invalidate_analysis(DEPENDENCY_INSTRUCTIONS | DEPENDENCY_VARIABLES);
+ } else if (devinfo->ver >= 7) {
const fs_builder ubld = fs_builder(this, block, inst).exec_all();
const fs_reg payload = ubld.group(8, 0).vgrf(BRW_REGISTER_TYPE_UD);
ubld.group(8, 0).MOV(payload,
retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UD));
ubld.group(1, 0).MOV(component(payload, 2),
- brw_imm_ud(inst->src[1].ud / 16));
+ brw_imm_ud(offset_B.ud / 16));
inst->opcode = FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD_GFX7;
inst->src[1] = payload;
More information about the mesa-commit
mailing list