#include #include #include #include namespace at { namespace detail { // See getCUDAHooks for some more commentary const HIPHooksInterface& getHIPHooks() { static std::unique_ptr hip_hooks; #if !defined C10_MOBILE static c10::once_flag once; c10::call_once(once, [] { hip_hooks = HIPHooksRegistry()->Create("HIPHooks", HIPHooksArgs{}); if (!hip_hooks) { hip_hooks = std::make_unique(); } }); #else if (hip_hooks == nullptr) { hip_hooks = std::make_unique(); } #endif return *hip_hooks; } } // namespace detail C10_DEFINE_REGISTRY(HIPHooksRegistry, HIPHooksInterface, HIPHooksArgs) } // namespace at