mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-11-15 10:50:37 +02:00
m1/perf/: cleaned up sched.c a little; added TODO
This commit is contained in:
parent
64e2a3c6b7
commit
c009a13f5c
8
m1/perf/TODO
Normal file
8
m1/perf/TODO
Normal 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
|
@ -31,7 +31,11 @@
|
|||||||
#include <hw/pfpu.h>
|
#include <hw/pfpu.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
#define Dprintf printf
|
||||||
|
#else
|
||||||
#define Dprintf(...)
|
#define Dprintf(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define MAX_LATENCY 8 /* maximum latency; okay to make this bigger */
|
#define MAX_LATENCY 8 /* maximum latency; okay to make this bigger */
|
||||||
@ -199,7 +203,9 @@ static int alloc_reg(struct insn *setter)
|
|||||||
abort();
|
abort();
|
||||||
reg->vm_reg = vm_reg;
|
reg->vm_reg = vm_reg;
|
||||||
pfpu_reg = reg-pfpu_regs;
|
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);
|
vm_idx = reg2idx(vm_reg);
|
||||||
regs[vm_idx].setter = setter;
|
regs[vm_idx].setter = setter;
|
||||||
regs[vm_idx].pfpu_reg = pfpu_reg;
|
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);
|
list_add_tail(&ref->dep->dependants, &ref->more);
|
||||||
ref->dep->num_dependants++;
|
ref->dep->num_dependants++;
|
||||||
insn->unresolved++;
|
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 {
|
} else {
|
||||||
list_init(&ref->more);
|
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)
|
static void init_scheduler(struct fpvm_fragment *frag)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -319,12 +325,6 @@ static void init_scheduler(struct fpvm_fragment *frag)
|
|||||||
for (i = 0; i != PFPU_PROGSIZE; i++)
|
for (i = 0; i != PFPU_PROGSIZE; i++)
|
||||||
list_init(&ready[i]);
|
list_init(&ready[i]);
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (frag->ninstructions > 10) {
|
|
||||||
frag->ninstructions = 10;
|
|
||||||
catch = 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
for (i = 0; i != frag->ninstructions; i++) {
|
for (i = 0; i != frag->ninstructions; i++) {
|
||||||
insn = insns+i;
|
insn = insns+i;
|
||||||
memset(insn, 0, sizeof(struct insn));
|
memset(insn, 0, sizeof(struct insn));
|
||||||
@ -363,8 +363,9 @@ static void issue(struct insn *insn, int cycle, unsigned *code)
|
|||||||
int end;
|
int end;
|
||||||
end = cycle+insn->latency;
|
end = cycle+insn->latency;
|
||||||
|
|
||||||
Dprintf("cycle %d: insn %lu L %d (A %d B %d)\n",
|
Dprintf("cycle %d: insn %lu L %d (A %d B %d)\n", cycle,
|
||||||
cycle, insn-insns, insn->latency, insn->vm_insn->opa, insn->vm_insn->opb);
|
insn-insns, insn->latency, insn->vm_insn->opa, insn->vm_insn->opb);
|
||||||
|
|
||||||
switch (insn->arity) {
|
switch (insn->arity) {
|
||||||
case 3:
|
case 3:
|
||||||
/* fall through */
|
/* fall through */
|
||||||
@ -389,7 +390,8 @@ Dprintf("cycle %d: insn %lu L %d (A %d B %d)\n",
|
|||||||
if (ref->insn->earliest <= end)
|
if (ref->insn->earliest <= end)
|
||||||
ref->insn->earliest = end+1;
|
ref->insn->earliest = end+1;
|
||||||
if (!--ref->insn->unresolved) {
|
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_del(&ref->insn->more);
|
||||||
list_add_tail(ready+ref->insn->earliest,
|
list_add_tail(ready+ref->insn->earliest,
|
||||||
&ref->insn->more);
|
&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)
|
static int count(const struct list *list)
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
@ -407,6 +410,7 @@ static int count(const struct list *list)
|
|||||||
n++;
|
n++;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int schedule(struct fpvm_fragment *frag, unsigned int *code)
|
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++) {
|
for (i = 0; remaining; i++) {
|
||||||
if (i == PFPU_PROGSIZE)
|
if (i == PFPU_PROGSIZE)
|
||||||
return -1;
|
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]);
|
list_concat(&waiting, &ready[i]);
|
||||||
Dprintf("%d\n", count(&waiting));
|
|
||||||
foreach (insn, &waiting) {
|
foreach (insn, &waiting) {
|
||||||
end = i+insn->latency;
|
end = i+insn->latency;
|
||||||
if (end >= PFPU_PROGSIZE)
|
if (end >= PFPU_PROGSIZE)
|
||||||
|
Loading…
Reference in New Issue
Block a user