[llvm] [llvm-ir2vec] Adding Inst Embeddings Map API to ir2vec python bindings (PR #180140)

Nishant Sachdeva via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 12 05:11:21 PST 2026


================
@@ -169,16 +169,20 @@ Expected<Embedding> IR2VecTool::getFunctionEmbedding(const Function &F,
                              "Failed to create embedder for function '%s'.",
                              F.getName().str().c_str());
 
-  return Emb->getFunctionVector();
+  return Emb;
+}
+
+Expected<Embedding> IR2VecTool::getFunctionEmbedding(const Function &F,
+                                                     IR2VecKind Kind) const {
+  auto Emb = getIR2VecEmbedder(F, Kind);
----------------
nishant-sachdeva wrote:

I was hoping to keep any Tool specific logic out of the bindings code, and have the bindings code as only a wrapper to the max extent possible. Ideally, I think, the users of the IR2VecTool class should not need to know the Embedder interface, or other IR2Vec internals to invoke the Tool class

If we do this, then we'll have to create the embedder, and do more error handling in the Bindings code.

https://github.com/llvm/llvm-project/pull/180140


More information about the llvm-commits mailing list