From 876f37ed59358c64b4a6b9c1ed18fd29bf27440c Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 27 Nov 2020 13:28:33 -0500 Subject: [PATCH] pan/bi: Use canonical name for segments Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bi_print.c | 12 ++++++------ src/panfrost/bifrost/bi_ra.c | 6 +++--- src/panfrost/bifrost/bifrost_compile.c | 4 ++-- src/panfrost/bifrost/compiler.h | 12 ++++++------ src/panfrost/bifrost/gen_pack.py | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/panfrost/bifrost/bi_print.c b/src/panfrost/bifrost/bi_print.c index 0f3f14e699b..78bf455ca43 100644 --- a/src/panfrost/bifrost/bi_print.c +++ b/src/panfrost/bifrost/bi_print.c @@ -28,13 +28,13 @@ #include "bi_print_common.h" static const char * -bi_segment_name(enum bi_segment seg) +bi_seg_name(enum bi_seg seg) { switch (seg) { - case BI_SEGMENT_NONE: return "global"; - case BI_SEGMENT_WLS: return "wls"; - case BI_SEGMENT_UBO: return "ubo"; - case BI_SEGMENT_TLS: return "tls"; + case BI_SEG_NONE: return "global"; + case BI_SEG_WLS: return "wls"; + case BI_SEG_UBO: return "ubo"; + case BI_SEG_TL: return "tls"; default: return "invalid"; } } @@ -335,7 +335,7 @@ bi_print_instruction(bi_instruction *ins, FILE *fp) fprintf(fp, ".v%u", ins->vector_channels); if (ins->segment) - fprintf(fp, ".%s", bi_segment_name(ins->segment)); + fprintf(fp, ".%s", bi_seg_name(ins->segment)); if (ins->dest) pan_print_alu_type(ins->dest_type, fp); diff --git a/src/panfrost/bifrost/bi_ra.c b/src/panfrost/bifrost/bi_ra.c index 3936c47c4ca..3f12806a7cd 100644 --- a/src/panfrost/bifrost/bi_ra.c +++ b/src/panfrost/bifrost/bi_ra.c @@ -193,7 +193,7 @@ bi_spill(unsigned node, uint64_t offset, unsigned channels) { bi_instruction store = { .type = BI_STORE, - .segment = BI_SEGMENT_TLS, + .segment = BI_SEG_TL, .vector_channels = channels, .src = { node, @@ -216,7 +216,7 @@ bi_fill(unsigned node, uint64_t offset, unsigned channels) { bi_instruction load = { .type = BI_LOAD, - .segment = BI_SEGMENT_TLS, + .segment = BI_SEG_TL, .vector_channels = channels, .dest = node, .dest_type = nir_type_uint32, @@ -329,7 +329,7 @@ bi_spill_register(bi_context *ctx, unsigned node, unsigned offset) if (!bi_has_arg(ins, node)) continue; /* Don't rewrite spills themselves */ - if (ins->segment == BI_SEGMENT_TLS) continue; + if (ins->segment == BI_SEG_TL) continue; unsigned index = bi_make_temp(ctx); diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 903081881fd..546d350435d 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -500,7 +500,7 @@ bi_emit_ld_ubo(bi_context *ctx, nir_intrinsic_instr *instr) bi_instruction ld = { .type = BI_LOAD_UNIFORM, - .segment = BI_SEGMENT_UBO, + .segment = BI_SEG_UBO, .vector_channels = instr->num_components, .src_types = { nir_type_uint32, nir_type_uint32 }, .dest = pan_dest_index(&instr->dest), @@ -541,7 +541,7 @@ bi_emit_sysval(bi_context *ctx, nir_instr *instr, bi_instruction load = { .type = BI_LOAD_UNIFORM, - .segment = BI_SEGMENT_UBO, + .segment = BI_SEG_UBO, .vector_channels = nr_components, .src = { BIR_INDEX_CONSTANT, BIR_INDEX_ZERO }, .src_types = { nir_type_uint32, nir_type_uint32 }, diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index 0f3a2b02b42..e356b01374b 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -170,23 +170,23 @@ enum bi_cond { * instructions for address calculation, and directly in SEG_ADD/SEG_SUB * instructions. */ -enum bi_segment { +enum bi_seg { /* No segment (use global addressing, offset from GPU VA 0x0) */ - BI_SEGMENT_NONE = 1, + BI_SEG_NONE = 1, /* Within workgroup local memory (shared memory). Relative to * wls_base_pointer in the draw's thread storage descriptor */ - BI_SEGMENT_WLS = 2, + BI_SEG_WLS = 2, /* Within one of the bound uniform buffers. Low 32-bits are the index * within the uniform buffer; high 32-bits are the index of the uniform * buffer itself. Relative to the uniform_array_pointer indexed within * the draw's uniform remap table indexed by the high 32-bits. */ - BI_SEGMENT_UBO = 4, + BI_SEG_UBO = 4, /* Within thread local storage (for spilling). Relative to * tls_base_pointer in the draw's thread storage descriptor */ - BI_SEGMENT_TLS = 7 + BI_SEG_TL = 7 }; /* Opcodes within a class */ @@ -375,7 +375,7 @@ typedef struct { enum bi_cond cond; /* For memory ops, base address */ - enum bi_segment segment; + enum bi_seg segment; /* Can we spill the value written here? Used to prevent * useless double fills */ diff --git a/src/panfrost/bifrost/gen_pack.py b/src/panfrost/bifrost/gen_pack.py index 3f188a076d6..af3b2866e96 100644 --- a/src/panfrost/bifrost/gen_pack.py +++ b/src/panfrost/bifrost/gen_pack.py @@ -204,8 +204,8 @@ def pack_seg(mod, opts, body, pack_exprs): body.append('assert(ins->segment);') return 'ins->segment' elif opts == ['none', 'wls']: - body.append('assert(ins->segment == BI_SEGMENT_NONE || ins->segment == BI_SEGMENT_WLS);') - return 'ins->segment == BI_SEGMENT_WLS ? 1 : 0' + body.append('assert(ins->segment == BI_SEG_NONE || ins->segment == BI_SEG_WLS);') + return 'ins->segment == BI_SEG_WLS ? 1 : 0' else: assert(False)