nir: add assertions that loops don't have a Continue Construct
Hoping that I didn't miss any, this *should* add assertions to all functions and passes which explicitly handle 'nir_loop'. Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13962>
This commit is contained in:

committed by
Marge Bot

parent
d4b97bf3fa
commit
2bb369dd8d
@@ -10340,6 +10340,7 @@ static void end_uniform_if(isel_context* ctx, if_context* ic);
|
|||||||
static void
|
static void
|
||||||
visit_loop(isel_context* ctx, nir_loop* loop)
|
visit_loop(isel_context* ctx, nir_loop* loop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
loop_context lc;
|
loop_context lc;
|
||||||
begin_loop(ctx, &lc);
|
begin_loop(ctx, &lc);
|
||||||
|
|
||||||
|
@@ -167,6 +167,7 @@ sanitize_cf_list(nir_function_impl* impl, struct exec_list* cf_list)
|
|||||||
}
|
}
|
||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
nir_loop* loop = nir_cf_node_as_loop(cf_node);
|
nir_loop* loop = nir_cf_node_as_loop(cf_node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
progress |= sanitize_cf_list(impl, &loop->body);
|
progress |= sanitize_cf_list(impl, &loop->body);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -4988,6 +4988,7 @@ static bool visit_if(struct ac_nir_context *ctx, nir_if *if_stmt)
|
|||||||
|
|
||||||
static bool visit_loop(struct ac_nir_context *ctx, nir_loop *loop)
|
static bool visit_loop(struct ac_nir_context *ctx, nir_loop *loop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
nir_block *first_loop_block = (nir_block *)exec_list_get_head(&loop->body);
|
nir_block *first_loop_block = (nir_block *)exec_list_get_head(&loop->body);
|
||||||
|
|
||||||
ac_build_bgnloop(&ctx->ac, first_loop_block->index);
|
ac_build_bgnloop(&ctx->ac, first_loop_block->index);
|
||||||
|
@@ -1668,6 +1668,7 @@ emit_if(agx_context *ctx, nir_if *nif)
|
|||||||
static void
|
static void
|
||||||
emit_loop(agx_context *ctx, nir_loop *nloop)
|
emit_loop(agx_context *ctx, nir_loop *nloop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(nloop));
|
||||||
/* We only track nesting within the innermost loop, so push and reset */
|
/* We only track nesting within the innermost loop, so push and reset */
|
||||||
unsigned pushed_nesting = ctx->loop_nesting;
|
unsigned pushed_nesting = ctx->loop_nesting;
|
||||||
ctx->loop_nesting = 0;
|
ctx->loop_nesting = 0;
|
||||||
|
@@ -4246,6 +4246,8 @@ ntq_emit_uniform_loop(struct v3d_compile *c, nir_loop *loop)
|
|||||||
static void
|
static void
|
||||||
ntq_emit_loop(struct v3d_compile *c, nir_loop *loop)
|
ntq_emit_loop(struct v3d_compile *c, nir_loop *loop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
|
|
||||||
/* Disable flags optimization for loop conditions. The problem here is
|
/* Disable flags optimization for loop conditions. The problem here is
|
||||||
* that we can have code like this:
|
* that we can have code like this:
|
||||||
*
|
*
|
||||||
|
@@ -1049,6 +1049,7 @@ visit_if(nir_if *if_stmt, struct divergence_state *state)
|
|||||||
static bool
|
static bool
|
||||||
visit_loop(nir_loop *loop, struct divergence_state *state)
|
visit_loop(nir_loop *loop, struct divergence_state *state)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
bool progress = false;
|
bool progress = false;
|
||||||
nir_block *loop_header = nir_loop_first_block(loop);
|
nir_block *loop_header = nir_loop_first_block(loop);
|
||||||
nir_block *loop_preheader = nir_block_cf_tree_prev(loop_header);
|
nir_block *loop_preheader = nir_block_cf_tree_prev(loop_header);
|
||||||
|
@@ -319,6 +319,7 @@ process_node(nir_cf_node *node, nir_loop_info *info,
|
|||||||
|
|
||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
nir_loop *loop = nir_cf_node_as_loop(node);
|
nir_loop *loop = nir_cf_node_as_loop(node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
|
|
||||||
/* Replace loop info, no nested loop info currently:
|
/* Replace loop info, no nested loop info currently:
|
||||||
*
|
*
|
||||||
|
@@ -1415,6 +1415,8 @@ process_loops(nir_cf_node *cf_node, nir_variable_mode indirect_mask,
|
|||||||
}
|
}
|
||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
|
|
||||||
foreach_list_typed(nir_cf_node, nested_node, node, &loop->body)
|
foreach_list_typed(nir_cf_node, nested_node, node, &loop->body)
|
||||||
process_loops(nested_node, indirect_mask, force_unroll_sampler_indirect);
|
process_loops(nested_node, indirect_mask, force_unroll_sampler_indirect);
|
||||||
break;
|
break;
|
||||||
|
@@ -215,6 +215,7 @@ lower_make_visible(nir_cf_node *cf_node, uint32_t *cur_modes)
|
|||||||
}
|
}
|
||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
bool loop_progress;
|
bool loop_progress;
|
||||||
do {
|
do {
|
||||||
loop_progress = false;
|
loop_progress = false;
|
||||||
@@ -254,6 +255,7 @@ lower_make_available(nir_cf_node *cf_node, uint32_t *cur_modes)
|
|||||||
}
|
}
|
||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
bool loop_progress;
|
bool loop_progress;
|
||||||
do {
|
do {
|
||||||
loop_progress = false;
|
loop_progress = false;
|
||||||
|
@@ -82,6 +82,7 @@ predicate_following(nir_cf_node *node, struct lower_returns_state *state)
|
|||||||
static bool
|
static bool
|
||||||
lower_returns_in_loop(nir_loop *loop, struct lower_returns_state *state)
|
lower_returns_in_loop(nir_loop *loop, struct lower_returns_state *state)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
nir_loop *parent = state->loop;
|
nir_loop *parent = state->loop;
|
||||||
state->loop = loop;
|
state->loop = loop;
|
||||||
bool progress = lower_returns_in_cf_list(&loop->body, state);
|
bool progress = lower_returns_in_cf_list(&loop->body, state);
|
||||||
|
@@ -790,6 +790,7 @@ duplicate_loop_bodies(nir_function_impl *impl, nir_instr *resume_instr)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
nir_loop *loop = nir_cf_node_as_loop(node);
|
nir_loop *loop = nir_cf_node_as_loop(node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
|
|
||||||
if (resume_reg == NULL) {
|
if (resume_reg == NULL) {
|
||||||
/* We only create resume_reg if we encounter a loop. This way we can
|
/* We only create resume_reg if we encounter a loop. This way we can
|
||||||
@@ -1038,6 +1039,7 @@ flatten_resume_if_ladder(nir_builder *b,
|
|||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
assert(!before_cursor);
|
assert(!before_cursor);
|
||||||
nir_loop *loop = nir_cf_node_as_loop(child);
|
nir_loop *loop = nir_cf_node_as_loop(child);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
|
|
||||||
if (cf_node_contains_block(&loop->cf_node, resume_instr->block)) {
|
if (cf_node_contains_block(&loop->cf_node, resume_instr->block)) {
|
||||||
/* Thanks to our loop body duplication pass, every level of loop
|
/* Thanks to our loop body duplication pass, every level of loop
|
||||||
|
@@ -295,6 +295,7 @@ gather_vars_written(struct copy_prop_var_state *state,
|
|||||||
|
|
||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
|
|
||||||
new_written = create_vars_written(state);
|
new_written = create_vars_written(state);
|
||||||
|
|
||||||
@@ -1472,6 +1473,7 @@ copy_prop_vars_cf_node(struct copy_prop_var_state *state,
|
|||||||
|
|
||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
|
|
||||||
/* Invalidate before cloning the copies for the loop, since the loop
|
/* Invalidate before cloning the copies for the loop, since the loop
|
||||||
* body can be executed more than once.
|
* body can be executed more than once.
|
||||||
|
@@ -167,6 +167,7 @@ dce_cf_list(struct exec_list *cf_list, BITSET_WORD *defs_live,
|
|||||||
}
|
}
|
||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
|
|
||||||
struct loop_state inner_state;
|
struct loop_state inner_state;
|
||||||
inner_state.preheader = nir_cf_node_as_block(nir_cf_node_prev(cf_node));
|
inner_state.preheader = nir_cf_node_as_block(nir_cf_node_prev(cf_node));
|
||||||
|
@@ -373,6 +373,7 @@ dead_cf_list(struct exec_list *list, bool *list_ends_in_jump)
|
|||||||
|
|
||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
nir_loop *loop = nir_cf_node_as_loop(cur);
|
nir_loop *loop = nir_cf_node_as_loop(cur);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
bool dummy;
|
bool dummy;
|
||||||
progress |= dead_cf_list(&loop->body, &dummy);
|
progress |= dead_cf_list(&loop->body, &dummy);
|
||||||
|
|
||||||
|
@@ -117,6 +117,7 @@ get_loop_instr_count(struct exec_list *cf_list)
|
|||||||
}
|
}
|
||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
nir_loop *loop = nir_cf_node_as_loop(node);
|
nir_loop *loop = nir_cf_node_as_loop(node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
loop_instr_count += get_loop_instr_count(&loop->body);
|
loop_instr_count += get_loop_instr_count(&loop->body);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -154,6 +155,7 @@ gcm_build_block_info(struct exec_list *cf_list, struct gcm_state *state,
|
|||||||
}
|
}
|
||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
nir_loop *loop = nir_cf_node_as_loop(node);
|
nir_loop *loop = nir_cf_node_as_loop(node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
gcm_build_block_info(&loop->body, state, loop, loop_depth + 1, if_depth,
|
gcm_build_block_info(&loop->body, state, loop, loop_depth + 1, if_depth,
|
||||||
get_loop_instr_count(&loop->body));
|
get_loop_instr_count(&loop->body));
|
||||||
break;
|
break;
|
||||||
@@ -503,6 +505,7 @@ set_block_for_loop_instr(struct gcm_state *state, nir_instr *instr,
|
|||||||
if (loop == NULL)
|
if (loop == NULL)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
if (nir_block_dominates(instr->block, block))
|
if (nir_block_dominates(instr->block, block))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@@ -1621,6 +1621,7 @@ opt_if_cf_list(nir_builder *b, struct exec_list *cf_list,
|
|||||||
|
|
||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
progress |= opt_if_cf_list(b, &loop->body,
|
progress |= opt_if_cf_list(b, &loop->body,
|
||||||
options);
|
options);
|
||||||
progress |= opt_simplify_bcsel_of_phi(b, loop);
|
progress |= opt_simplify_bcsel_of_phi(b, loop);
|
||||||
@@ -1666,6 +1667,7 @@ opt_if_regs_cf_list(struct exec_list *cf_list)
|
|||||||
|
|
||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
progress |= opt_if_regs_cf_list(&loop->body);
|
progress |= opt_if_regs_cf_list(&loop->body);
|
||||||
progress |= opt_peel_loop_initial_if(loop);
|
progress |= opt_peel_loop_initial_if(loop);
|
||||||
break;
|
break;
|
||||||
@@ -1704,6 +1706,7 @@ opt_if_safe_cf_list(nir_builder *b, struct exec_list *cf_list)
|
|||||||
|
|
||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
progress |= opt_if_safe_cf_list(b, &loop->body);
|
progress |= opt_if_safe_cf_list(b, &loop->body);
|
||||||
progress |= opt_split_alu_of_phi(b, loop);
|
progress |= opt_split_alu_of_phi(b, loop);
|
||||||
break;
|
break;
|
||||||
|
@@ -969,6 +969,7 @@ process_loops(nir_shader *sh, nir_cf_node *cf_node, bool *has_nested_loop_out,
|
|||||||
}
|
}
|
||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
loop = nir_cf_node_as_loop(cf_node);
|
loop = nir_cf_node_as_loop(cf_node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
progress |= process_loops_in_block(sh, &loop->body, &has_nested_loop);
|
progress |= process_loops_in_block(sh, &loop->body, &has_nested_loop);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@@ -88,6 +88,7 @@ get_innermost_loop(nir_cf_node *node)
|
|||||||
static bool
|
static bool
|
||||||
loop_contains_block(nir_loop *loop, nir_block *block)
|
loop_contains_block(nir_loop *loop, nir_block *block)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
nir_block *before = nir_cf_node_as_block(nir_cf_node_prev(&loop->cf_node));
|
nir_block *before = nir_cf_node_as_block(nir_cf_node_prev(&loop->cf_node));
|
||||||
nir_block *after = nir_cf_node_as_block(nir_cf_node_next(&loop->cf_node));
|
nir_block *after = nir_cf_node_as_block(nir_cf_node_next(&loop->cf_node));
|
||||||
|
|
||||||
|
@@ -93,6 +93,7 @@ lower_trivial_continues_list(struct exec_list *cf_list,
|
|||||||
|
|
||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
if (lower_trivial_continues_list(&loop->body, true, loop))
|
if (lower_trivial_continues_list(&loop->body, true, loop))
|
||||||
progress = true;
|
progress = true;
|
||||||
if (lower_trivial_continues_block(nir_loop_last_block(loop), loop))
|
if (lower_trivial_continues_block(nir_loop_last_block(loop), loop))
|
||||||
|
@@ -109,6 +109,7 @@ sweep_if(nir_shader *nir, nir_if *iff)
|
|||||||
static void
|
static void
|
||||||
sweep_loop(nir_shader *nir, nir_loop *loop)
|
sweep_loop(nir_shader *nir, nir_loop *loop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
ralloc_steal(nir, loop);
|
ralloc_steal(nir, loop);
|
||||||
|
|
||||||
foreach_list_typed(nir_cf_node, cf_node, node, &loop->body) {
|
foreach_list_typed(nir_cf_node, cf_node, node, &loop->body) {
|
||||||
|
@@ -317,6 +317,7 @@ convert_to_lcssa(nir_cf_node *cf_node, lcssa_state *state)
|
|||||||
|
|
||||||
/* first, convert inner loops */
|
/* first, convert inner loops */
|
||||||
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
foreach_list_typed(nir_cf_node, nested_node, node, &loop->body)
|
foreach_list_typed(nir_cf_node, nested_node, node, &loop->body)
|
||||||
convert_to_lcssa(nested_node, state);
|
convert_to_lcssa(nested_node, state);
|
||||||
|
|
||||||
@@ -370,6 +371,7 @@ end:
|
|||||||
void
|
void
|
||||||
nir_convert_loop_to_lcssa(nir_loop *loop)
|
nir_convert_loop_to_lcssa(nir_loop *loop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
nir_function_impl *impl = nir_cf_node_get_function(&loop->cf_node);
|
nir_function_impl *impl = nir_cf_node_get_function(&loop->cf_node);
|
||||||
|
|
||||||
nir_metadata_require(impl, nir_metadata_block_index);
|
nir_metadata_require(impl, nir_metadata_block_index);
|
||||||
|
@@ -3676,6 +3676,7 @@ emit_if(struct ir3_context *ctx, nir_if *nif)
|
|||||||
static void
|
static void
|
||||||
emit_loop(struct ir3_context *ctx, nir_loop *nloop)
|
emit_loop(struct ir3_context *ctx, nir_loop *nloop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(nloop));
|
||||||
unsigned old_loop_id = ctx->loop_id;
|
unsigned old_loop_id = ctx->loop_id;
|
||||||
ctx->loop_id = ctx->so->loops + 1;
|
ctx->loop_id = ctx->so->loops + 1;
|
||||||
ctx->loop_depth++;
|
ctx->loop_depth++;
|
||||||
|
@@ -2634,6 +2634,7 @@ visit_if(struct lp_build_nir_context *bld_base, nir_if *if_stmt)
|
|||||||
static void
|
static void
|
||||||
visit_loop(struct lp_build_nir_context *bld_base, nir_loop *loop)
|
visit_loop(struct lp_build_nir_context *bld_base, nir_loop *loop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
bld_base->bgnloop(bld_base);
|
bld_base->bgnloop(bld_base);
|
||||||
visit_cf_list(bld_base, &loop->body);
|
visit_cf_list(bld_base, &loop->body);
|
||||||
bld_base->endloop(bld_base);
|
bld_base->endloop(bld_base);
|
||||||
|
@@ -2952,6 +2952,7 @@ ntt_emit_if(struct ntt_compile *c, nir_if *if_stmt)
|
|||||||
static void
|
static void
|
||||||
ntt_emit_loop(struct ntt_compile *c, nir_loop *loop)
|
ntt_emit_loop(struct ntt_compile *c, nir_loop *loop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
ntt_BGNLOOP(c);
|
ntt_BGNLOOP(c);
|
||||||
ntt_emit_cf_list(c, &loop->body);
|
ntt_emit_cf_list(c, &loop->body);
|
||||||
ntt_ENDLOOP(c);
|
ntt_ENDLOOP(c);
|
||||||
|
@@ -680,6 +680,7 @@ emit_cf_list(struct etna_compile *c, struct exec_list *list)
|
|||||||
emit_if(c, nir_cf_node_as_if(node));
|
emit_if(c, nir_cf_node_as_if(node));
|
||||||
break;
|
break;
|
||||||
case nir_cf_node_loop:
|
case nir_cf_node_loop:
|
||||||
|
assert(!nir_loop_has_continue_construct(nir_cf_node_as_loop(node)));
|
||||||
emit_cf_list(c, &nir_cf_node_as_loop(node)->body);
|
emit_cf_list(c, &nir_cf_node_as_loop(node)->body);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@@ -1019,6 +1019,7 @@ loop_last_block(struct exec_list *list)
|
|||||||
static void
|
static void
|
||||||
emit_loop(struct ir2_context *ctx, nir_loop *nloop)
|
emit_loop(struct ir2_context *ctx, nir_loop *nloop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(nloop));
|
||||||
ctx->loop_last_block[++ctx->loop_depth] = loop_last_block(&nloop->body);
|
ctx->loop_last_block[++ctx->loop_depth] = loop_last_block(&nloop->body);
|
||||||
emit_cf_list(ctx, &nloop->body);
|
emit_cf_list(ctx, &nloop->body);
|
||||||
ctx->loop_depth--;
|
ctx->loop_depth--;
|
||||||
|
@@ -733,6 +733,7 @@ static bool ppir_emit_if(ppir_compiler *comp, nir_if *if_stmt)
|
|||||||
|
|
||||||
static bool ppir_emit_loop(ppir_compiler *comp, nir_loop *nloop)
|
static bool ppir_emit_loop(ppir_compiler *comp, nir_loop *nloop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(nloop));
|
||||||
ppir_block *save_loop_cont_block = comp->loop_cont_block;
|
ppir_block *save_loop_cont_block = comp->loop_cont_block;
|
||||||
ppir_block *block;
|
ppir_block *block;
|
||||||
ppir_branch_node *loop_branch;
|
ppir_branch_node *loop_branch;
|
||||||
|
@@ -774,6 +774,7 @@ Shader::emit_control_flow(ControlFlowInstr::CFType type)
|
|||||||
bool
|
bool
|
||||||
Shader::process_loop(nir_loop *node)
|
Shader::process_loop(nir_loop *node)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(node));
|
||||||
SFN_TRACE_FUNC(SfnLog::flow, "LOOP");
|
SFN_TRACE_FUNC(SfnLog::flow, "LOOP");
|
||||||
if (!emit_control_flow(ControlFlowInstr::cf_loop_begin))
|
if (!emit_control_flow(ControlFlowInstr::cf_loop_begin))
|
||||||
return false;
|
return false;
|
||||||
|
@@ -157,6 +157,7 @@ static void scan_tess_ctrl(nir_cf_node *cf_node, unsigned *upper_block_tf_writem
|
|||||||
}
|
}
|
||||||
case nir_cf_node_loop: {
|
case nir_cf_node_loop: {
|
||||||
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
nir_loop *loop = nir_cf_node_as_loop(cf_node);
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
foreach_list_typed(nir_cf_node, nested_node, node, &loop->body)
|
foreach_list_typed(nir_cf_node, nested_node, node, &loop->body)
|
||||||
{
|
{
|
||||||
scan_tess_ctrl(nested_node, cond_block_tf_writemask, cond_block_tf_writemask,
|
scan_tess_ctrl(nested_node, cond_block_tf_writemask, cond_block_tf_writemask,
|
||||||
|
@@ -2050,6 +2050,7 @@ static void ntq_emit_cf_list(struct vc4_compile *c, struct exec_list *list);
|
|||||||
static void
|
static void
|
||||||
ntq_emit_loop(struct vc4_compile *c, nir_loop *loop)
|
ntq_emit_loop(struct vc4_compile *c, nir_loop *loop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
if (!c->vc4->screen->has_control_flow) {
|
if (!c->vc4->screen->has_control_flow) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"loop support requires updated kernel.\n");
|
"loop support requires updated kernel.\n");
|
||||||
|
@@ -4170,6 +4170,7 @@ emit_if(struct ntv_context *ctx, nir_if *if_stmt)
|
|||||||
static void
|
static void
|
||||||
emit_loop(struct ntv_context *ctx, nir_loop *loop)
|
emit_loop(struct ntv_context *ctx, nir_loop *loop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
SpvId header_id = spirv_builder_new_id(&ctx->builder);
|
SpvId header_id = spirv_builder_new_id(&ctx->builder);
|
||||||
SpvId begin_id = block_label(ctx, nir_loop_first_block(loop));
|
SpvId begin_id = block_label(ctx, nir_loop_first_block(loop));
|
||||||
SpvId break_id = spirv_builder_new_id(&ctx->builder);
|
SpvId break_id = spirv_builder_new_id(&ctx->builder);
|
||||||
|
@@ -388,6 +388,7 @@ fs_visitor::nir_emit_if(nir_if *if_stmt)
|
|||||||
void
|
void
|
||||||
fs_visitor::nir_emit_loop(nir_loop *loop)
|
fs_visitor::nir_emit_loop(nir_loop *loop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
bld.emit(BRW_OPCODE_DO);
|
bld.emit(BRW_OPCODE_DO);
|
||||||
|
|
||||||
nir_emit_cf_list(&loop->body);
|
nir_emit_cf_list(&loop->body);
|
||||||
|
@@ -124,6 +124,7 @@ vec4_visitor::nir_emit_if(nir_if *if_stmt)
|
|||||||
void
|
void
|
||||||
vec4_visitor::nir_emit_loop(nir_loop *loop)
|
vec4_visitor::nir_emit_loop(nir_loop *loop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
emit(BRW_OPCODE_DO);
|
emit(BRW_OPCODE_DO);
|
||||||
|
|
||||||
nir_emit_cf_list(&loop->body);
|
nir_emit_cf_list(&loop->body);
|
||||||
|
@@ -5646,6 +5646,7 @@ emit_if(struct ntd_context *ctx, struct nir_if *if_stmt)
|
|||||||
static bool
|
static bool
|
||||||
emit_loop(struct ntd_context *ctx, nir_loop *loop)
|
emit_loop(struct ntd_context *ctx, nir_loop *loop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
nir_block *first_block = nir_loop_first_block(loop);
|
nir_block *first_block = nir_loop_first_block(loop);
|
||||||
nir_block *last_block = nir_loop_last_block(loop);
|
nir_block *last_block = nir_loop_last_block(loop);
|
||||||
|
|
||||||
|
@@ -1556,6 +1556,7 @@ Converter::visit(nir_if *nif)
|
|||||||
bool
|
bool
|
||||||
Converter::visit(nir_loop *loop)
|
Converter::visit(nir_loop *loop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(loop));
|
||||||
curLoopDepth += 1;
|
curLoopDepth += 1;
|
||||||
func->loopNestingBound = std::max(func->loopNestingBound, curLoopDepth);
|
func->loopNestingBound = std::max(func->loopNestingBound, curLoopDepth);
|
||||||
|
|
||||||
|
@@ -4070,6 +4070,8 @@ emit_if(bi_context *ctx, nir_if *nif)
|
|||||||
static void
|
static void
|
||||||
emit_loop(bi_context *ctx, nir_loop *nloop)
|
emit_loop(bi_context *ctx, nir_loop *nloop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(nloop));
|
||||||
|
|
||||||
/* Remember where we are */
|
/* Remember where we are */
|
||||||
bi_block *start_block = ctx->current_block;
|
bi_block *start_block = ctx->current_block;
|
||||||
|
|
||||||
|
@@ -2935,6 +2935,8 @@ emit_if(struct compiler_context *ctx, nir_if *nif)
|
|||||||
static void
|
static void
|
||||||
emit_loop(struct compiler_context *ctx, nir_loop *nloop)
|
emit_loop(struct compiler_context *ctx, nir_loop *nloop)
|
||||||
{
|
{
|
||||||
|
assert(!nir_loop_has_continue_construct(nloop));
|
||||||
|
|
||||||
/* Remember where we are */
|
/* Remember where we are */
|
||||||
midgard_block *start_block = ctx->current_block;
|
midgard_block *start_block = ctx->current_block;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user