Some brain dumps from my side.

- Allocating a new frame for each function call can be not quite friendly for 
deep recursive calls.
  - Possible alternative: simply use the stack as registers, e.g. the register 
number points to an offset to the current stack pointer
- SSA vs register reuse
  - SSA is easy to generate but can need a lot of registers, which may not bad 
for deep recursion
  - Register alloca(with infinite registers) can provide reuse amount 
registers, would need 
- Register ISA is indeed more intuitive during the dump.
- Control flow: the implementation of Phi seems to need some thoughts
   - Need to be able to explicit reset the not required slot to nullptr, need 
to think about how that might interplay with register alloca.
  - Note:  if only relay primitive conditional is needed, do we need a generic 
Phi?

As mentioned above, one possible tradeoff is to simply use the stack as 
registers, so the register number indicates an offset to the begin ptr of the 
current function. This could unify quite a lot of things. 

## Cost of Register VM
The main argument against a register vm is the implementation complexity given 
that stack vm is a "fine and concise impl", the question really boils down to 
do we need these additional features and cost that comes with them, so far the 
costs are

- Cost of new frame alloca for new call
  - Can be resolved by using stack frame as register
- Cost of larger register slot size
   - Possibly need reg alloca, need to think about control flow handling
- Control flow handling





-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/dmlc/tvm/issues/2915#issuecomment-478276353

Reply via email to