Mesa (master): freedreno/ir3: move 'keeps' to block level
Rob Clark
robclark at kemper.freedesktop.org
Fri Apr 14 16:46:45 UTC 2017
Module: Mesa
Branch: master
Commit: 75afd2586f86231dbf929ec19d3bded88c9ea3a1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=75afd2586f86231dbf929ec19d3bded88c9ea3a1
Author: Rob Clark <robdclark at gmail.com>
Date: Tue Apr 4 20:29:53 2017 -0400
freedreno/ir3: move 'keeps' to block level
For things like SSBOs and atomics we'll want to track this at a block
level.
Signed-off-by: Rob Clark <robdclark at gmail.com>
---
src/gallium/drivers/freedreno/ir3/ir3.h | 12 ++++++------
src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c | 4 ++--
src/gallium/drivers/freedreno/ir3/ir3_cp.c | 10 +++++-----
src/gallium/drivers/freedreno/ir3/ir3_depth.c | 8 ++++----
src/gallium/drivers/freedreno/ir3/ir3_group.c | 8 +++++---
5 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/src/gallium/drivers/freedreno/ir3/ir3.h b/src/gallium/drivers/freedreno/ir3/ir3.h
index c205c8fac4..480b27ce5d 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3.h
+++ b/src/gallium/drivers/freedreno/ir3/ir3.h
@@ -369,12 +369,6 @@ struct ir3 {
unsigned predicates_count, predicates_sz;
struct ir3_instruction **predicates;
- /* Track instructions which do not write a register but other-
- * wise must not be discarded (such as kill, stg, etc)
- */
- unsigned keeps_count, keeps_sz;
- struct ir3_instruction **keeps;
-
/* Track texture sample instructions which need texture state
* patched in (for astc-srgb workaround):
*/
@@ -435,6 +429,12 @@ struct ir3_block {
uint16_t start_ip, end_ip;
+ /* Track instructions which do not write a register but other-
+ * wise must not be discarded (such as kill, stg, etc)
+ */
+ unsigned keeps_count, keeps_sz;
+ struct ir3_instruction **keeps;
+
/* used for per-pass extra block data. Mainly used right
* now in RA step to track livein/liveout.
*/
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
index 7932a6f18a..22619e852c 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
@@ -1308,7 +1308,7 @@ emit_intrinsic(struct ir3_compile *ctx, nir_intrinsic_instr *intr)
kill = ir3_KILL(b, cond, 0);
array_insert(ctx->ir, ctx->ir->predicates, kill);
- array_insert(ctx->ir, ctx->ir->keeps, kill);
+ array_insert(b, b->keeps, kill);
ctx->so->has_kill = true;
break;
@@ -1972,7 +1972,7 @@ emit_stream_out(struct ir3_compile *ctx)
stg->cat6.type = TYPE_U32;
stg->cat6.dst_offset = (strmout->output[i].dst_offset + j) * 4;
- array_insert(ctx->ir, ctx->ir->keeps, stg);
+ array_insert(ctx->block, ctx->block->keeps, stg);
}
}
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cp.c b/src/gallium/drivers/freedreno/ir3/ir3_cp.c
index 71e02615c7..a9023ce571 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_cp.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_cp.c
@@ -576,15 +576,15 @@ ir3_cp(struct ir3 *ir, struct ir3_shader_variant *so)
}
}
- for (unsigned i = 0; i < ir->keeps_count; i++) {
- instr_cp(&ctx, ir->keeps[i]);
- ir->keeps[i] = eliminate_output_mov(ir->keeps[i]);
- }
-
list_for_each_entry (struct ir3_block, block, &ir->block_list, node) {
if (block->condition) {
instr_cp(&ctx, block->condition);
block->condition = eliminate_output_mov(block->condition);
}
+
+ for (unsigned i = 0; i < block->keeps_count; i++) {
+ instr_cp(&ctx, block->keeps[i]);
+ block->keeps[i] = eliminate_output_mov(block->keeps[i]);
+ }
}
}
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_depth.c b/src/gallium/drivers/freedreno/ir3/ir3_depth.c
index 1b8a446ca6..be39027b6a 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_depth.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_depth.c
@@ -159,11 +159,11 @@ ir3_depth(struct ir3 *ir)
if (ir->outputs[i])
ir3_instr_depth(ir->outputs[i]);
- for (i = 0; i < ir->keeps_count; i++)
- ir3_instr_depth(ir->keeps[i]);
-
- /* We also need to account for if-condition: */
list_for_each_entry (struct ir3_block, block, &ir->block_list, node) {
+ for (i = 0; i < block->keeps_count; i++)
+ ir3_instr_depth(block->keeps[i]);
+
+ /* We also need to account for if-condition: */
if (block->condition)
ir3_instr_depth(block->condition);
}
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_group.c b/src/gallium/drivers/freedreno/ir3/ir3_group.c
index 633d66c58d..2719b6459e 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_group.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_group.c
@@ -254,9 +254,11 @@ find_neighbors(struct ir3 *ir)
}
}
- for (i = 0; i < ir->keeps_count; i++) {
- struct ir3_instruction *instr = ir->keeps[i];
- instr_find_neighbors(instr);
+ list_for_each_entry (struct ir3_block, block, &ir->block_list, node) {
+ for (i = 0; i < block->keeps_count; i++) {
+ struct ir3_instruction *instr = block->keeps[i];
+ instr_find_neighbors(instr);
+ }
}
}
More information about the mesa-commit
mailing list