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:
@@ -30,7 +30,7 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <iostream>
|
#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{};
|
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"};
|
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;
|
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)
|
static void validate(aco::Program *program)
|
||||||
{
|
{
|
||||||
if (!(aco::debug_flags & aco::DEBUG_VALIDATE_IR))
|
if (!(aco::debug_flags & aco::DEBUG_VALIDATE_IR))
|
||||||
@@ -196,7 +199,7 @@ void aco_compile_shader(unsigned shader_count,
|
|||||||
|
|
||||||
size_t stats_size = 0;
|
size_t stats_size = 0;
|
||||||
if (program->collect_statistics)
|
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 += stats_size;
|
||||||
|
|
||||||
size += code.size() * sizeof(uint32_t) + sizeof(radv_shader_binary_legacy);
|
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.is_gs_copy_shader = args->is_gs_copy_shader;
|
||||||
legacy_binary->base.total_size = size;
|
legacy_binary->base.total_size = size;
|
||||||
|
|
||||||
if (program->collect_statistics) {
|
if (program->collect_statistics)
|
||||||
aco_compiler_statistics *statistics = (aco_compiler_statistics *)legacy_binary->data;
|
memcpy(legacy_binary->data, program->statistics, aco::num_statistics * sizeof(uint32_t));
|
||||||
statistics->count = aco::num_statistics;
|
|
||||||
statistics->infos = statistic_infos.data();
|
|
||||||
memcpy(statistics->values, program->statistics, aco::num_statistics * sizeof(uint32_t));
|
|
||||||
}
|
|
||||||
legacy_binary->stats_size = stats_size;
|
legacy_binary->stats_size = stats_size;
|
||||||
|
|
||||||
memcpy(legacy_binary->data + legacy_binary->stats_size, code.data(), code.size() * sizeof(uint32_t));
|
memcpy(legacy_binary->data + legacy_binary->stats_size, code.data(), code.size() * sizeof(uint32_t));
|
||||||
|
@@ -37,11 +37,8 @@ struct aco_compiler_statistic_info {
|
|||||||
char desc[64];
|
char desc[64];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct aco_compiler_statistics {
|
extern const unsigned aco_num_statistics;
|
||||||
unsigned count;
|
extern const struct aco_compiler_statistic_info *aco_statistic_infos;
|
||||||
const struct aco_compiler_statistic_info *infos;
|
|
||||||
uint32_t values[];
|
|
||||||
};
|
|
||||||
|
|
||||||
void aco_compile_shader(unsigned shader_count,
|
void aco_compile_shader(unsigned shader_count,
|
||||||
struct nir_shader *const *shaders,
|
struct nir_shader *const *shaders,
|
||||||
|
@@ -5943,14 +5943,13 @@ VkResult radv_GetPipelineExecutableStatisticsKHR(
|
|||||||
++s;
|
++s;
|
||||||
|
|
||||||
if (shader->statistics) {
|
if (shader->statistics) {
|
||||||
for (unsigned i = 0; i < shader->statistics->count; i++) {
|
for (unsigned i = 0; i < aco_num_statistics; i++) {
|
||||||
const struct aco_compiler_statistic_info *info = &shader->statistics->infos[i];
|
const struct aco_compiler_statistic_info *info = &aco_statistic_infos[i];
|
||||||
uint32_t value = shader->statistics->values[i];
|
|
||||||
if (s < end) {
|
if (s < end) {
|
||||||
desc_copy(s->name, info->name);
|
desc_copy(s->name, info->name);
|
||||||
desc_copy(s->description, info->desc);
|
desc_copy(s->description, info->desc);
|
||||||
s->format = VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR;
|
s->format = VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR;
|
||||||
s->value.u64 = value;
|
s->value.u64 = shader->statistics[i];
|
||||||
}
|
}
|
||||||
++s;
|
++s;
|
||||||
}
|
}
|
||||||
|
@@ -410,7 +410,7 @@ struct radv_shader_variant {
|
|||||||
char *nir_string;
|
char *nir_string;
|
||||||
char *disasm_string;
|
char *disasm_string;
|
||||||
char *ir_string;
|
char *ir_string;
|
||||||
struct aco_compiler_statistics *statistics;
|
uint32_t *statistics;
|
||||||
|
|
||||||
struct list_head slab_list;
|
struct list_head slab_list;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user