That’s a great idea, thanks. Why though would it involve shared memory? Maybe I’m missing something but it seems like global constant memory and local registers should suffice.
Registers can’t be addressed dynamically, which is what you need. Constant memory cannot be written to.
Shared memory is the only place for your virtual register file. Make sure to avoid bank conflicts, however.