inflect_micro_v2 / cpp /src /ax_runner.h
inoryQwQ's picture
三芯片合并:AX620E/AX637 升级 encoder+decoder 全 NPU,新增新一代 SDK;AX650 保持老 SDK
5eee449 verified
Raw
History Blame Contribute Delete
1.28 kB
#pragma once
// Thin wrapper over the AX Engine runtime (ax_engine/ax_sys from the AXera
// BSP, AX620E convention). Compiled against the real runtime when CMake is
// configured with -DAX_RUNTIME_ROOT=<bsp root>; otherwise a stub that throws
// on construction (host-side configure/build still passes — see README).
#include <cstddef>
#include <cstdint>
#include <string>
#include <utility>
#include <vector>
class AxRunner {
public:
explicit AxRunner(const std::string& model_path);
~AxRunner();
AxRunner(const AxRunner&) = delete;
AxRunner& operator=(const AxRunner&) = delete;
// Input/output buffer sizes in bytes, in model-declared order.
std::vector<size_t> input_sizes() const;
std::vector<size_t> output_sizes() const;
// Tensor names in model-declared order (empty when unavailable).
std::vector<std::string> input_names() const;
std::vector<std::string> output_names() const;
// feeds[i] = (data, bytes) for input i; returns output byte buffers in
// model output order (m_p, logs_p, logw for the encoder; wav for the
// decoder — all float32).
std::vector<std::vector<uint8_t>> run(
const std::vector<std::pair<const void*, size_t>>& feeds);
private:
struct Impl;
Impl* impl_;
};