Skip to content
This repository was archived by the owner on Jan 7, 2023. It is now read-only.

Commit 6d8bd76

Browse files
committed
Revert "FROMLIST: SQUASH: i965: SIMD32 selection heuristics"
This patch is causing visual artifacts on Celadon home screen, which is troubling because it is supposed to be disabled by default. Reverting until we find a solution.
1 parent df40b17 commit 6d8bd76

9 files changed

Lines changed: 7 additions & 152 deletions

File tree

src/intel/compiler/brw_compiler.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,6 @@ struct ra_regs;
3838
struct nir_shader;
3939
struct brw_program;
4040

41-
struct brw_simd32_heuristics_control {
42-
bool grouped_sends_check;
43-
int max_grouped_sends;
44-
bool inst_count_check;
45-
float inst_count_ratio;
46-
bool mrt_check;
47-
int max_mrts;
48-
};
49-
5041
struct brw_compiler {
5142
const struct gen_device_info *devinfo;
5243

@@ -127,8 +118,6 @@ struct brw_compiler {
127118
* whether nir_opt_large_constants will be run.
128119
*/
129120
bool supports_shader_constants;
130-
131-
struct brw_simd32_heuristics_control simd32_heuristics_control;
132121
};
133122

134123
/**

src/intel/compiler/brw_fs.cpp

Lines changed: 6 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -7933,8 +7933,6 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data,
79337933
char **error_str)
79347934
{
79357935
const struct gen_device_info *devinfo = compiler->devinfo;
7936-
bool simd16_failed = false;
7937-
bool simd16_spilled = false;
79387936

79397937
shader = brw_nir_apply_sampler_key(shader, compiler, &key->tex, true);
79407938
brw_nir_lower_fs_inputs(shader, devinfo, key);
@@ -8000,30 +7998,20 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data,
80007998
shader_time_index16);
80017999
v16.import_uniforms(&v8);
80028000
if (!v16.run_fs(allow_spilling, use_rep_send)) {
8003-
simd16_failed = true;
80048001
compiler->shader_perf_log(log_data,
80058002
"SIMD16 shader failed to compile: %s",
80068003
v16.fail_msg);
80078004
} else {
8008-
simd16_spilled = v16.spilled_any_registers;
80098005
simd16_cfg = v16.cfg;
80108006
prog_data->dispatch_grf_start_reg_16 = v16.payload.num_regs;
80118007
prog_data->reg_blocks_16 = brw_register_blocks(v16.grf_used);
80128008
}
80138009
}
80148010

80158011
/* Currently, the compiler only supports SIMD32 on SNB+ */
8016-
const brw_simd32_heuristics_control *ctrl = &compiler->simd32_heuristics_control;
8017-
uint64_t mrts = shader->info.outputs_written << FRAG_RESULT_DATA0;
8018-
80198012
if (v8.max_dispatch_width >= 32 && !use_rep_send &&
80208013
compiler->devinfo->gen >= 6 &&
8021-
(unlikely(INTEL_DEBUG & DEBUG_DO32) ||
8022-
(unlikely(INTEL_DEBUG & DEBUG_HEUR32) &&
8023-
!simd16_failed && !simd16_spilled &&
8024-
(!ctrl->mrt_check ||
8025-
(ctrl->mrt_check &&
8026-
u_count_bits64(&mrts) <= ctrl->max_mrts))))) {
8014+
unlikely(INTEL_DEBUG & DEBUG_DO32)) {
80278015
/* Try a SIMD32 compile */
80288016
fs_visitor v32(compiler, log_data, mem_ctx, key,
80298017
&prog_data->base, prog, shader, 32,
@@ -8034,12 +8022,9 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data,
80348022
"SIMD32 shader failed to compile: %s",
80358023
v32.fail_msg);
80368024
} else {
8037-
if (likely(!(INTEL_DEBUG & DEBUG_HEUR32)) ||
8038-
v32.run_heuristic(ctrl)) {
8039-
simd32_cfg = v32.cfg;
8040-
prog_data->dispatch_grf_start_reg_32 = v32.payload.num_regs;
8041-
prog_data->reg_blocks_32 = brw_register_blocks(v32.grf_used);
8042-
}
8025+
simd32_cfg = v32.cfg;
8026+
prog_data->dispatch_grf_start_reg_32 = v32.payload.num_regs;
8027+
prog_data->reg_blocks_32 = brw_register_blocks(v32.grf_used);
80438028
}
80448029
}
80458030

@@ -8118,49 +8103,13 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data,
81188103
}
81198104

81208105
if (simd32_cfg) {
8121-
uint32_t offset = g.generate_code(simd32_cfg, 32);
8122-
8123-
if (unlikely(INTEL_DEBUG & DEBUG_DO32) ||
8124-
(unlikely(INTEL_DEBUG & DEBUG_HEUR32) &&
8125-
(!simd16_cfg ||
8126-
(simd16_cfg &&
8127-
(!ctrl->inst_count_check ||
8128-
(ctrl->inst_count_check &&
8129-
(float)g.get_inst_count(32) / (float)g.get_inst_count(16) <= ctrl->inst_count_ratio)))))) {
8130-
prog_data->dispatch_32 = true;
8131-
prog_data->prog_offset_32 = offset;
8132-
}
8106+
prog_data->dispatch_32 = true;
8107+
prog_data->prog_offset_32 = g.generate_code(simd32_cfg, 32);
81338108
}
81348109

