hip: apply two dynamic fb memory fixes from cuda into hip
The two fixes for the cuda module are !1124 (merged) and !914 (merged)
I understand I should not work on the hip module, but these two fixes are easy to apply, so I would prefer to fix the hip module now before I forgot the detail of the bugs. I have tested it on the sapling with HIP_TARGET=CUDA, and it works for me.
Edited by Wei Wu