mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-12-19 16:33:09 +02:00
m1/perf/: added instrumentation for monitoring register allocation
This commit is contained in:
parent
a66c9577b2
commit
abd7de7265
@ -31,6 +31,8 @@
|
|||||||
#include <hw/pfpu.h>
|
#include <hw/pfpu.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define REG_STATS
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define Dprintf printf
|
#define Dprintf printf
|
||||||
#else
|
#else
|
||||||
@ -88,6 +90,9 @@ static struct sched_ctx {
|
|||||||
struct list unscheduled; /* unscheduled insns */
|
struct list unscheduled; /* unscheduled insns */
|
||||||
struct list waiting; /* insns waiting to be scheduled */
|
struct list waiting; /* insns waiting to be scheduled */
|
||||||
struct list ready[PFPU_PROGSIZE]; /* insns ready at nth cycle */
|
struct list ready[PFPU_PROGSIZE]; /* insns ready at nth cycle */
|
||||||
|
#ifdef REG_STATS
|
||||||
|
int max_regs, curr_regs; /* allocation statistics */
|
||||||
|
#endif
|
||||||
} *sc;
|
} *sc;
|
||||||
|
|
||||||
|
|
||||||
@ -211,6 +216,13 @@ static int alloc_reg(struct insn *setter)
|
|||||||
reg = list_pop(&sc->unallocated);
|
reg = list_pop(&sc->unallocated);
|
||||||
if (!reg)
|
if (!reg)
|
||||||
abort();
|
abort();
|
||||||
|
|
||||||
|
#ifdef REG_STATS
|
||||||
|
sc->curr_regs++;
|
||||||
|
if (sc->curr_regs > sc->max_regs)
|
||||||
|
sc->max_regs = sc->curr_regs;
|
||||||
|
#endif
|
||||||
|
|
||||||
reg->vm_reg = vm_reg;
|
reg->vm_reg = vm_reg;
|
||||||
pfpu_reg = reg-sc->pfpu_regs;
|
pfpu_reg = reg-sc->pfpu_regs;
|
||||||
|
|
||||||
@ -238,6 +250,10 @@ static void put_reg(int vm_reg)
|
|||||||
|
|
||||||
Dprintf(" free reg %d\n", regs[vm_idx].pfpu_reg);
|
Dprintf(" free reg %d\n", regs[vm_idx].pfpu_reg);
|
||||||
|
|
||||||
|
#ifdef REG_STATS
|
||||||
|
sc->curr_regs--;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prepend so that register numbers stay small and bugs reveal
|
* Prepend so that register numbers stay small and bugs reveal
|
||||||
* themselves more rapidly.
|
* themselves more rapidly.
|
||||||
@ -488,7 +504,13 @@ int gfpus_schedule(struct fpvm_fragment *frag, unsigned int *code,
|
|||||||
init_scheduler_context(frag, reg);
|
init_scheduler_context(frag, reg);
|
||||||
memset(code, 0, PFPU_PROGSIZE*sizeof(*code));
|
memset(code, 0, PFPU_PROGSIZE*sizeof(*code));
|
||||||
res = schedule(code);
|
res = schedule(code);
|
||||||
|
|
||||||
|
#ifdef REG_STATS
|
||||||
|
printf("regs: %d/%d\n", sc->curr_regs, sc->max_regs);
|
||||||
|
#endif
|
||||||
|
|
||||||
free(sc->regs);
|
free(sc->regs);
|
||||||
|
free(sc);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
return res;
|
return res;
|
||||||
if (frag->vector_mode)
|
if (frag->vector_mode)
|
||||||
|
Loading…
Reference in New Issue
Block a user