81358110
return g.get_assembly();
81368111
}
81378112

8138-
bool
8139-
fs_visitor::run_heuristic(const struct brw_simd32_heuristics_control *ctrl) {
8140-
int grouped_sends = 0;
8141-
int max_grouped_sends = 0;
8142-
bool pass = true;
8143-
8144-
foreach_block_and_inst(block, fs_inst, inst, cfg) {
8145-
if (inst->opcode >= SHADER_OPCODE_TEX && inst->opcode <= SHADER_OPCODE_SAMPLEINFO_LOGICAL) {
8146-
++grouped_sends;
8147-
} else if (grouped_sends > 0) {
8148-
if (grouped_sends > max_grouped_sends) {
8149-
max_grouped_sends = grouped_sends;
8150-
}
8151-
grouped_sends = 0;
8152-
}
8153-
}
8154-
8155-
if (ctrl->grouped_sends_check) {
8156-
if (max_grouped_sends > ctrl->max_grouped_sends) {
8157-
pass = false;
8158-
}
8159-
}
8160-
8161-
return pass;
8162-
}
8163-
81648113
fs_reg *
81658114
fs_visitor::emit_cs_work_group_id_setup()
81668115
{

src/intel/compiler/brw_fs.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,6 @@ class fs_visitor : public backend_shader
300300
void dump_instruction(backend_instruction *inst);
301301
void dump_instruction(backend_instruction *inst, FILE *file);
302302

303-
bool run_heuristic(const struct brw_simd32_heuristics_control *ctrl);
304-
305303
const void *const key;
306304
const struct brw_sampler_prog_key_data *key_tex;
307305

@@ -422,7 +420,6 @@ class fs_generator
422420

423421
void enable_debug(const char *shader_name);
424422
int generate_code(const cfg_t *cfg, int dispatch_width);
425-
int get_inst_count(int dispatch_width);
426423
const unsigned *get_assembly();
427424

428425
private:
@@ -518,7 +515,6 @@ class fs_generator
518515
struct brw_stage_prog_data * const prog_data;
519516

520517
unsigned dispatch_width; /**< 8, 16 or 32 */
521-
int inst_count[3]; /* for 8, 16 and 32 */
522518

523519
exec_list discard_halt_patches;
524520
unsigned promoted_constants;

src/intel/compiler/brw_fs_generator.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,8 +2256,6 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width)
22562256
fill_count, promoted_constants, before_size,
22572257
after_size);
22582258

2259-
inst_count[ffs(dispatch_width) - 4] = before_size / 16;
2260-
22612259
return start_offset;
22622260
}
22632261

@@ -2266,13 +2264,3 @@ fs_generator::get_assembly()
22662264
{
22672265
return brw_get_program(p, &prog_data->program_size);
22682266
}
2269-
2270-
int
2271-
fs_generator::get_inst_count(int dispatch_width)
2272-
{
2273-
if (dispatch_width == 8 || dispatch_width == 16 || dispatch_width == 32) {
2274-
return inst_count[ffs(dispatch_width) - 4];
2275-
} else {
2276-
return 0;
2277-
}
2278-
}

src/intel/dev/gen_debug.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ static const struct debug_control debug_control[] = {
8686
{ "color", DEBUG_COLOR },
8787
{ "reemit", DEBUG_REEMIT },
8888
{ "soft64", DEBUG_SOFT64 },
89-
{ "heur32", DEBUG_HEUR32 },
9089
{ NULL, 0 }
9190
};
9291

src/intel/dev/gen_debug.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,14 @@ extern uint64_t INTEL_DEBUG;
8484
#define DEBUG_COLOR (1ull << 40)
8585
#define DEBUG_REEMIT (1ull << 41)
8686
#define DEBUG_SOFT64 (1ull << 42)
87-
#define DEBUG_HEUR32 (1ull << 43)
8887

8988
/* These flags are not compatible with the disk shader cache */
9089
#define DEBUG_DISK_CACHE_DISABLE_MASK DEBUG_SHADER_TIME
9190

9291
/* These flags may affect program generation */
9392
#define DEBUG_DISK_CACHE_MASK \
9493
(DEBUG_NO16 | DEBUG_NO_DUAL_OBJECT_GS | DEBUG_NO8 | DEBUG_SPILL_FS | \
95-
DEBUG_SPILL_VEC4 | DEBUG_NO_COMPACTION | DEBUG_DO32 | DEBUG_SOFT64 | DEBUG_HEUR32)
94+
DEBUG_SPILL_VEC4 | DEBUG_NO_COMPACTION | DEBUG_DO32 | DEBUG_SOFT64)
9695

9796
#ifdef HAVE_ANDROID_PLATFORM
9897
#define LOG_TAG "INTEL-MESA"

