Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In codegen, avoid evaluation that's not used #23

Open
mossprescott opened this issue Feb 1, 2020 · 0 comments
Open

In codegen, avoid evaluation that's not used #23

mossprescott opened this issue Feb 1, 2020 · 0 comments

Comments

@mossprescott
Copy link
Owner

There are three obvious sub-graphs whose results are not used a lot of the time:

  • The entire ALU result is unused on every @ instruction, which is 9.5k out of 27.5k (35%).
  • Only one of the + and & ALU ops is ever used.
  • The JMP condition is unused unless not an @ and one of the three bits is set.

I tried converting each of these into if instr & 0x8000: by hand, and got ~25% speedup overall.

To automate that would involve analyzing the node graph to determine what parts of the graph need to be evaluated when. Something like: "what subgraphs are referenced only on one side of a conditional (i.e. Mux16), and what is the condition?" but it's tricky because the ALU output is referenced many times, with various conditions, all of which include the same bit of the instruction in some way.

Turns out CS is hard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant