From 4d18e71fea908ca64b23ee28d36fec780970e9b2 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Mon, 31 Aug 2020 13:04:50 -0500 Subject: [PATCH] nir: Rename num_shared to shared_size This one is always a size in bytes. Reviewed-by: Boris Brezillon Part-of: --- src/compiler/nir/nir.c | 2 +- src/compiler/nir/nir.h | 5 ++++- src/compiler/nir/nir_clone.c | 2 +- src/compiler/nir/nir_lower_io.c | 2 +- src/compiler/nir/nir_print.c | 2 +- src/compiler/nir/nir_serialize.c | 4 ++-- src/intel/compiler/brw_fs.cpp | 2 +- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index aa259806d54..79e4ae30027 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -60,7 +60,7 @@ nir_shader_create(void *mem_ctx, shader->num_inputs = 0; shader->num_outputs = 0; shader->num_uniforms = 0; - shader->num_shared = 0; + shader->shared_size = 0; return shader; } diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index e5091831350..6195a66fd25 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -3325,7 +3325,10 @@ typedef struct nir_shader { * the highest index a load_input_*, load_uniform_*, etc. intrinsic can * access plus one */ - unsigned num_inputs, num_uniforms, num_outputs, num_shared; + unsigned num_inputs, num_uniforms, num_outputs; + + /** Size in bytes of required shared memory */ + unsigned shared_size; /** Size in bytes of required scratch space */ unsigned scratch_size; diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c index 9e0bd7bf891..946b9ebf0a7 100644 --- a/src/compiler/nir/nir_clone.c +++ b/src/compiler/nir/nir_clone.c @@ -756,7 +756,7 @@ nir_shader_clone(void *mem_ctx, const nir_shader *s) ns->num_inputs = s->num_inputs; ns->num_uniforms = s->num_uniforms; ns->num_outputs = s->num_outputs; - ns->num_shared = s->num_shared; + ns->shared_size = s->shared_size; ns->scratch_size = s->scratch_size; ns->constant_data_size = s->constant_data_size; diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index be1cfdfef38..9250a7ec1bb 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -1578,7 +1578,7 @@ lower_vars_to_explicit(nir_shader *shader, break; case nir_var_mem_shared: shader->info.cs.shared_size = offset; - shader->num_shared = offset; + shader->shared_size = offset; break; default: unreachable("Unsupported mode"); diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index 00cf235166b..07d1cdc3c79 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -1586,7 +1586,7 @@ nir_print_shader_annotated(nir_shader *shader, FILE *fp, fprintf(fp, "uniforms: %u\n", shader->num_uniforms); if (shader->info.num_ubos) fprintf(fp, "ubos: %u\n", shader->info.num_ubos); - fprintf(fp, "shared: %u\n", shader->num_shared); + fprintf(fp, "shared: %u\n", shader->shared_size); if (shader->scratch_size) fprintf(fp, "scratch: %u\n", shader->scratch_size); if (shader->constant_data_size) diff --git a/src/compiler/nir/nir_serialize.c b/src/compiler/nir/nir_serialize.c index 626b7d44a02..33c740cf623 100644 --- a/src/compiler/nir/nir_serialize.c +++ b/src/compiler/nir/nir_serialize.c @@ -2022,7 +2022,7 @@ nir_serialize(struct blob *blob, const nir_shader *nir, bool strip) blob_write_uint32(blob, nir->num_inputs); blob_write_uint32(blob, nir->num_uniforms); blob_write_uint32(blob, nir->num_outputs); - blob_write_uint32(blob, nir->num_shared); + blob_write_uint32(blob, nir->shared_size); blob_write_uint32(blob, nir->scratch_size); blob_write_uint32(blob, exec_list_length(&nir->functions)); @@ -2075,7 +2075,7 @@ nir_deserialize(void *mem_ctx, ctx.nir->num_inputs = blob_read_uint32(blob); ctx.nir->num_uniforms = blob_read_uint32(blob); ctx.nir->num_outputs = blob_read_uint32(blob); - ctx.nir->num_shared = blob_read_uint32(blob); + ctx.nir->shared_size = blob_read_uint32(blob); ctx.nir->scratch_size = blob_read_uint32(blob); unsigned num_functions = blob_read_uint32(blob); diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index ec08d84554a..2cf05a2fdfb 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -8948,7 +8948,7 @@ brw_compile_cs(const struct brw_compiler *compiler, void *log_data, char **error_str) { prog_data->base.total_shared = src_shader->info.cs.shared_size; - prog_data->slm_size = src_shader->num_shared; + prog_data->slm_size = src_shader->shared_size; /* Generate code for all the possible SIMD variants. */ bool generate_all; -- 2.30.2