mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-09 16:10:43 +02:00
ir3: Fix RA debug printing
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12033>
This commit is contained in:
parent
e8d2253bf6
commit
dd4e2f507a
6 changed files with 55 additions and 45 deletions
|
|
@ -1586,6 +1586,9 @@ void ir3_validate(struct ir3 *ir);
|
|||
void ir3_print(struct ir3 *ir);
|
||||
void ir3_print_instr(struct ir3_instruction *instr);
|
||||
|
||||
struct log_stream;
|
||||
void ir3_print_instr_stream(struct log_stream *stream, struct ir3_instruction *instr);
|
||||
|
||||
/* delay calculation: */
|
||||
int ir3_delayslots(struct ir3_instruction *assigner,
|
||||
struct ir3_instruction *consumer, unsigned n, bool soft);
|
||||
|
|
|
|||
|
|
@ -498,7 +498,7 @@ index_merge_sets(struct ir3 *ir)
|
|||
static void
|
||||
dump_merge_sets(struct ir3 *ir)
|
||||
{
|
||||
printf("merge sets:\n");
|
||||
d("merge sets:");
|
||||
struct set *merge_sets = _mesa_pointer_set_create(NULL);
|
||||
foreach_block (block, &ir->block_list) {
|
||||
foreach_instr (instr, &block->instr_list) {
|
||||
|
|
@ -509,12 +509,12 @@ dump_merge_sets(struct ir3 *ir)
|
|||
if (!merge_set || _mesa_set_search(merge_sets, merge_set))
|
||||
continue;
|
||||
|
||||
printf("merge set, size %u, align %u:\n", merge_set->size,
|
||||
merge_set->alignment);
|
||||
d("merge set, size %u, align %u:", merge_set->size,
|
||||
merge_set->alignment);
|
||||
for (unsigned j = 0; j < merge_set->regs_count; j++) {
|
||||
struct ir3_register *reg = merge_set->regs[j];
|
||||
printf("\t" SYN_SSA("ssa_%u") ":%u, offset %u\n",
|
||||
reg->instr->serialno, reg->name, reg->merge_set_offset);
|
||||
d("\t" SYN_SSA("ssa_%u") ":%u, offset %u",
|
||||
reg->instr->serialno, reg->name, reg->merge_set_offset);
|
||||
}
|
||||
|
||||
_mesa_set_add(merge_sets, merge_set);
|
||||
|
|
|
|||
|
|
@ -422,6 +422,12 @@ print_instr(struct log_stream *stream, struct ir3_instruction *instr, int lvl)
|
|||
mesa_log_stream_printf(stream, "\n");
|
||||
}
|
||||
|
||||
void
|
||||
ir3_print_instr_stream(struct log_stream *stream, struct ir3_instruction *instr)
|
||||
{
|
||||
print_instr(stream, instr, 0);
|
||||
}
|
||||
|
||||
void
|
||||
ir3_print_instr(struct ir3_instruction *instr)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -253,26 +253,28 @@ ir3_reg_interval_remove_temp(struct ir3_reg_ctx *ctx,
|
|||
}
|
||||
|
||||
static void
|
||||
interval_dump(struct ir3_reg_interval *interval, unsigned indent)
|
||||
interval_dump(struct log_stream *stream, struct ir3_reg_interval *interval,
|
||||
unsigned indent)
|
||||
{
|
||||
for (unsigned i = 0; i < indent; i++)
|
||||
printf("\t");
|
||||
printf("reg %u start %u\n", interval->reg->name,
|
||||
interval->reg->interval_start);
|
||||
mesa_log_stream_printf(stream, "\t");
|
||||
mesa_log_stream_printf(stream, "reg %u start %u\n", interval->reg->name,
|
||||
interval->reg->interval_start);
|
||||
|
||||
rb_tree_foreach (struct ir3_reg_interval, child, &interval->children, node) {
|
||||
interval_dump(child, indent + 1);
|
||||
interval_dump(stream, child, indent + 1);
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < indent; i++)
|
||||
printf("\t");
|
||||
printf("reg %u end %u\n", interval->reg->name, interval->reg->interval_end);
|
||||
mesa_log_stream_printf(stream, "\t");
|
||||
mesa_log_stream_printf(stream, "reg %u end %u\n", interval->reg->name,
|
||||
interval->reg->interval_end);
|
||||
}
|
||||
|
||||
void
|
||||
ir3_reg_interval_dump(struct ir3_reg_interval *interval)
|
||||
ir3_reg_interval_dump(struct log_stream *stream, struct ir3_reg_interval *interval)
|
||||
{
|
||||
interval_dump(interval, 0);
|
||||
interval_dump(stream, interval, 0);
|
||||
}
|
||||
|
||||
/* These are the core datastructures used by the register allocator. First
|
||||
|
|
@ -616,45 +618,47 @@ ra_interval_init(struct ra_interval *interval, struct ir3_register *reg)
|
|||
}
|
||||
|
||||
static void
|
||||
ra_interval_dump(struct ra_interval *interval)
|
||||
ra_interval_dump(struct log_stream *stream, struct ra_interval *interval)
|
||||
{
|
||||
printf("physreg %u ", interval->physreg_start);
|
||||
mesa_log_stream_printf(stream, "physreg %u ", interval->physreg_start);
|
||||
|
||||
ir3_reg_interval_dump(&interval->interval);
|
||||
ir3_reg_interval_dump(stream, &interval->interval);
|
||||
}
|
||||
|
||||
static void
|
||||
ra_file_dump(struct ra_file *file)
|
||||
ra_file_dump(struct log_stream *stream, struct ra_file *file)
|
||||
{
|
||||
rb_tree_foreach (struct ra_interval, interval, &file->physreg_intervals,
|
||||
physreg_node) {
|
||||
ra_interval_dump(interval);
|
||||
ra_interval_dump(stream, interval);
|
||||
}
|
||||
|
||||
unsigned start, end;
|
||||
printf("available:\n");
|
||||
mesa_log_stream_printf(stream, "available:\n");
|
||||
BITSET_FOREACH_RANGE (start, end, file->available, file->size) {
|
||||
printf("%u-%u ", start, end);
|
||||
mesa_log_stream_printf(stream, "%u-%u ", start, end);
|
||||
}
|
||||
printf("\n");
|
||||
mesa_log_stream_printf(stream, "\n");
|
||||
|
||||
printf("available to evict:\n");
|
||||
mesa_log_stream_printf(stream, "available to evict:\n");
|
||||
BITSET_FOREACH_RANGE (start, end, file->available_to_evict, file->size) {
|
||||
printf("%u-%u ", start, end);
|
||||
mesa_log_stream_printf(stream, "%u-%u ", start, end);
|
||||
}
|
||||
printf("\n");
|
||||
printf("start: %u\n", file->start);
|
||||
mesa_log_stream_printf(stream, "\n");
|
||||
mesa_log_stream_printf(stream, "start: %u\n", file->start);
|
||||
}
|
||||
|
||||
static void
|
||||
ra_ctx_dump(struct ra_ctx *ctx)
|
||||
{
|
||||
printf("full:\n");
|
||||
ra_file_dump(&ctx->full);
|
||||
printf("half:\n");
|
||||
ra_file_dump(&ctx->half);
|
||||
printf("shared:\n");
|
||||
ra_file_dump(&ctx->shared);
|
||||
struct log_stream *stream = mesa_log_streami();
|
||||
mesa_log_stream_printf(stream, "full:\n");
|
||||
ra_file_dump(stream, &ctx->full);
|
||||
mesa_log_stream_printf(stream, "half:\n");
|
||||
ra_file_dump(stream, &ctx->half);
|
||||
mesa_log_stream_printf(stream, "shared:");
|
||||
ra_file_dump(stream, &ctx->shared);
|
||||
mesa_log_stream_destroy(stream);
|
||||
}
|
||||
|
||||
static unsigned
|
||||
|
|
@ -1923,7 +1927,7 @@ handle_block(struct ra_ctx *ctx, struct ir3_block *block)
|
|||
insert_live_in_moves(ctx);
|
||||
|
||||
if (RA_DEBUG) {
|
||||
printf("after live-in block %u:\n", block->index);
|
||||
d("after live-in block %u:\n", block->index);
|
||||
ra_ctx_dump(ctx);
|
||||
}
|
||||
|
||||
|
|
@ -1931,10 +1935,7 @@ handle_block(struct ra_ctx *ctx, struct ir3_block *block)
|
|||
* block.
|
||||
*/
|
||||
foreach_instr (instr, &block->instr_list) {
|
||||
if (RA_DEBUG) {
|
||||
printf("processing: ");
|
||||
ir3_print_instr(instr);
|
||||
}
|
||||
di(instr, "processing");
|
||||
|
||||
if (instr->opc == OPC_META_PHI)
|
||||
assign_phi(ctx, instr);
|
||||
|
|
|
|||
|
|
@ -36,15 +36,17 @@
|
|||
#define d(fmt, ...) \
|
||||
do { \
|
||||
if (RA_DEBUG) { \
|
||||
printf("RA: " fmt "\n", ##__VA_ARGS__); \
|
||||
mesa_logi("RA: " fmt, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define di(instr, fmt, ...) \
|
||||
do { \
|
||||
if (RA_DEBUG) { \
|
||||
printf("RA: " fmt ": ", ##__VA_ARGS__); \
|
||||
ir3_print_instr(instr); \
|
||||
struct log_stream *stream = mesa_log_streami(); \
|
||||
mesa_log_stream_printf(stream, "RA: " fmt ": ", ##__VA_ARGS__); \
|
||||
ir3_print_instr_stream(stream, instr); \
|
||||
mesa_log_stream_destroy(stream); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
|
@ -257,7 +259,8 @@ ir3_reg_interval_init(struct ir3_reg_interval *interval,
|
|||
interval->inserted = false;
|
||||
}
|
||||
|
||||
void ir3_reg_interval_dump(struct ir3_reg_interval *interval);
|
||||
void ir3_reg_interval_dump(struct log_stream *stream,
|
||||
struct ir3_reg_interval *interval);
|
||||
|
||||
void ir3_reg_interval_insert(struct ir3_reg_ctx *ctx,
|
||||
struct ir3_reg_interval *interval);
|
||||
|
|
|
|||
|
|
@ -240,10 +240,7 @@ update_max_pressure(struct ra_spill_ctx *ctx)
|
|||
static void
|
||||
handle_instr(struct ra_spill_ctx *ctx, struct ir3_instruction *instr)
|
||||
{
|
||||
if (RA_DEBUG) {
|
||||
printf("processing: ");
|
||||
ir3_print_instr(instr);
|
||||
}
|
||||
di(instr, "processing");
|
||||
|
||||
ra_foreach_dst (dst, instr) {
|
||||
init_dst(ctx, dst);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue