ir3: Make the debug-print block numbers be the NIR block numbers.
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

We still have to fall back to our pointers-as-indices for things like the
preamble's block or old streamout (I'm presuming here that pointers will
always be much greater than the NIR block count, which seems safe enough
for debug).  This gives us nice printouts in debugoptimized builds, and
helps you correlate your ir3 back to NIR (which was helpful in the
hundreds of blocks in the shader I fixed in the previous commit).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38666>
This commit is contained in:
Emma Anholt 2025-11-25 15:47:34 -08:00 committed by Marge Bot
parent a35f26a983
commit 2d441c10af
2 changed files with 9 additions and 16 deletions

View file

@ -644,15 +644,20 @@ struct ir3_block *
ir3_block_create(struct ir3 *shader)
{
struct ir3_block *block = ir3_alloc(shader, sizeof(*block));
#if MESA_DEBUG
block->serialno = ++shader->block_count;
#endif
block->shader = shader;
list_inithead(&block->node);
list_inithead(&block->instr_list);
return block;
}
uint32_t
block_id(struct ir3_block *block)
{
if (block->nblock)
return block->nblock->index;
return (uint32_t)(unsigned long)block;
}
struct ir3_instruction *
ir3_find_end(struct ir3 *ir)
{

View file

@ -768,10 +768,6 @@ struct ir3_block {
uint32_t dom_post_index;
uint32_t loop_depth;
#if MESA_DEBUG
uint32_t serialno;
#endif
};
enum ir3_cursor_option {
@ -793,15 +789,7 @@ struct ir3_builder {
struct ir3_cursor cursor;
};
static inline uint32_t
block_id(struct ir3_block *block)
{
#if MESA_DEBUG
return block->serialno;
#else
return (uint32_t)(unsigned long)block;
#endif
}
uint32_t block_id(struct ir3_block *block);
static inline struct ir3_block *
ir3_start_block(struct ir3 *ir)