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
53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include "libkar.h"
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace strata::kar {
|
|
|
|
// Parts cover one global PLE table in row order. The archive and its mapped
|
|
// bytes must outlive the cache. The caller verifies the archive before open().
|
|
struct PlePart {
|
|
uint64_t row_base;
|
|
const kar_tensor_info* tensor;
|
|
};
|
|
|
|
struct PleCacheStats {
|
|
uint64_t hits = 0;
|
|
uint64_t misses = 0;
|
|
uint64_t compressed_bytes = 0;
|
|
uint64_t host_to_device_bytes = 0;
|
|
};
|
|
|
|
// Experimental level-2, group-32 PLE cache. Each 160-value row occupies one
|
|
// 64-byte compressed VRAM slot; enqueue() decodes requested rows to caller VRAM.
|
|
// Calls are serialized. A CUDA event guards the reusable pinned staging buffers
|
|
// and slots until the previous launch has completed, even across streams.
|
|
class PleRowCache {
|
|
public:
|
|
PleRowCache();
|
|
~PleRowCache();
|
|
PleRowCache(const PleRowCache&) = delete;
|
|
PleRowCache& operator=(const PleRowCache&) = delete;
|
|
|
|
bool open(const uint8_t* archive_map, size_t archive_bytes,
|
|
const std::vector<PlePart>& parts, uint32_t cache_mib,
|
|
uint32_t max_batch_rows, std::string& err);
|
|
bool enqueue(const uint32_t* rows, size_t count, float* device_output,
|
|
cudaStream_t stream, std::string& err);
|
|
void close();
|
|
PleCacheStats stats() const;
|
|
uint32_t slots() const;
|
|
|
|
private:
|
|
struct Impl;
|
|
std::unique_ptr<Impl> impl_;
|
|
};
|
|
|
|
} // namespace strata::kar
|