mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-18 12:20:35 +01:00
brw: Use brw_range in IP ranges analysis
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34253>
This commit is contained in:
parent
fb50461220
commit
f56a5cf1eb
8 changed files with 29 additions and 29 deletions
|
|
@ -112,7 +112,7 @@ brw_ip_ranges::validate(const brw_shader *s) const
|
|||
|
||||
if (num_blocks) {
|
||||
bblock_t *last_block = s->cfg->blocks[num_blocks - 1];
|
||||
unsigned last_ip = end(last_block);
|
||||
unsigned last_ip = range(last_block).end;
|
||||
if (last_ip + 1 != s->cfg->total_instructions)
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -314,18 +314,9 @@ struct brw_ip_ranges {
|
|||
BRW_DEPENDENCY_BLOCKS;
|
||||
}
|
||||
|
||||
int
|
||||
start(const bblock_t *block) const
|
||||
{
|
||||
assert(block->num < num_blocks);
|
||||
return start_ip[block->num];
|
||||
}
|
||||
|
||||
int
|
||||
end(const bblock_t *block) const
|
||||
{
|
||||
assert(block->num < num_blocks);
|
||||
return start_ip[block->num] + block->num_instructions - 1;
|
||||
brw_range range(const bblock_t *block) const {
|
||||
int start = start_ip[block->num];
|
||||
return { start, start + (int)block->num_instructions - 1 };
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -298,8 +298,10 @@ brw_live_variables::brw_live_variables(const brw_shader *s)
|
|||
|
||||
const brw_ip_ranges &ips = s->ip_ranges_analysis.require();
|
||||
for (int i = 0; i < cfg->num_blocks; i++) {
|
||||
block_data[i].start_ip = ips.start(cfg->blocks[i]);
|
||||
block_data[i].end_ip = ips.end(cfg->blocks[i]);
|
||||
brw_range range = ips.range(cfg->blocks[i]);
|
||||
|
||||
block_data[i].start_ip = range.start;
|
||||
block_data[i].end_ip = range.end;
|
||||
}
|
||||
|
||||
setup_def_use();
|
||||
|
|
|
|||
|
|
@ -1142,8 +1142,8 @@ namespace {
|
|||
int delta[IDX(TGL_PIPE_ALL)];
|
||||
|
||||
for (unsigned p = 0; p < IDX(TGL_PIPE_ALL); p++)
|
||||
delta[p] = jps[ips.start(child_link->block)].jp[p]
|
||||
- jps[ips.end(block)].jp[p]
|
||||
delta[p] = jps[ips.range(child_link->block).start].jp[p]
|
||||
- jps[ips.range(block).end].jp[p]
|
||||
- ordered_unit(shader->devinfo,
|
||||
static_cast<const brw_inst *>(block->end()), p);
|
||||
|
||||
|
|
|
|||
|
|
@ -547,8 +547,9 @@ void
|
|||
brw_copy_prop_dataflow::dump_block_data() const
|
||||
{
|
||||
foreach_block (block, cfg) {
|
||||
brw_range range = ips.range(block);
|
||||
fprintf(stderr, "Block %d [%d, %d] (parents ", block->num,
|
||||
ips.start(block), ips.end(block));
|
||||
range.start, range.end);
|
||||
foreach_list_typed(bblock_link, link, link, &block->parents) {
|
||||
bblock_t *parent = link->block;
|
||||
fprintf(stderr, "%d ", parent->num);
|
||||
|
|
@ -1524,8 +1525,9 @@ brw_opt_copy_propagation(brw_shader &s)
|
|||
for (auto iter = out_acp[block->num].begin();
|
||||
iter != out_acp[block->num].end(); ++iter) {
|
||||
assert((*iter)->dst.file == VGRF);
|
||||
if (ips.start(block) <= live.vgrf_start[(*iter)->dst.nr] &&
|
||||
live.vgrf_end[(*iter)->dst.nr] <= ips.end(block)) {
|
||||
brw_range block_range = ips.range(block);
|
||||
if (block_range.start <= live.vgrf_start[(*iter)->dst.nr] &&
|
||||
live.vgrf_end[(*iter)->dst.nr] <= block_range.end) {
|
||||
out_acp[block->num].remove(*iter);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,10 +122,10 @@ can_coalesce_vars(const intel_device_info *devinfo,
|
|||
int end_ip = MIN2(dst_end, src_end);
|
||||
|
||||
foreach_block(scan_block, cfg) {
|
||||
if (ips.end(scan_block) < start_ip)
|
||||
if (ips.range(scan_block).end < start_ip)
|
||||
continue;
|
||||
|
||||
int scan_ip = ips.start(scan_block) - 1;
|
||||
int scan_ip = ips.range(scan_block).start - 1;
|
||||
|
||||
bool seen_src_write = false;
|
||||
bool seen_copy = false;
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ static int
|
|||
count_to_loop_end(const bblock_t *block, const brw_ip_ranges &ips)
|
||||
{
|
||||
if (block->end()->opcode == BRW_OPCODE_WHILE)
|
||||
return ips.end(block);
|
||||
return ips.range(block).end;
|
||||
|
||||
int depth = 1;
|
||||
/* Skip the first block, since we don't want to count the do the calling
|
||||
|
|
@ -146,7 +146,7 @@ count_to_loop_end(const bblock_t *block, const brw_ip_ranges &ips)
|
|||
if (block->end()->opcode == BRW_OPCODE_WHILE) {
|
||||
depth--;
|
||||
if (depth == 0)
|
||||
return ips.end(block);
|
||||
return ips.range(block).end;
|
||||
}
|
||||
}
|
||||
unreachable("not reached");
|
||||
|
|
|
|||
|
|
@ -856,8 +856,11 @@ brw_instruction_scheduler::setup_liveness(cfg_t *cfg)
|
|||
*/
|
||||
for (int block = 0; block < cfg->num_blocks - 1; block++) {
|
||||
for (int i = 0; i < grf_count; i++) {
|
||||
if (live.vgrf_start[i] <= ips.end(cfg->blocks[block]) &&
|
||||
live.vgrf_end[i] >= ips.start(cfg->blocks[block + 1])) {
|
||||
const int this_block_end = ips.range(cfg->blocks[block]).end;
|
||||
const int next_block_start = ips.range(cfg->blocks[block + 1]).start;
|
||||
|
||||
if (live.vgrf_start[i] <= this_block_end &&
|
||||
live.vgrf_end[i] >= next_block_start) {
|
||||
if (!BITSET_TEST(livein[block + 1], i)) {
|
||||
reg_pressure_in[block + 1] += s->alloc.sizes[i];
|
||||
BITSET_SET(livein[block + 1], i);
|
||||
|
|
@ -876,10 +879,12 @@ brw_instruction_scheduler::setup_liveness(cfg_t *cfg)
|
|||
continue;
|
||||
|
||||
for (int block = 0; block < cfg->num_blocks; block++) {
|
||||
if (ips.start(cfg->blocks[block]) <= payload_last_use_ip[i])
|
||||
brw_range range = ips.range(cfg->blocks[block]);
|
||||
|
||||
if (range.start <= payload_last_use_ip[i])
|
||||
reg_pressure_in[block]++;
|
||||
|
||||
if (ips.end(cfg->blocks[block]) <= payload_last_use_ip[i])
|
||||
if (range.end <= payload_last_use_ip[i])
|
||||
BITSET_SET(hw_liveout[block], i);
|
||||
}
|
||||
}
|
||||
|
|
@ -950,7 +955,7 @@ void
|
|||
brw_instruction_scheduler::set_current_block(bblock_t *block, const brw_ip_ranges &ips)
|
||||
{
|
||||
current.block = block;
|
||||
current.start = nodes + ips.start(block);
|
||||
current.start = nodes + ips.range(block).start;
|
||||
current.len = block->num_instructions;
|
||||
current.end = current.start + current.len;
|
||||
current.time = 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue