Files
leleka/gpu/kar/include/kar_expert.hpp
T
Pavlo Ratushnyi 4013e0c9bd
Desktop foundation / core (ubuntu-latest) (push) Failing after 28s
Desktop foundation / core (macos-latest) (push) Canceled after 0s
Desktop foundation / core (windows-latest) (push) Canceled after 0s
Linux / verify (push) Canceled after 0s
Linux / keyless-cuda (push) Canceled after 0s
Linux / static-cuda-package (push) Canceled after 0s
Linux / hosted-cuda-package (push) Canceled after 0s
Linux / linux-static-cli (push) Canceled after 0s
Linux / linux-cli-container (push) Canceled after 0s
Linux / release-cli (push) Canceled after 0s
Import tracked Strata Next source snapshot
2026-10-05 18:15:08 +02:00

38 lines
1.4 KiB
C++

#pragma once
#include "libkar.h"
#include <cstddef>
#include <cstdint>
#include <memory>
#include <string>
namespace strata::kar {
// Experimental component. The caller owns an immutable, verified archive mapping.
// One resident compressed expert; one reusable decoded matrix, never a full bank.
// Not thread safe. stage/run may only follow completion of the previous run.
class ResidentExpert {
public:
ResidentExpert();
~ResidentExpert();
ResidentExpert(const ResidentExpert&) = delete;
ResidentExpert& operator=(const ResidentExpert&) = delete;
bool open(uint32_t hidden, uint32_t intermediate, uint32_t level,
uint32_t max_tokens, std::string& error);
bool stage(const uint8_t* archive, size_t bytes,
const kar_tensor_info& gate, const kar_tensor_info& up,
const kar_tensor_info& down, uint32_t expert, std::string& error);
// Input/output are host F32. Only this component's event is waited in finish.
bool run(const float* input, uint32_t tokens, std::string& error);
bool finish(float* output, std::string& error);
// Offline qualification hook: copy one reconstructed matrix to the host.
bool inspect_matrix(uint32_t role, float* output, std::string& error);
uint64_t resident_bytes() const;
uint64_t scratch_bytes() const;
private:
struct Impl;
std::unique_ptr<Impl> impl_;
};
} // namespace strata::kar