| 1891 | } |
| 1892 | |
| 1893 | HeartMuLaBackbonePrefillOutput HeartMuLaWeightsRuntime::backbone_prefill_embeddings( |
| 1894 | const std::vector<float> & embeddings, |
| 1895 | int64_t batch_size, |
| 1896 | int64_t steps) const { |
| 1897 | const auto & config = assets_->mula_config.backbone; |
| 1898 | if (batch_size <= 0 || steps <= 0) { |
| 1899 | throw std::runtime_error("HeartMuLa backbone prefill requires positive batch and step counts"); |
| 1900 | } |
| 1901 | if (steps > config.max_seq_len) { |
| 1902 | throw std::runtime_error("HeartMuLa backbone prefill exceeds model context length"); |
| 1903 | } |
| 1904 | if (static_cast<int64_t>(embeddings.size()) != batch_size * steps * config.embed_dim) { |
| 1905 | throw std::runtime_error("HeartMuLa backbone prefill embedding payload size mismatch"); |
| 1906 | } |
| 1907 | if (backbone_prefill_graph_ == nullptr || |
| 1908 | !backbone_prefill_graph_->matches(*this, batch_size, steps)) { |
| 1909 | backbone_prefill_graph_ = std::make_unique<HeartMuLaBackbonePrefillGraph>(*this, batch_size, steps); |
| 1910 | } |
| 1911 | return backbone_prefill_graph_->run(embeddings); |
| 1912 | } |
| 1913 | |
| 1914 | void HeartMuLaWeightsRuntime::reset_backbone_cached_state( |
| 1915 | HeartMuLaBackboneCachedState & state, |
no test coverage detected