Skip to content

Commit 9b4541e

Browse files
committed
Addressing review comments in doc
1 parent 6e0385e commit 9b4541e

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

llvm/docs/MLGO.rst

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -196,39 +196,35 @@ and used to obtain the vocabulary mapping. Then, use this mapping to
196196
derive the representations. In LLVM, this process is implemented using two
197197
independent passes: ``IR2VecVocabAnalysis`` and ``IR2VecAnalysis``. The former
198198
reads the JSON vocabulary and populates ``IR2VecVocabResult``, which is then used
199-
by ``IR2VecAnalysis``.
199+
by ``IR2VecAnalysis``.
200200

201-
It is recommended to run ``IR2VecVocabAnalysis`` once, as the
202-
vocabulary typically does not change. In the future, we plan
203-
to improve this process by automatically generating the vocabulary mappings
201+
``IR2VecVocabAnalysis`` is immutable and is intended to
202+
be run once before ``IR2VecAnalysis`` is run. In the future, we plan
203+
to improve this requirement by automatically generating default the vocabulary mappings
204204
during build time, eliminating the need for a separate file read.
205205

206206
IR2VecAnalysis Usage
207207
--------------------
208208

209209
To use IR2Vec in an LLVM-based tool or pass, interaction with the analysis
210210
results can be done through the following APIs:
211+
212+
1. **Accessing the Analysis Results:**
211213

212-
1. **Including the Header:**
213-
214-
First, include the necessary header file in the source code:
214+
To access the IR2Vec embeddings, obtain the ``IR2VecAnalysis``
215+
result from the Function Analysis Manager (FAM).
215216

216217
.. code-block:: c++
217218

218219
#include "llvm/Analysis/IR2VecAnalysis.h"
219220

220-
2. **Accessing the Analysis Results:**
221-
222-
To access the IR2Vec embeddings, obtain the ``IR2VecAnalysis``
223-
result from the Function Analysis Manager (FAM).
224-
225-
.. code-block:: c++
221+
// ... other includes and code ...
226222

227223
llvm::FunctionAnalysisManager &FAM = ...; // The FAM instance
228224
llvm::Function &F = ...; // The function to analyze
229225
auto &IR2VecResult = FAM.getResult<llvm::IR2VecAnalysis>(F);
230226

231-
3. **Checking for Valid Results:**
227+
2. **Checking for Valid Results:**
232228

233229
Ensure that the analysis result is valid before accessing the embeddings:
234230

@@ -238,7 +234,7 @@ results can be done through the following APIs:
238234
// Proceed to access embeddings
239235
}
240236

241-
4. **Retrieving Embeddings:**
237+
3. **Retrieving Embeddings:**
242238

243239
The ``IR2VecResult`` provides access to embeddings (currently) at three levels:
244240

@@ -271,7 +267,7 @@ results can be done through the following APIs:
271267
const ir2vec::Embedding &funcEmbedding = IR2VecResult.getFunctionVector();
272268
// Use the function embedding
273269

274-
5. **Working with Embeddings:**
270+
4. **Working with Embeddings:**
275271

276272
Embeddings are represented as ``std::vector<double>``. These
277273
vectors as features for machine learning models, compute similarity scores

0 commit comments

Comments
 (0)