42 lines
1021 B
C++
42 lines
1021 B
C++
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <utility>
|
|
|
|
|
|
#include "ggml-backend.h"
|
|
|
|
/**
|
|
* @brief Initializes the calrt backend for a specified device.
|
|
*
|
|
* This function initializes the calrt backend for the given device.
|
|
* It verifies the device index, allocates a context, and creates a backend
|
|
* instance.
|
|
*
|
|
* @param device The index of the device to initialize.
|
|
* @return A pointer to the initialized backend instance, or nullptr on failure.
|
|
*/
|
|
GGML_BACKEND_API ggml_backend_t ggml_backend_calrt_init(int32_t device);
|
|
|
|
GGML_BACKEND_API ggml_backend_reg_t ggml_backend_calrt_reg(void);
|
|
|
|
|
|
class cmd_config {
|
|
public:
|
|
struct cmd_ctx {
|
|
std::string case_path;
|
|
|
|
cmd_ctx(std::string path) : case_path(std::move(path)) {}
|
|
};
|
|
|
|
static void set_ctx(std::unique_ptr<cmd_ctx> ctx) { cur_ctx = std::move(ctx); }
|
|
|
|
static cmd_ctx * get_ctx() { return cur_ctx.get(); }
|
|
private:
|
|
static inline thread_local std::unique_ptr<cmd_ctx> cur_ctx = nullptr;
|
|
};
|
|
|
|
|