mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-01 16:10:09 +01:00
freedreno/decode: checkreg handling for bitsize/stride
The initial version was not accounting for reg64 vs reg32, or array stride. Signed-off-by: Rob Clark <rob.clark@oss.qualcomm.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37502>
This commit is contained in:
parent
159d0596c4
commit
3a4b3322d4
1 changed files with 26 additions and 12 deletions
|
|
@ -15,6 +15,28 @@
|
|||
* for any given generation.
|
||||
*/
|
||||
|
||||
struct range {
|
||||
uint32_t min, max;
|
||||
};
|
||||
|
||||
static struct range
|
||||
elem_range(const struct rnndelem *e)
|
||||
{
|
||||
uint32_t len;
|
||||
|
||||
if (e->type == RNN_ETYPE_ARRAY) {
|
||||
len = e->length * e->stride;
|
||||
} else {
|
||||
assert(e->width >= 32);
|
||||
len = e->width / 32;
|
||||
}
|
||||
|
||||
return (struct range){
|
||||
.min = e->offset,
|
||||
.max = e->offset + len - 1,
|
||||
};
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
|
|
@ -36,11 +58,7 @@ main(int argc, char **argv)
|
|||
if (!rnndec_varmatch(rnn->vc, &ei->varinfo))
|
||||
continue;
|
||||
|
||||
uint32_t mini = ei->offset;
|
||||
uint32_t maxi = mini;
|
||||
|
||||
if (ei->type == RNN_ETYPE_ARRAY)
|
||||
maxi = mini + ei->length - 1;
|
||||
struct range ri = elem_range(ei);
|
||||
|
||||
for (unsigned j = i + 1; j < rnn->dom[0]->subelemsnum; j++) {
|
||||
struct rnndelem *ej = rnn->dom[0]->subelems[j];
|
||||
|
|
@ -48,15 +66,11 @@ main(int argc, char **argv)
|
|||
if (!rnndec_varmatch(rnn->vc, &ej->varinfo))
|
||||
continue;
|
||||
|
||||
uint32_t minj = ej->offset;
|
||||
uint32_t maxj = minj;
|
||||
struct range rj = elem_range(ej);
|
||||
|
||||
if (ej->type == RNN_ETYPE_ARRAY)
|
||||
maxj = minj + ej->length - 1;
|
||||
|
||||
if ((maxi >= minj) && (maxj >= mini)) {
|
||||
if ((ri.max >= rj.min) && (rj.max >= ri.min)) {
|
||||
fprintf(stderr, "Conflict: %s (0x%04x->0x%04x) vs %s (0x%04x->0x%04x)\n",
|
||||
ei->name, mini, maxi, ej->name, minj, maxj);
|
||||
ei->name, ri.min, ri.max, ej->name, rj.min, rj.max);
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue