MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / cache_graph_capacity

Function cache_graph_capacity

src/models/vibevoice/decoder.cpp:247–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245}
246
247int64_t cache_graph_capacity(int64_t required_capacity, int64_t model_capacity) {
248 if (required_capacity <= 0) {
249 throw std::runtime_error("VibeVoice decoder cache capacity must be positive");
250 }
251 if (model_capacity > 0 && required_capacity > model_capacity) {
252 throw std::runtime_error("VibeVoice decoder cache requirement exceeds model position capacity");
253 }
254 int64_t capacity = required_capacity;
255 if (required_capacity < kScratchTailCachedAttentionMinSteps) {
256 capacity = 1;
257 while (capacity < required_capacity) {
258 if (capacity > std::numeric_limits<int64_t>::max() / 2) {
259 throw std::runtime_error("VibeVoice decoder cache capacity overflow");
260 }
261 capacity *= 2;
262 }
263 } else {
264 capacity = ((required_capacity + kLargeCacheGrowthStep - 1) / kLargeCacheGrowthStep) *
265 kLargeCacheGrowthStep;
266 }
267 return model_capacity > 0 ? std::min(capacity, model_capacity) : capacity;
268}
269
270runtime::TransformerKVState empty_decoder_state(size_t layers) {
271 runtime::TransformerKVState state;

Callers 2

cached_stepMethod · 0.85
cached_step_batchMethod · 0.85

Calls 2

maxFunction · 0.85
minFunction · 0.85

Tested by

no test coverage detected