ac: rename ac_surface_test_common -> ac_fake_hw_db

The next commit will reuse the radeon_info when AMD_FORCE_FAMILY
is used.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31841>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2024-10-18 14:24:59 +02:00
committed by Marge Bot
parent 2ff67083e5
commit 1c31cec31e
3 changed files with 47 additions and 35 deletions
@@ -12,6 +12,15 @@
#include "amdgfxregs.h"
#include "addrlib/src/amdgpu_asic_addr.h"
#ifdef _WIN32
#define AMDGPU_FAMILY_VI 130
#define AMDGPU_FAMILY_AI 141
#define AMDGPU_FAMILY_RV 142
#define AMDGPU_FAMILY_NV 143
#else
#include "amdgpu_drm.h"
#endif
typedef void (*gpu_init_func)(struct radeon_info *info);
static void init_vega10(struct radeon_info *info)
@@ -149,7 +158,7 @@ static void init_gfx12(struct radeon_info *info)
info->gb_addr_config = 0; /* Other fields are set by test cases. */
}
struct testcase {
struct ac_fake_hw {
const char *name;
gpu_init_func init;
int banks_or_pkrs;
@@ -158,7 +167,7 @@ struct testcase {
int rb_per_se;
};
static struct testcase testcases[] = {
static struct ac_fake_hw ac_fake_hw_db[] = {
{"vega10", init_vega10, 4, 2, 2, 2},
{"vega10_diff_bank", init_vega10, 3, 2, 2, 2},
{"vega10_diff_rb", init_vega10, 4, 2, 2, 0},
@@ -189,44 +198,42 @@ static struct testcase testcases[] = {
{"gfx12_16pipe", init_gfx12, 4, 4},
};
static struct radeon_info get_radeon_info(struct testcase *testcase)
static void get_radeon_info(struct radeon_info *info, struct ac_fake_hw *hw)
{
struct radeon_info info = {
.drm_major = 3,
.drm_minor = 30,
};
if (info->drm_major != 3) {
info->drm_major = 3;
info->drm_minor = 30;
}
testcase->init(&info);
hw->init(info);
switch(info.gfx_level) {
switch(info->gfx_level) {
case GFX9:
info.gb_addr_config = (info.gb_addr_config &
info->gb_addr_config = (info->gb_addr_config &
C_0098F8_NUM_PIPES &
C_0098F8_NUM_BANKS &
C_0098F8_NUM_SHADER_ENGINES_GFX9 &
C_0098F8_NUM_RB_PER_SE) |
S_0098F8_NUM_PIPES(testcase->pipes) |
S_0098F8_NUM_BANKS(testcase->banks_or_pkrs) |
S_0098F8_NUM_SHADER_ENGINES_GFX9(testcase->se) |
S_0098F8_NUM_RB_PER_SE(testcase->rb_per_se);
S_0098F8_NUM_PIPES(hw->pipes) |
S_0098F8_NUM_BANKS(hw->banks_or_pkrs) |
S_0098F8_NUM_SHADER_ENGINES_GFX9(hw->se) |
S_0098F8_NUM_RB_PER_SE(hw->rb_per_se);
break;
case GFX10:
case GFX10_3:
case GFX11:
case GFX12:
info.gb_addr_config = (info.gb_addr_config &
info->gb_addr_config = (info->gb_addr_config &
C_0098F8_NUM_PIPES &
C_0098F8_NUM_PKRS) |
S_0098F8_NUM_PIPES(testcase->pipes) |
S_0098F8_NUM_PKRS(testcase->banks_or_pkrs);
S_0098F8_NUM_PIPES(hw->pipes) |
S_0098F8_NUM_PKRS(hw->banks_or_pkrs);
/* 1 packer implies 1 RB except gfx10 where the field is ignored. */
info.max_render_backends = info.gfx_level == GFX10 || testcase->banks_or_pkrs ? 2 : 1;
info->max_render_backends = info->gfx_level == GFX10 || hw->banks_or_pkrs ? 2 : 1;
break;
default:
unreachable("Unhandled generation");
break;
}
return info;
}
#endif
+13 -10
View File
@@ -25,7 +25,7 @@
#include "util/mesa-sha1.h"
#include "addrlib/inc/addrinterface.h"
#include "ac_surface_test_common.h"
#include "ac_fake_hw_db.h"
/*
* The main goal of this test is to validate that our dcc/htile addressing
@@ -708,34 +708,37 @@ int main(int argc, char **argv)
puts("Specify --full to run the full test.");
puts("DCC:");
for (unsigned i = 0; i < ARRAY_SIZE(testcases); ++i) {
struct radeon_info info = get_radeon_info(&testcases[i]);
for (unsigned i = 0; i < ARRAY_SIZE(ac_fake_hw_db); ++i) {
struct radeon_info info = { .drm_major = 0 };
get_radeon_info(&info, &ac_fake_hw_db[i]);
if (info.gfx_level >= GFX12)
continue;
run_dcc_address_test(testcases[i].name, &info, full);
run_dcc_address_test(ac_fake_hw_db[i].name, &info, full);
}
puts("HTILE:");
for (unsigned i = 0; i < ARRAY_SIZE(testcases); ++i) {
struct radeon_info info = get_radeon_info(&testcases[i]);
for (unsigned i = 0; i < ARRAY_SIZE(ac_fake_hw_db); ++i) {
struct radeon_info info = { .drm_major = 0 };
get_radeon_info(&info, &ac_fake_hw_db[i]);
/* Only GFX10+ is currently supported. GFX12 doesn't have HTILE. */
if (info.gfx_level < GFX10 || info.gfx_level >= GFX12)
continue;
run_htile_address_test(testcases[i].name, &info, full);
run_htile_address_test(ac_fake_hw_db[i].name, &info, full);
}
puts("CMASK:");
for (unsigned i = 0; i < ARRAY_SIZE(testcases); ++i) {
struct radeon_info info = get_radeon_info(&testcases[i]);
for (unsigned i = 0; i < ARRAY_SIZE(ac_fake_hw_db); ++i) {
struct radeon_info info = { .drm_major = 0 };
get_radeon_info(&info, &ac_fake_hw_db[i]);
if (info.gfx_level >= GFX11)
continue;
run_cmask_address_test(testcases[i].name, &info, full);
run_cmask_address_test(ac_fake_hw_db[i].name, &info, full);
}
return 0;
+6 -4
View File
@@ -17,7 +17,7 @@
#include "util/mesa-sha1.h"
#include "addrlib/inc/addrinterface.h"
#include "ac_surface_test_common.h"
#include "ac_fake_hw_db.h"
/*
* The main goal of this test is making sure that we do
@@ -463,10 +463,12 @@ int main()
struct u_vector test_entries;
u_vector_init_pow2(&test_entries, 64, sizeof(struct test_entry));
for (unsigned i = 0; i < ARRAY_SIZE(testcases); ++i) {
struct radeon_info info = get_radeon_info(&testcases[i]);
for (unsigned i = 0; i < ARRAY_SIZE(ac_fake_hw_db); ++i) {
struct radeon_info info = { .drm_major = 0 };
run_modifier_test(&test_entries, testcases[i].name, &info);
get_radeon_info(&info, &ac_fake_hw_db[i]);
run_modifier_test(&test_entries, ac_fake_hw_db[i].name, &info);
}
qsort(u_vector_tail(&test_entries),