intel/compiler: Print more details when fs_visitor::validate() fails
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18150>
This commit is contained in:
@@ -30,12 +30,32 @@
|
|||||||
#include "brw_fs.h"
|
#include "brw_fs.h"
|
||||||
#include "brw_cfg.h"
|
#include "brw_cfg.h"
|
||||||
|
|
||||||
#define fsv_assert(cond) \
|
#define fsv_assert_eq(first, second) \
|
||||||
if (!(cond)) { \
|
{ \
|
||||||
fprintf(stderr, "ASSERT: Scalar %s validation failed!\n", stage_abbrev); \
|
unsigned f = (first); \
|
||||||
dump_instruction(inst, stderr); \
|
unsigned s = (second); \
|
||||||
fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, #cond); \
|
if (f != s) { \
|
||||||
abort(); \
|
fprintf(stderr, "ASSERT: Scalar %s validation failed!\n", stage_abbrev); \
|
||||||
|
dump_instruction(inst, stderr); \
|
||||||
|
fprintf(stderr, "%s:%d: A == B failed\n", __FILE__, __LINE__); \
|
||||||
|
fprintf(stderr, " A = %s = %u\n", #first, f); \
|
||||||
|
fprintf(stderr, " B = %s = %u\n", #second, s); \
|
||||||
|
abort(); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define fsv_assert_lte(first, second) \
|
||||||
|
{ \
|
||||||
|
unsigned f = (first); \
|
||||||
|
unsigned s = (second); \
|
||||||
|
if (f > s) { \
|
||||||
|
fprintf(stderr, "ASSERT: Scalar %s validation failed!\n", stage_abbrev); \
|
||||||
|
dump_instruction(inst, stderr); \
|
||||||
|
fprintf(stderr, "%s:%d: A <= B failed\n", __FILE__, __LINE__); \
|
||||||
|
fprintf(stderr, " A = %s = %u\n", #first, f); \
|
||||||
|
fprintf(stderr, " B = %s = %u\n", #second, s); \
|
||||||
|
abort(); \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -50,22 +70,22 @@ fs_visitor::validate()
|
|||||||
|
|
||||||
unsigned data_size = 0;
|
unsigned data_size = 0;
|
||||||
for (unsigned i = header_size, j = 0; i < inst->mlen; i++, j++) {
|
for (unsigned i = header_size, j = 0; i < inst->mlen; i++, j++) {
|
||||||
fsv_assert(type_sz(offset(inst->src[URB_LOGICAL_SRC_DATA], bld, j).type) == 4);
|
fsv_assert_eq(type_sz(offset(inst->src[URB_LOGICAL_SRC_DATA], bld, j).type), 4);
|
||||||
data_size++;
|
data_size++;
|
||||||
}
|
}
|
||||||
|
|
||||||
fsv_assert(header_size + data_size == inst->mlen);
|
fsv_assert_eq(header_size + data_size, inst->mlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inst->dst.file == VGRF) {
|
if (inst->dst.file == VGRF) {
|
||||||
fsv_assert(inst->dst.offset / REG_SIZE + regs_written(inst) <=
|
fsv_assert_lte(inst->dst.offset / REG_SIZE + regs_written(inst),
|
||||||
alloc.sizes[inst->dst.nr]);
|
alloc.sizes[inst->dst.nr]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < inst->sources; i++) {
|
for (unsigned i = 0; i < inst->sources; i++) {
|
||||||
if (inst->src[i].file == VGRF) {
|
if (inst->src[i].file == VGRF) {
|
||||||
fsv_assert(inst->src[i].offset / REG_SIZE + regs_read(inst, i) <=
|
fsv_assert_lte(inst->src[i].offset / REG_SIZE + regs_read(inst, i),
|
||||||
alloc.sizes[inst->src[i].nr]);
|
alloc.sizes[inst->src[i].nr]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user