pan/bit: Add helper for generating floating mod tests
We can iterate them, isn't that adorable! Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>
This commit is contained in:
parent
14c5343867
commit
7c887d368e
|
@ -143,5 +143,55 @@ bit_test_single(struct panfrost_device *dev,
|
|||
bi_pack(ctx, &prog.compiled);
|
||||
|
||||
return bit_vertex(dev, prog, input, 16, NULL, 0,
|
||||
s.r, 16, BIT_DEBUG_ALL);
|
||||
s.r, 16, debug);
|
||||
}
|
||||
|
||||
/* Utilities for generating tests */
|
||||
|
||||
static void
|
||||
bit_generate_vector(uint32_t *mem)
|
||||
{
|
||||
for (unsigned i = 0; i < 4; ++i)
|
||||
mem[i] = rand();
|
||||
}
|
||||
|
||||
/* Tests all 64 combinations of floating point modifiers for a given
|
||||
* instruction / floating-type / test type */
|
||||
|
||||
void
|
||||
bit_fmod_helper(struct panfrost_device *dev,
|
||||
enum bi_class c, unsigned size, bool fma,
|
||||
uint32_t *input, enum bit_debug debug)
|
||||
{
|
||||
nir_alu_type T = nir_type_float | size;
|
||||
|
||||
bi_instruction ins = {
|
||||
.type = c,
|
||||
.src = {
|
||||
BIR_INDEX_REGISTER | 0,
|
||||
BIR_INDEX_REGISTER | 1,
|
||||
},
|
||||
.src_types = { T, T },
|
||||
.dest = BIR_INDEX_REGISTER | 2,
|
||||
.dest_type = T,
|
||||
};
|
||||
|
||||
for (unsigned outmod = 0; outmod < 4; ++outmod) {
|
||||
for (unsigned inmod = 0; inmod < 16; ++inmod) {
|
||||
ins.outmod = outmod;
|
||||
ins.src_abs[0] = (inmod & 0x1);
|
||||
ins.src_abs[1] = (inmod & 0x2);
|
||||
ins.src_neg[0] = (inmod & 0x4);
|
||||
ins.src_neg[1] = (inmod & 0x8);
|
||||
|
||||
if (!bit_test_single(dev, &ins, input, fma, debug)) {
|
||||
fprintf(stderr, "FAIL: fmod.%s%u.%s%s.%u\n",
|
||||
bi_class_name(c),
|
||||
size,
|
||||
fma ? "fma" : "add",
|
||||
outmod ? bi_output_mod_name(outmod) : ".none",
|
||||
inmod);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ bool
|
|||
bit_vertex(struct panfrost_device *dev, panfrost_program prog,
|
||||
uint32_t *iubo, size_t sz_ubo,
|
||||
uint32_t *iattr, size_t sz_attr,
|
||||
uint32_t *expected, size_t sz_expected, enum bit_debug);
|
||||
uint32_t *expected, size_t sz_expected, enum bit_debug debug);
|
||||
|
||||
/* BIT interpreter */
|
||||
|
||||
|
@ -69,11 +69,10 @@ bit_step(struct bit_state *s, bi_instruction *ins, bool FMA);
|
|||
|
||||
/* Packing tests */
|
||||
|
||||
bool
|
||||
bit_test_single(struct panfrost_device *dev,
|
||||
bi_instruction *ins,
|
||||
uint32_t input[4],
|
||||
bool fma);
|
||||
void
|
||||
bit_fmod_helper(struct panfrost_device *dev,
|
||||
enum bi_class c, unsigned size, bool fma,
|
||||
uint32_t *input, enum bit_debug debug);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue