mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-01 09:00:30 +01:00
ir3/tests: Use fd_dev_info to infer GPU generation
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23217>
This commit is contained in:
parent
cd3719be7d
commit
b0ea4883f0
1 changed files with 16 additions and 9 deletions
|
|
@ -47,11 +47,12 @@
|
|||
#define INSTR_4XX(i, d, ...) { .gpu_id = 420, .instr = #i, .expected = d, __VA_ARGS__ }
|
||||
#define INSTR_5XX(i, d, ...) { .gpu_id = 540, .instr = #i, .expected = d, __VA_ARGS__ }
|
||||
#define INSTR_6XX(i, d, ...) { .gpu_id = 630, .instr = #i, .expected = d, __VA_ARGS__ }
|
||||
#define INSTR_7XX(i, d, ...) { .gpu_id = 730, .instr = #i, .expected = d, __VA_ARGS__ }
|
||||
#define INSTR_7XX(i, d, ...) { .chip_id = 0x07030001, .instr = #i, .expected = d, __VA_ARGS__ }
|
||||
/* clang-format on */
|
||||
|
||||
static const struct test {
|
||||
int gpu_id;
|
||||
int chip_id;
|
||||
const char *instr;
|
||||
const char *expected;
|
||||
/**
|
||||
|
|
@ -486,6 +487,13 @@ main(int argc, char **argv)
|
|||
printf("Testing a%d %s: \"%s\"...\n", test->gpu_id, test->instr,
|
||||
test->expected);
|
||||
|
||||
struct fd_dev_id dev_id = {
|
||||
.gpu_id = test->gpu_id,
|
||||
.chip_id = test->chip_id,
|
||||
};
|
||||
|
||||
const struct fd_dev_info *dev_info = fd_dev_info(&dev_id);
|
||||
|
||||
rewind(fdisasm);
|
||||
memset(disasm_output, 0, output_size);
|
||||
|
||||
|
|
@ -499,7 +507,7 @@ main(int argc, char **argv)
|
|||
};
|
||||
isa_disasm(code, 8, fdisasm,
|
||||
&(struct isa_decode_options){
|
||||
.gpu_id = test->gpu_id,
|
||||
.gpu_id = dev_info->chip * 100,
|
||||
.show_errors = true,
|
||||
.no_match_cb = print_raw,
|
||||
});
|
||||
|
|
@ -519,19 +527,18 @@ main(int argc, char **argv)
|
|||
* Test assembly, which should result in the identical binary:
|
||||
*/
|
||||
|
||||
unsigned gen = test->gpu_id / 100;
|
||||
if (!compilers[gen]) {
|
||||
dev_ids[gen].gpu_id = test->gpu_id;
|
||||
dev_ids[gen].chip_id = 0;
|
||||
compilers[gen] = ir3_compiler_create(NULL, &dev_ids[gen],
|
||||
&(struct ir3_compiler_options){});
|
||||
if (!compilers[dev_info->chip]) {
|
||||
dev_ids[dev_info->chip].gpu_id = test->gpu_id;
|
||||
dev_ids[dev_info->chip].chip_id = test->chip_id;
|
||||
compilers[dev_info->chip] = ir3_compiler_create(
|
||||
NULL, &dev_ids[dev_info->chip], &(struct ir3_compiler_options){});
|
||||
}
|
||||
|
||||
FILE *fasm =
|
||||
fmemopen((void *)test->expected, strlen(test->expected), "r");
|
||||
|
||||
struct ir3_kernel_info info = {};
|
||||
struct ir3_shader *shader = ir3_parse_asm(compilers[gen], &info, fasm);
|
||||
struct ir3_shader *shader = ir3_parse_asm(compilers[dev_info->chip], &info, fasm);
|
||||
fclose(fasm);
|
||||
if (!shader) {
|
||||
printf("FAIL: %sexpected assembler fail\n",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue