radv,aco: remove aco_compiler_statistics

This removes a pointer from radv_shader_binary_legacy::data.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9411>
This commit is contained in:
Rhys Perry 2021-03-04 16:41:05 +00:00 committed by Marge Bot
parent b4d1764b46
commit 7c7e8942f8
4 changed files with 13 additions and 18 deletions

View File

@ -30,7 +30,7 @@
#include <array>
#include <iostream>
const std::array<aco_compiler_statistic_info, aco::num_statistics> statistic_infos = []()
static const std::array<aco_compiler_statistic_info, aco::num_statistics> statistic_infos = []()
{
std::array<aco_compiler_statistic_info, aco::num_statistics> ret{};
ret[aco::statistic_hash] = aco_compiler_statistic_info{"Hash", "CRC32 hash of code and constant data"};
@ -47,6 +47,9 @@ const std::array<aco_compiler_statistic_info, aco::num_statistics> statistic_inf
return ret;
}();
const unsigned aco_num_statistics = aco::num_statistics;
const aco_compiler_statistic_info *aco_statistic_infos = statistic_infos.data();
static void validate(aco::Program *program)
{
if (!(aco::debug_flags & aco::DEBUG_VALIDATE_IR))
@ -196,7 +199,7 @@ void aco_compile_shader(unsigned shader_count,
size_t stats_size = 0;
if (program->collect_statistics)
stats_size = sizeof(aco_compiler_statistics) + aco::num_statistics * sizeof(uint32_t);
stats_size = aco::num_statistics * sizeof(uint32_t);
size += stats_size;
size += code.size() * sizeof(uint32_t) + sizeof(radv_shader_binary_legacy);
@ -211,12 +214,8 @@ void aco_compile_shader(unsigned shader_count,
legacy_binary->base.is_gs_copy_shader = args->is_gs_copy_shader;
legacy_binary->base.total_size = size;
if (program->collect_statistics) {
aco_compiler_statistics *statistics = (aco_compiler_statistics *)legacy_binary->data;
statistics->count = aco::num_statistics;
statistics->infos = statistic_infos.data();
memcpy(statistics->values, program->statistics, aco::num_statistics * sizeof(uint32_t));
}
if (program->collect_statistics)
memcpy(legacy_binary->data, program->statistics, aco::num_statistics * sizeof(uint32_t));
legacy_binary->stats_size = stats_size;
memcpy(legacy_binary->data + legacy_binary->stats_size, code.data(), code.size() * sizeof(uint32_t));

View File

@ -37,11 +37,8 @@ struct aco_compiler_statistic_info {
char desc[64];
};
struct aco_compiler_statistics {
unsigned count;
const struct aco_compiler_statistic_info *infos;
uint32_t values[];
};
extern const unsigned aco_num_statistics;
extern const struct aco_compiler_statistic_info *aco_statistic_infos;
void aco_compile_shader(unsigned shader_count,
struct nir_shader *const *shaders,

View File

@ -5943,14 +5943,13 @@ VkResult radv_GetPipelineExecutableStatisticsKHR(
++s;
if (shader->statistics) {
for (unsigned i = 0; i < shader->statistics->count; i++) {
const struct aco_compiler_statistic_info *info = &shader->statistics->infos[i];
uint32_t value = shader->statistics->values[i];
for (unsigned i = 0; i < aco_num_statistics; i++) {
const struct aco_compiler_statistic_info *info = &aco_statistic_infos[i];
if (s < end) {
desc_copy(s->name, info->name);
desc_copy(s->description, info->desc);
s->format = VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR;
s->value.u64 = value;
s->value.u64 = shader->statistics[i];
}
++s;
}

View File

@ -410,7 +410,7 @@ struct radv_shader_variant {
char *nir_string;
char *disasm_string;
char *ir_string;
struct aco_compiler_statistics *statistics;
uint32_t *statistics;
struct list_head slab_list;
};