|
|
#pragma once
|
|
|
|
|
|
#include <c10/util/Exception.h>
|
|
|
#include <c10/util/Registry.h>
|
|
|
|
|
|
#include <ATen/detail/AcceleratorHooksInterface.h>
|
|
|
|
|
|
|
|
|
namespace at {
|
|
|
|
|
|
struct TORCH_API MAIAHooksInterface : AcceleratorHooksInterface {
|
|
|
|
|
|
|
|
|
~MAIAHooksInterface() override = default;
|
|
|
|
|
|
void init() const override {
|
|
|
TORCH_CHECK(false, "Cannot initialize MAIA without ATen_maia library.");
|
|
|
}
|
|
|
|
|
|
bool hasPrimaryContext(DeviceIndex ) const override {
|
|
|
TORCH_CHECK(false, "Cannot initialize MAIA without ATen_maia library.");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
virtual std::string showConfig() const {
|
|
|
TORCH_CHECK(false, "Cannot query detailed MAIA version information.");
|
|
|
}
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct TORCH_API MAIAHooksArgs {};
|
|
|
|
|
|
TORCH_DECLARE_REGISTRY(MAIAHooksRegistry, MAIAHooksInterface, MAIAHooksArgs);
|
|
|
#define REGISTER_MAIA_HOOKS(clsname) \
|
|
|
C10_REGISTER_CLASS(MAIAHooksRegistry, clsname, clsname)
|
|
|
|
|
|
namespace detail {
|
|
|
TORCH_API const MAIAHooksInterface& getMAIAHooks();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|