pan/bi: add a MEMORY_BARRIER pseudo-instruction

This is purely a scheduling barrier for memory instructions. We
need this to implement subgroup barriers.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32710>
This commit is contained in:
Caterina Shablia 2025-01-13 18:09:34 +00:00 committed by Marge Bot
parent 39bd5cba68
commit f77a50e45e
2 changed files with 11 additions and 7 deletions

View file

@ -191,5 +191,6 @@
<src start="0"/>
</ins>
<ins name="MEMORY_BARRIER" pseudo="true" unit="NONE"/>
</bifrost>

View file

@ -85,6 +85,8 @@ create_dag(bi_context *ctx, bi_block *block, void *memctx)
bi_foreach_dest(I, d)
last_write[I->dest[d].value] = node;
add_dep(node, preload);
switch (bi_opcode_props[I->op].message) {
case BIFROST_MESSAGE_LOAD:
/* Regular memory loads needs to be serialized against
@ -146,21 +148,22 @@ create_dag(bi_context *ctx, bi_block *block, void *memctx)
break;
}
add_dep(node, preload);
if (I->op == BI_OPCODE_DISCARD_F32) {
/* Serialize against ATEST */
add_dep(node, coverage);
coverage = node;
/* Also serialize against memory and barriers */
}
if (I->op == BI_OPCODE_DISCARD_F32 ||
I->op == BI_OPCODE_MEMORY_BARRIER) {
/* Serialize against memory operations and barriers */
add_dep(node, memory_load);
add_dep(node, memory_store);
memory_load = node;
memory_store = node;
} else if ((I->op == BI_OPCODE_PHI) ||
(I->op == BI_OPCODE_MOV_I32 &&
I->src[0].type == BI_INDEX_REGISTER)) {
}
if ((I->op == BI_OPCODE_PHI) ||
(I->op == BI_OPCODE_MOV_I32 &&
I->src[0].type == BI_INDEX_REGISTER)) {
preload = node;
}
}