98b9e92908
__hipRegisterFunction is called during by .init functions during program initialization. It calls hipModuleGetFunction to locate kernel symbol in code objects. hipModuleGetFunction assumes current device when locating kernel symbols. This works for HCC but not for hip-clang, since hip-clang needs to locate kernel symbols for different devices without switching between devices. This patch introduces a new hsa agent parameter to ihipModuleGetFunction, which allows __hipRegisterFunction to choose the correct hsa agent when locating kernel symbols. By default it uses this_agent(), therefore this patch has no impact on HCC.