From 4ab04799ee36f4787b52a53f31fe865d349fddc5 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 1 Jan 2025 23:52:33 -0800 Subject: [PATCH] brw: Delete assign_constant_locations and push_constant_loc[] The push_constant_loc[] array is always an identity mapping these days, so it's kind of pointless. Just use the original uniform number and skip the unnecessary "remap" step. With that gone, and shrinking UBO ranges gone, assign_constant_locations() is now empty and can be removed as well. Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/compiler/brw_fs.cpp | 24 +----------------------- src/intel/compiler/brw_fs.h | 7 ------- src/intel/compiler/brw_fs_nir.cpp | 2 +- src/intel/compiler/brw_fs_visitor.cpp | 1 - src/intel/compiler/brw_opt.cpp | 2 -- 5 files changed, 2 insertions(+), 34 deletions(-) diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index 7fd9523ec5c..6cb181ff799 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -803,7 +803,6 @@ fs_inst::is_raw_move() const void fs_visitor::import_uniforms(fs_visitor *v) { - this->push_constant_loc = v->push_constant_loc; this->uniforms = v->uniforms; } @@ -974,7 +973,7 @@ fs_visitor::assign_curb_setup() constant_nr = ubo_push_start[inst->src[i].nr - UBO_START] + inst->src[i].offset / 4; } else if (uniform_nr >= 0 && uniform_nr < (int) uniforms) { - constant_nr = push_constant_loc[uniform_nr]; + constant_nr = uniform_nr; } else { /* Section 5.11 of the OpenGL 4.1 spec says: * "Out-of-bounds reads return undefined values, which include @@ -1128,27 +1127,6 @@ brw_get_subgroup_id_param_index(const intel_device_info *devinfo, return -1; } -/** - * Assign UNIFORM file registers to either push constants or pull constants. - * - * We allow a fragment shader to have more than the specified minimum - * maximum number of fragment shader uniform components (64). If - * there are too many of these, they'd fill up all of register space. - * So, this will push some of them out to the pull constant buffer and - * update the program to load them. - */ -void -fs_visitor::assign_constant_locations() -{ - /* Only the first compile gets to decide on locations. */ - if (push_constant_loc) - return; - - push_constant_loc = ralloc_array(mem_ctx, int, uniforms); - for (unsigned u = 0; u < uniforms; u++) - push_constant_loc[u] = u; -} - /** * Get the mask of SIMD channels enabled during dispatch and not yet disabled * by discard. Due to the layout of the sample mask in the fragment shader diff --git a/src/intel/compiler/brw_fs.h b/src/intel/compiler/brw_fs.h index 937bf8fb012..739fc827f90 100644 --- a/src/intel/compiler/brw_fs.h +++ b/src/intel/compiler/brw_fs.h @@ -312,7 +312,6 @@ public: void calculate_payload_ranges(bool allow_spilling, unsigned payload_node_count, int *payload_last_use_ip) const; - void assign_constant_locations(); void invalidate_analysis(brw::analysis_dependency_class c); void vfail(const char *msg, va_list args); @@ -363,12 +362,6 @@ public: /** Byte-offset for the next available spot in the scratch space buffer. */ unsigned last_scratch; - /** - * Array mapping UNIFORM register numbers to the push parameter index, - * or -1 if this uniform register isn't being uploaded as a push constant. - */ - int *push_constant_loc; - brw_reg frag_depth; brw_reg frag_stencil; brw_reg sample_mask; diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp index c3d4235d997..2928ea6d72b 100644 --- a/src/intel/compiler/brw_fs_nir.cpp +++ b/src/intel/compiler/brw_fs_nir.cpp @@ -183,7 +183,7 @@ fs_nir_setup_uniforms(fs_visitor &s) const intel_device_info *devinfo = s.devinfo; /* Only the first compile gets to set up uniforms. */ - if (s.push_constant_loc) + if (s.uniforms) return; s.uniforms = s.nir->num_uniforms / 4; diff --git a/src/intel/compiler/brw_fs_visitor.cpp b/src/intel/compiler/brw_fs_visitor.cpp index ca1544058ce..907203555e3 100644 --- a/src/intel/compiler/brw_fs_visitor.cpp +++ b/src/intel/compiler/brw_fs_visitor.cpp @@ -464,7 +464,6 @@ fs_visitor::init() this->uniforms = 0; this->last_scratch = 0; - this->push_constant_loc = NULL; memset(&this->shader_stats, 0, sizeof(this->shader_stats)); diff --git a/src/intel/compiler/brw_opt.cpp b/src/intel/compiler/brw_opt.cpp index 345e393f2e8..904aee155cb 100644 --- a/src/intel/compiler/brw_opt.cpp +++ b/src/intel/compiler/brw_opt.cpp @@ -43,8 +43,6 @@ brw_optimize(fs_visitor &s) this_progress; \ }) - s.assign_constant_locations(); - if (s.compiler->lower_dpas) OPT(brw_lower_dpas);