[llvm] Reland "[MLGO][IR2Vec] Integrating IR2Vec with MLInliner (#143479)" (PR #145664)
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 30 12:27:56 PDT 2025
================
@@ -433,6 +447,24 @@ std::unique_ptr<InlineAdvice> MLInlineAdvisor::getAdviceImpl(CallBase &CB) {
*ModelRunner->getTensor<int64_t>(FeatureIndex::is_caller_avail_external) =
Caller.hasAvailableExternallyLinkage();
+ if (UseIR2Vec) {
+ // Python side expects float embeddings. The IR2Vec embeddings are doubles
+ // as of now due to the restriction of fromJSON method used by the
+ // readVocabulary method in ir2vec::Embeddings.
+ auto setEmbedding = [&](const ir2vec::Embedding &Embedding,
+ FeatureIndex Index) {
+ auto Embedding_float =
----------------
mtrofin wrote:
Also, this results in 2 copies. Maybe we can do in 1:
```
for (auto I = 0, E = Embedding.size(); ++I)
ModelRunner->getTensor<float>(Index)[I] = Embedding[I];
```
https://github.com/llvm/llvm-project/pull/145664
More information about the llvm-commits
mailing list