src/mesa/drivers/dri/i965/brw_context.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -914,19 +914,6 @@ brw_process_driconf_options(struct brw_context *brw)
914914
ctx->Const.dri_config_options_sha1 = ralloc_array(brw, unsigned char, 20);
915915
driComputeOptionsSha1(&brw->screen->optionCache,
916916
ctx->Const.dri_config_options_sha1);
917-
918-
brw->screen->compiler->simd32_heuristics_control.grouped_sends_check =
919-
driQueryOptionb(&brw->optionCache, "simd32_heuristic_grouped_check");
920-
brw->screen->compiler->simd32_heuristics_control.max_grouped_sends =
921-
driQueryOptioni(&brw->optionCache, "simd32_heuristic_grouped_sends");
922-
brw->screen->compiler->simd32_heuristics_control.inst_count_check =
923-
driQueryOptionb(&brw->optionCache, "simd32_heuristic_inst_check");
924-
brw->screen->compiler->simd32_heuristics_control.inst_count_ratio =
925-
driQueryOptionf(&brw->optionCache, "simd32_heuristic_inst_ratio");
926-
brw->screen->compiler->simd32_heuristics_control.mrt_check =
927-
driQueryOptionb(&brw->optionCache, "simd32_heuristic_mrt_check");
928-
brw->screen->compiler->simd32_heuristics_control.max_mrts =
929-
driQueryOptioni(&brw->optionCache, "simd32_heuristic_max_mrts");
930917
}
931918

932919
GLboolean

src/mesa/drivers/dri/i965/intel_screen.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -62,33 +62,6 @@ DRI_CONF_BEGIN
6262
DRI_CONF_ENUM(1, "Enable reuse of all sizes of buffer objects")
6363
DRI_CONF_DESC_END
6464
DRI_CONF_OPT_END
65-
66-
DRI_CONF_OPT_BEGIN_B(simd32_heuristic_grouped_check, "true")
67-
DRI_CONF_DESC(en, "Enable/disable grouped texture fetch "
68-
"check in the SIMD32 selection heuristic.")
69-
DRI_CONF_OPT_END
70-
DRI_CONF_OPT_BEGIN_V(simd32_heuristic_grouped_sends, int, 6, "1:999")
71-
DRI_CONF_DESC(en, "How many grouped texture fetches should "
72-
"the SIMD32 selection heuristic allow.")
73-
DRI_CONF_OPT_END
74-
DRI_CONF_OPT_BEGIN_B(simd32_heuristic_inst_check, "true")
75-
DRI_CONF_DESC(en, "Enable/disable SIMD32/SIMD16 instruction "
76-
"count ratio check in the SIMD32 selection "
77-
"heuristic.")
78-
DRI_CONF_OPT_END
79-
DRI_CONF_OPT_BEGIN_V(simd32_heuristic_inst_ratio, float, 2.3, "1:999")
80-
DRI_CONF_DESC(en, "SIMD32/SIMD16 instruction count ratio "
81-
"the SIMD32 selection heuristic should allow.")
82-
DRI_CONF_OPT_END
83-
DRI_CONF_OPT_BEGIN_B(simd32_heuristic_mrt_check, "true")
84-
DRI_CONF_DESC(en, "Enable/disable MRT write check in the "
85-
"SIMD32 selection heuristic.")
86-
DRI_CONF_OPT_END
87-
DRI_CONF_OPT_BEGIN_V(simd32_heuristic_max_mrts, int, 1, "1:8")
88-
DRI_CONF_DESC(en, "How many MRT writes should the SIMD32 "
89-
"selection heuristic allow.")
90-
DRI_CONF_OPT_END
91-
9265
DRI_CONF_MESA_NO_ERROR("false")
9366
DRI_CONF_MESA_GLTHREAD("false")
9467
DRI_CONF_SECTION_END

src/util/bitscan.h

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -112,31 +112,6 @@ u_bit_scan64(uint64_t *mask)
112112
return i;
113113
}
114114

115-
/* Count bits set in mask */
116-
static inline int
117-
u_count_bits(unsigned *mask)
118-
{
119-
unsigned v = *mask;
120-
int c;
121-
v = v - ((v >> 1) & 0x55555555);
122-
v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
123-
v = (v + (v >> 4)) & 0xF0F0F0F;
124-
c = (int)((v * 0x1010101) >> 24);
125-
return c;
126-
}
127-
128-
static inline int
129-
u_count_bits64(uint64_t *mask)
130-
{
131-
uint64_t v = *mask;
132-
int c;
133-
v = v - ((v >> 1) & 0x5555555555555555ull);
134-
v = (v & 0x3333333333333333ull) + ((v >> 2) & 0x3333333333333333ull);
135-
v = (v + (v >> 4)) & 0xF0F0F0F0F0F0F0Full;
136-
c = (int)((v * 0x101010101010101ull) >> 56);
137-
return c;
138-
}
139-
140115
/* Determine if an unsigned value is a power of two.
141116
*
142117
* \note

0 commit comments

Comments
 (0)