RSX: Fix issue where linux builds could hit illegal instruction on machines without AVX-512
Some checks are pending
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run

- Place avx-512 function attributes in their own functions
This commit is contained in:
Malcolm Jestadt 2025-03-02 17:54:45 -05:00 committed by kd-11
parent 783079266e
commit 1920aee415

View file

@ -35,10 +35,8 @@
using namespace program_hash_util;
AVX512_ICL_FUNC usz vertex_program_utils::get_vertex_program_ucode_hash(const RSXVertexProgram &program)
{
#ifdef ARCH_X64
if (utils::has_avx512_icl())
AVX512_ICL_FUNC usz get_vertex_program_ucode_hash_512(const RSXVertexProgram &program)
{
// Load all elements of the instruction_mask bitset
const __m512i* instMask512 = reinterpret_cast<const __m512i*>(&program.instruction_mask);
@ -114,6 +112,8 @@ AVX512_ICL_FUNC usz vertex_program_utils::get_vertex_program_ucode_hash(const RS
}
#endif
usz vertex_program_utils::get_vertex_program_ucode_hash(const RSXVertexProgram &program)
{
// Checksum as hash with rotated data
const void* instbuffer = program.data.data();
u32 instIndex = 0;
@ -427,7 +427,20 @@ vertex_program_utils::vertex_program_metadata vertex_program_utils::analyse_vert
usz vertex_program_storage_hash::operator()(const RSXVertexProgram &program) const
{
#ifdef ARCH_X64
usz ucode_hash;
if (utils::has_avx512_icl())
{
ucode_hash = get_vertex_program_ucode_hash_512(program);
}
else
{
ucode_hash = vertex_program_utils::get_vertex_program_ucode_hash(program);
}
#else
const usz ucode_hash = vertex_program_utils::get_vertex_program_ucode_hash(program);
#endif
const u32 state_params[] =
{
program.ctrl,
@ -439,21 +452,8 @@ usz vertex_program_storage_hash::operator()(const RSXVertexProgram &program) con
return rpcs3::hash64(ucode_hash, metadata_hash);
}
AVX512_ICL_FUNC bool vertex_program_compare::operator()(const RSXVertexProgram &binary1, const RSXVertexProgram &binary2) const
{
if (binary1.output_mask != binary2.output_mask)
return false;
if (binary1.ctrl != binary2.ctrl)
return false;
if (binary1.texture_state != binary2.texture_state)
return false;
if (binary1.data.size() != binary2.data.size())
return false;
if (binary1.jump_table != binary2.jump_table)
return false;
#ifdef ARCH_X64
if (utils::has_avx512_icl())
AVX512_ICL_FUNC bool vertex_program_compare_512(const RSXVertexProgram &binary1, const RSXVertexProgram &binary2)
{
// Load all elements of the instruction_mask bitset
const __m512i* instMask512 = reinterpret_cast<const __m512i*>(&binary1.instruction_mask);
@ -530,6 +530,26 @@ AVX512_ICL_FUNC bool vertex_program_compare::operator()(const RSXVertexProgram &
}
#endif
bool vertex_program_compare::operator()(const RSXVertexProgram &binary1, const RSXVertexProgram &binary2) const
{
if (binary1.output_mask != binary2.output_mask)
return false;
if (binary1.ctrl != binary2.ctrl)
return false;
if (binary1.texture_state != binary2.texture_state)
return false;
if (binary1.data.size() != binary2.data.size())
return false;
if (binary1.jump_table != binary2.jump_table)
return false;
#ifdef ARCH_X64
if (utils::has_avx512_icl())
{
return vertex_program_compare_512(binary1, binary2);
}
#endif
const void* instBuffer1 = binary1.data.data();
const void* instBuffer2 = binary2.data.data();
usz instIndex = 0;