Skip to content

Commit

Permalink
Merge branch 'main' into llvm14config
Browse files Browse the repository at this point in the history
  • Loading branch information
nishant-sachdeva committed Dec 22, 2023
2 parents 1a1588d + bfbe79d commit 8e8c088
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 145 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ build/
__pycache__/
.vscode
experiments/*/output

seed_embeddings/triplets.txt
seed_embeddings/triplets14.txt
seed_embeddings/preprocessed/*
Expand Down
5 changes: 1 addition & 4 deletions Manylinux2014_Compliant_Source/pkg/tests/test_ir2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ def assert_valid_functionVector(functionVectorMap):

return True


def test_fa_p():
p_vectors = []
for file in ll_files:
Expand Down Expand Up @@ -194,14 +193,13 @@ def test_fa_f():
assert(
funcObj["vector"] == pytest.approx(functionOutput1[fun]["vector"], abs=ABS_ACCURACY)
)

print(TEST_SUITE_DIR)
f_vecs_oracle = read_f_file(
TEST_SUITE_DIR / "oracle" / f"FA_{SEED_VERSION}_f" / "ir2vec.txt"
)
for pname, funs in f_vecs_oracle.items():
for fname, vec in funs.items():

assert vec == pytest.approx(
f_vecs[pname][fname], abs=ABS_ACCURACY
), f"Checking {pname}: {fname}"
Expand Down Expand Up @@ -256,7 +254,6 @@ def test_sym_f():
)
for pname, funs in f_vecs_oracle.items():
for fname, vec in funs.items():

assert vec == pytest.approx(
f_vecs[pname][fname], abs=ABS_ACCURACY
), f"Checking {pname}: {fname}"
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Please see [here](https://compilers.cse.iith.ac.in/projects/ir2vec/) for more de
- [LLVM Version Archive](#llvm-version-archive)
- [Table Of Contents](#table-of-contents)
- [Installation](#installation)

- [Requirements](#requirements)
- [Binaries and Libraries - Artifacts](#binaries-and-libraries---artifacts)
- [Building from source](#building-from-source)
Expand Down Expand Up @@ -55,7 +56,6 @@ pip install -U IR2Vec
```
However, building from source is also supported for which the requirements and steps are listed down below.


## Requirements
* cmake (>= 3.13.4)
* GNU Make (4.2.1)
Expand All @@ -70,8 +70,6 @@ However, building from source is also supported for which the requirements and s

(Experiments are done on an Ubuntu 20.04 machine)

## Binaries and Libraries - Artifacts
Binaries and Libraries (.a and .so) are autogenerated for every relevant checkin using GitHub Actions. Such generated artifacts are tagged along with the successful runs of `Publish` workflow and can be found [here](https://github.com/IITH-Compilers/IR2Vec/actions?query=workflow%3APublish).

## Building from source
1. `mkdir build && cd build`
Expand All @@ -89,8 +87,10 @@ This process would generate `ir2vec` binary under `build/bin` directory, `libIR2

To ensure the correctness, run `make verify-all`



## Generating program representations
`IR2Vec` can be used either as a stand alone tool using binary, or can be integrated with any third party tools using libraries. Please see below for the usage
`IR2Vec` can be used either as a stand-alone tool using binary or can be integrated with any third-party tools using libraries. Please see below for the usage
instructions.

### Using Binary
Expand Down Expand Up @@ -122,16 +122,17 @@ Please use `--help` for further details.
> <function-name> = <Embeddings>
#### Flow-Aware Embeddings
* `` ir2vec -fa -vocab vocabulary/seedEmbeddingVocab-300-llvm12.txt -o <output_file> -level <p|f> -class <class-number> <input_ll_file>``
For all functions
* `` ir2vec -fa -vocab vocabulary/seedEmbeddingVocab-llvm14.txt -o <output_file> -level <p|f> -class <class-number> <input_ll_file>``

#### Symbolic Embeddings
* `` ir2vec -sym -vocab vocabulary/seedEmbeddingVocab-300-llvm12.txt -o <output_file> -level <p|f> -class <class-number> <input_ll_file>``

#### On-demand Flow-Aware Embeddings
* `` ir2vec -fa -vocab vocabulary/seedEmbeddingVocab-300-llvm12.txt -o <output_file> -level f -class <class-number> -funcName=\<function-name\><input_ll_file>``
For a specific function
* `` ir2vec -fa -vocab vocabulary/seedEmbeddingVocab-llvm14.txt -o <output_file> -level f -class <class-number> -funcName=\<function-name\><input_ll_file>``

#### On-demand Symbolic Embeddings
* `` ir2vec -sym -vocab vocabulary/seedEmbeddingVocab-300-llvm12.txt -o <output_file> -level f -class <class-number> -funcName=\<function-name\> <input_ll_file>``
#### Symbolic Embeddings
For all functions
* `` ir2vec -sym -vocab vocabulary/seedEmbeddingVocab-llvm14.txt -o <output_file> -level <p|f> -class <class-number> <input_ll_file>``
For a specific function
* `` ir2vec -sym -vocab vocabulary/seedEmbeddingVocab-llvm14.txt -o <output_file> -level f -class <class-number> -funcName=\<function-name\> <input_ll_file>``

## Using Libraries
The libraries can be installed by passing the installation location to the `CMAKE_INSTALL_PREFIX` flag during `cmake` followed by `make install`.
Expand Down Expand Up @@ -190,7 +191,6 @@ for (auto val : pgmVec)
outs() << val << "\t";
```
## Using Python package (IR2Vec-Wheels)
- Input:
- .ll/.bc file for which embeddings are needed
Expand Down
Loading

0 comments on commit 8e8c088

Please sign in to comment.