1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-15 10:36:17 +02:00

m1/perf/: cleaned up sched.c a little; added TODO

This commit is contained in:
Werner Almesberger 2011-09-18 01:28:02 -03:00
parent 64e2a3c6b7
commit c009a13f5c
2 changed files with 29 additions and 16 deletions

8
m1/perf/TODO Normal file
View File

@ -0,0 +1,8 @@
- see if preferring critical path can improve code efficiency
- test IF
- run result comparison against full set of patches
- check if result comparison actually compares meaningful data
- compare run time and code size for all patches
- see what optimization changes (may interfere with profiling)
- build into Flickernoise (some things may need adapting, e.g., abort())
- review code, see if things can be simplified

View File

@ -31,7 +31,11 @@
#include <hw/pfpu.h>
#ifdef DEBUG
#define Dprintf printf
#else
#define Dprintf(...)
#endif
#define MAX_LATENCY 8 /* maximum latency; okay to make this bigger */
@ -199,7 +203,9 @@ static int alloc_reg(struct insn *setter)
abort();
reg->vm_reg = vm_reg;
pfpu_reg = reg-pfpu_regs;
Dprintf(" alloc reg %d -> %d\n", vm_reg, pfpu_reg);
Dprintf(" alloc reg %d -> %d\n", vm_reg, pfpu_reg);
vm_idx = reg2idx(vm_reg);
regs[vm_idx].setter = setter;
regs[vm_idx].pfpu_reg = pfpu_reg;
@ -299,8 +305,9 @@ static struct vm_reg *add_data_ref(struct insn *insn, struct data_ref *ref,
list_add_tail(&ref->dep->dependants, &ref->more);
ref->dep->num_dependants++;
insn->unresolved++;
Dprintf("insn %lu: reg %d setter %lu unresolved %d\n",
insn-insns, reg_num, reg->setter-insns, insn->unresolved);
Dprintf("insn %lu: reg %d setter %lu unresolved %d\n",
insn-insns, reg_num, reg->setter-insns, insn->unresolved);
} else {
list_init(&ref->more);
}
@ -308,7 +315,6 @@ Dprintf("insn %lu: reg %d setter %lu unresolved %d\n",
}
int catch = 0;
static void init_scheduler(struct fpvm_fragment *frag)
{
int i;
@ -319,12 +325,6 @@ static void init_scheduler(struct fpvm_fragment *frag)
for (i = 0; i != PFPU_PROGSIZE; i++)
list_init(&ready[i]);
#if 0
if (frag->ninstructions > 10) {
frag->ninstructions = 10;
catch = 1;
}
#endif
for (i = 0; i != frag->ninstructions; i++) {
insn = insns+i;
memset(insn, 0, sizeof(struct insn));
@ -363,8 +363,9 @@ static void issue(struct insn *insn, int cycle, unsigned *code)
int end;
end = cycle+insn->latency;
Dprintf("cycle %d: insn %lu L %d (A %d B %d)\n",
cycle, insn-insns, insn->latency, insn->vm_insn->opa, insn->vm_insn->opb);
Dprintf("cycle %d: insn %lu L %d (A %d B %d)\n", cycle,
insn-insns, insn->latency, insn->vm_insn->opa, insn->vm_insn->opb);
switch (insn->arity) {
case 3:
/* fall through */
@ -389,7 +390,8 @@ Dprintf("cycle %d: insn %lu L %d (A %d B %d)\n",
if (ref->insn->earliest <= end)
ref->insn->earliest = end+1;
if (!--ref->insn->unresolved) {
Dprintf(" unlocked %lu -> %u\n", ref->insn-insns, ref->insn->earliest);
Dprintf(" unlocked %lu -> %u\n", ref->insn-insns,
ref->insn->earliest);
list_del(&ref->insn->more);
list_add_tail(ready+ref->insn->earliest,
&ref->insn->more);
@ -398,6 +400,7 @@ Dprintf(" unlocked %lu -> %u\n", ref->insn-insns, ref->insn->earliest);
}
#ifdef DEBUG
static int count(const struct list *list)
{
int n = 0;
@ -407,6 +410,7 @@ static int count(const struct list *list)
n++;
return n;
}
#endif
static int schedule(struct fpvm_fragment *frag, unsigned int *code)
@ -419,10 +423,11 @@ static int schedule(struct fpvm_fragment *frag, unsigned int *code)
for (i = 0; remaining; i++) {
if (i == PFPU_PROGSIZE)
return -1;
Dprintf("@%d --- remaining %d, waiting %d + ready %d = ", i, remaining,
count(&waiting), count(&ready[i]));
Dprintf("@%d --- remaining %d, waiting %d + ready %d\n",
i, remaining, count(&waiting), count(&ready[i]));
list_concat(&waiting, &ready[i]);
Dprintf("%d\n", count(&waiting));
foreach (insn, &waiting) {
end = i+insn->latency;
if (end >= PFPU_PROGSIZE)