aco: Replace indexed array initialization
Use std::array instead to make MSVC happy. Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7785>
This commit is contained in:
@@ -27,21 +27,25 @@
|
||||
#include "vulkan/radv_shader.h"
|
||||
#include "vulkan/radv_shader_args.h"
|
||||
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
|
||||
static aco_compiler_statistic_info statistic_infos[] = {
|
||||
[aco::statistic_hash] = {"Hash", "CRC32 hash of code and constant data"},
|
||||
[aco::statistic_instructions] = {"Instructions", "Instruction count"},
|
||||
[aco::statistic_copies] = {"Copies", "Copy instructions created for pseudo-instructions"},
|
||||
[aco::statistic_branches] = {"Branches", "Branch instructions"},
|
||||
[aco::statistic_cycles] = {"Busy Cycles", "Estimate of busy cycles"},
|
||||
[aco::statistic_vmem_clauses] = {"VMEM Clause", "Number of VMEM clauses (includes 1-sized clauses)"},
|
||||
[aco::statistic_smem_clauses] = {"SMEM Clause", "Number of SMEM clauses (includes 1-sized clauses)"},
|
||||
[aco::statistic_vmem_score] = {"VMEM Score", "Average VMEM def-use distances"},
|
||||
[aco::statistic_smem_score] = {"SMEM Score", "Average SMEM def-use distances"},
|
||||
[aco::statistic_sgpr_presched] = {"Pre-Sched SGPRs", "SGPR usage before scheduling"},
|
||||
[aco::statistic_vgpr_presched] = {"Pre-Sched VGPRs", "VGPR usage before scheduling"},
|
||||
};
|
||||
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"};
|
||||
ret[aco::statistic_instructions] = aco_compiler_statistic_info{"Instructions", "Instruction count"};
|
||||
ret[aco::statistic_copies] = aco_compiler_statistic_info{"Copies", "Copy instructions created for pseudo-instructions"};
|
||||
ret[aco::statistic_branches] = aco_compiler_statistic_info{"Branches", "Branch instructions"};
|
||||
ret[aco::statistic_cycles] = aco_compiler_statistic_info{"Busy Cycles", "Estimate of busy cycles"};
|
||||
ret[aco::statistic_vmem_clauses] = aco_compiler_statistic_info{"VMEM Clause", "Number of VMEM clauses (includes 1-sized clauses)"};
|
||||
ret[aco::statistic_smem_clauses] = aco_compiler_statistic_info{"SMEM Clause", "Number of SMEM clauses (includes 1-sized clauses)"};
|
||||
ret[aco::statistic_vmem_score] = aco_compiler_statistic_info{"VMEM Score", "Average VMEM def-use distances"};
|
||||
ret[aco::statistic_smem_score] = aco_compiler_statistic_info{"SMEM Score", "Average SMEM def-use distances"};
|
||||
ret[aco::statistic_sgpr_presched] = aco_compiler_statistic_info{"Pre-Sched SGPRs", "SGPR usage before scheduling"};
|
||||
ret[aco::statistic_vgpr_presched] = aco_compiler_statistic_info{"Pre-Sched VGPRs", "VGPR usage before scheduling"};
|
||||
return ret;
|
||||
}();
|
||||
|
||||
static void validate(aco::Program *program)
|
||||
{
|
||||
@@ -216,7 +220,7 @@ void aco_compile_shader(unsigned shader_count,
|
||||
if (program->collect_statistics) {
|
||||
aco_compiler_statistics *statistics = (aco_compiler_statistics *)legacy_binary->data;
|
||||
statistics->count = aco::num_statistics;
|
||||
statistics->infos = statistic_infos;
|
||||
statistics->infos = statistic_infos.data();
|
||||
memcpy(statistics->values, program->statistics, aco::num_statistics * sizeof(uint32_t));
|
||||
}
|
||||
legacy_binary->stats_size = stats_size;
|
||||
|
||||
@@ -4,58 +4,63 @@
|
||||
#include "sid.h"
|
||||
#include "ac_shader_util.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace aco {
|
||||
|
||||
static const char *reduce_ops[] = {
|
||||
[iadd8] = "iadd8",
|
||||
[iadd16] = "iadd16",
|
||||
[iadd32] = "iadd32",
|
||||
[iadd64] = "iadd64",
|
||||
[imul8] = "imul8",
|
||||
[imul16] = "imul16",
|
||||
[imul32] = "imul32",
|
||||
[imul64] = "imul64",
|
||||
[fadd16] = "fadd16",
|
||||
[fadd32] = "fadd32",
|
||||
[fadd64] = "fadd64",
|
||||
[fmul16] = "fmul16",
|
||||
[fmul32] = "fmul32",
|
||||
[fmul64] = "fmul64",
|
||||
[imin8] = "imin8",
|
||||
[imin16] = "imin16",
|
||||
[imin32] = "imin32",
|
||||
[imin64] = "imin64",
|
||||
[imax8] = "imax8",
|
||||
[imax16] = "imax16",
|
||||
[imax32] = "imax32",
|
||||
[imax64] = "imax64",
|
||||
[umin8] = "umin8",
|
||||
[umin16] = "umin16",
|
||||
[umin32] = "umin32",
|
||||
[umin64] = "umin64",
|
||||
[umax8] = "umax8",
|
||||
[umax16] = "umax16",
|
||||
[umax32] = "umax32",
|
||||
[umax64] = "umax64",
|
||||
[fmin16] = "fmin16",
|
||||
[fmin32] = "fmin32",
|
||||
[fmin64] = "fmin64",
|
||||
[fmax16] = "fmax16",
|
||||
[fmax32] = "fmax32",
|
||||
[fmax64] = "fmax64",
|
||||
[iand8] = "iand8",
|
||||
[iand16] = "iand16",
|
||||
[iand32] = "iand32",
|
||||
[iand64] = "iand64",
|
||||
[ior8] = "ior8",
|
||||
[ior16] = "ior16",
|
||||
[ior32] = "ior32",
|
||||
[ior64] = "ior64",
|
||||
[ixor8] = "ixor8",
|
||||
[ixor16] = "ixor16",
|
||||
[ixor32] = "ixor32",
|
||||
[ixor64] = "ixor64",
|
||||
};
|
||||
const std::array<const char*, num_reduce_ops> reduce_ops = []()
|
||||
{
|
||||
std::array<const char*, num_reduce_ops> ret{};
|
||||
ret[iadd8] = "iadd8";
|
||||
ret[iadd16] = "iadd16";
|
||||
ret[iadd32] = "iadd32";
|
||||
ret[iadd64] = "iadd64";
|
||||
ret[imul8] = "imul8";
|
||||
ret[imul16] = "imul16";
|
||||
ret[imul32] = "imul32";
|
||||
ret[imul64] = "imul64";
|
||||
ret[fadd16] = "fadd16";
|
||||
ret[fadd32] = "fadd32";
|
||||
ret[fadd64] = "fadd64";
|
||||
ret[fmul16] = "fmul16";
|
||||
ret[fmul32] = "fmul32";
|
||||
ret[fmul64] = "fmul64";
|
||||
ret[imin8] = "imin8";
|
||||
ret[imin16] = "imin16";
|
||||
ret[imin32] = "imin32";
|
||||
ret[imin64] = "imin64";
|
||||
ret[imax8] = "imax8";
|
||||
ret[imax16] = "imax16";
|
||||
ret[imax32] = "imax32";
|
||||
ret[imax64] = "imax64";
|
||||
ret[umin8] = "umin8";
|
||||
ret[umin16] = "umin16";
|
||||
ret[umin32] = "umin32";
|
||||
ret[umin64] = "umin64";
|
||||
ret[umax8] = "umax8";
|
||||
ret[umax16] = "umax16";
|
||||
ret[umax32] = "umax32";
|
||||
ret[umax64] = "umax64";
|
||||
ret[fmin16] = "fmin16";
|
||||
ret[fmin32] = "fmin32";
|
||||
ret[fmin64] = "fmin64";
|
||||
ret[fmax16] = "fmax16";
|
||||
ret[fmax32] = "fmax32";
|
||||
ret[fmax64] = "fmax64";
|
||||
ret[iand8] = "iand8";
|
||||
ret[iand16] = "iand16";
|
||||
ret[iand32] = "iand32";
|
||||
ret[iand64] = "iand64";
|
||||
ret[ior8] = "ior8";
|
||||
ret[ior16] = "ior16";
|
||||
ret[ior32] = "ior32";
|
||||
ret[ior64] = "ior64";
|
||||
ret[ixor8] = "ixor8";
|
||||
ret[ixor16] = "ixor16";
|
||||
ret[ixor32] = "ixor32";
|
||||
ret[ixor64] = "ixor64";
|
||||
return ret;
|
||||
}();
|
||||
|
||||
static void print_reg_class(const RegClass rc, FILE *output)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user