Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/backends.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Current test expectations are:
| CPU | No | Yes | No | Yes | No | Yes | No |
| NVIDIA | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Iluvatar | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| MetaX | Yes | Yes | Yes | Yes | Yes | Yes | No |
| MetaX | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Moore | Yes | Yes | No | Yes | Yes | Yes | No |
| Hygon | Yes | Yes | Yes | Yes | Yes | Yes | No |
| Cambricon | Yes | No | No | No | No | No | No |
Expand Down
42 changes: 41 additions & 1 deletion src/native/cuda/metax/runtime_.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@ namespace infini::rt::runtime {

template <>
struct Runtime<Device::Type::kMetax>
: CudaRuntime<Runtime<Device::Type::kMetax>> {
: GraphRuntime<Runtime<Device::Type::kMetax>,
CudaRuntime<Runtime<Device::Type::kMetax>>> {
using Error = mcError_t;

using Stream = mcStream_t;

using Graph = mcGraph_t;

using GraphExec = mcGraphExec_t;

using Event = mcEvent_t;

using StreamCaptureMode = mcStreamCaptureMode;

static constexpr Device::Type kDeviceType = Device::Type::kMetax;

static constexpr Error kSuccess = mcSuccess;
Expand Down Expand Up @@ -124,6 +131,39 @@ struct Runtime<Device::Type::kMetax>
static constexpr auto EventElapsedTime = [](auto&&... args) {
return mcEventElapsedTime(std::forward<decltype(args)>(args)...);
};

static constexpr auto kStreamCaptureModeGlobal =
mcStreamCaptureModeGlobal;

static constexpr auto kStreamCaptureModeThreadLocal =
mcStreamCaptureModeThreadLocal;

static constexpr auto kStreamCaptureModeRelaxed =
mcStreamCaptureModeRelaxed;

static constexpr auto StreamBeginCapture = [](auto&&... args) {
return mcStreamBeginCapture(std::forward<decltype(args)>(args)...);
};

static constexpr auto StreamEndCapture = [](auto&&... args) {
return mcStreamEndCapture(std::forward<decltype(args)>(args)...);
};

static constexpr auto GraphDestroy = [](auto&&... args) {
return mcGraphDestroy(std::forward<decltype(args)>(args)...);
};

static Error GraphInstantiate(GraphExec* graph_exec, Graph graph) {
return mcGraphInstantiate(graph_exec, graph, nullptr, nullptr, 0);
}

static constexpr auto GraphExecDestroy = [](auto&&... args) {
return mcGraphExecDestroy(std::forward<decltype(args)>(args)...);
};

static constexpr auto GraphLaunch = [](auto&&... args) {
return mcGraphLaunch(std::forward<decltype(args)>(args)...);
};
};

static_assert(Runtime<Device::Type::kMetax>::Validate());
Expand Down
2 changes: 2 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ if(WITH_METAX)
METAX infini::rt::Device::Type::kMetax
infini/rt/metax/runtime_.h
1 1 1 1 1 1 1 1)
add_infini_rt_backend_graph_test(
METAX infini::rt::Device::Type::kMetax 1)
endif()

if(WITH_MOORE)
Expand Down
Loading