Skip to content

Commit

Permalink
Merge pull request #81 from nishant-sachdeva/llvm16ray
Browse files Browse the repository at this point in the history
Updating support for llvm 16
  • Loading branch information
svkeerthy authored Jan 6, 2024
2 parents 3533d89 + 0ff759e commit dc8fd60
Show file tree
Hide file tree
Showing 251 changed files with 76,453 additions and 78,035 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "LLVM Manylinux",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "ghcr.io/iith-compilers/manylinux2014-llvm/manylinux2014-llvm:x86-llvm14"
"image": "ghcr.io/iith-compilers/manylinux2014-llvm/manylinux2014-llvm:x86-llvm16"

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-20.04

steps:
- name: Install LLVM-14.0.1
- name: Install LLVM-16.0.1
run: |
wget https://apt.llvm.org/llvm.sh
sudo bash llvm.sh 14
sudo bash llvm.sh 16
- uses: actions/checkout@v2
- name: Eigen-setup
run: |
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ jobs:
runs-on: ubuntu-20.04

steps:
- name: Install LLVM-14.0.1
- name: Install libzstd-dev
run: sudo apt-get install libzstd-dev
- name: Install LLVM-16.0.1
run: |
wget https://apt.llvm.org/llvm.sh
sudo bash llvm.sh 14
sudo bash llvm.sh 16
- uses: actions/checkout@v2
- name: Eigen-setup
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upload-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

build_sdist:
runs-on: ubuntu-latest
container: ghcr.io/iith-compilers/manylinux2014-llvm/manylinux2014-llvm:x86-llvm14
container: ghcr.io/iith-compilers/manylinux2014-llvm/manylinux2014-llvm:x86-llvm16
steps:
- uses: actions/checkout@v3

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
env:
CIBW_SKIP: "pp* *-musllinux_*"
CIBW_ARCHS: "x86_64"
CIBW_MANYLINUX_X86_64_IMAGE: "ghcr.io/iith-compilers/manylinux2014-llvm/manylinux2014-llvm:x86-llvm14"
CIBW_MANYLINUX_X86_64_IMAGE: "ghcr.io/iith-compilers/manylinux2014-llvm/manylinux2014-llvm:x86-llvm16"
CIBW_BEFORE_ALL: "bash Manylinux2014_Compliant_Source/pkg/build.sh"
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: "pytest {project}/Manylinux2014_Compliant_Source/pkg/tests"
Expand Down
2 changes: 1 addition & 1 deletion Manylinux2014_Compliant_Source/manylinux-llvm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RUN cmake -DCMAKE_BUILD_TYPE=Release -G Ninja -B build \
&& cmake --install build --prefix /root/destdir

WORKDIR /root/llvm
ARG LLVM_VERSION="14.0.1"
ARG LLVM_VERSION="16.0.1"
RUN wget -q "https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz" \
&& tar -xf "llvm-project-${LLVM_VERSION}.src.tar.xz"
WORKDIR /root/llvm/llvm-project-${LLVM_VERSION}.src/build
Expand Down
4 changes: 2 additions & 2 deletions Manylinux2014_Compliant_Source/pkg/regen-oracle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cd src/test-suite

rm -rf oracle

SEED_VERSION="llvm14"
SEED_VERSION="llvm16"
SRC_WD="PE-benchmarks"
DEST_FOLDER_LL="PE-benchmarks-llfiles-${SEED_VERSION}"
DEST_FOLDER_SYM="oracle/SYM_${SEED_VERSION}_f"
Expand All @@ -18,7 +18,7 @@ mkdir -p ${DEST_FOLDER_LL}

for d in ${SRC_WD}/*.c ${SRC_WD}/*.cpp ${SRC_WD}/*.cc; do
echo "Compiling ${d} to IR"
name=$(basename ${d}) && oname=${name%.*} && clang-14 -S -emit-llvm -Xclang -disable-O0-optnone ${d} -o ${DEST_FOLDER_LL}/${oname}.ll &
name=$(basename ${d}) && oname=${name%.*} && clang-16 -S -emit-llvm -Xclang -disable-O0-optnone ${d} -o ${DEST_FOLDER_LL}/${oname}.ll &
done
wait

Expand Down
2 changes: 1 addition & 1 deletion Manylinux2014_Compliant_Source/pkg/tests/test_ir2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
ABS_ACCURACY = 1e-4

TEST_SUITE_DIR = pl.Path(__file__).resolve().parents[3] / "src" / "test-suite"
SEED_VERSION = "llvm14"
SEED_VERSION = "llvm16"

ll_files = []
path = TEST_SUITE_DIR / f"index-{SEED_VERSION}.files"
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Please see [here](https://compilers.cse.iith.ac.in/projects/ir2vec/) for more de

> IR2Vec: LLVM IR Based Scalable Program Embeddings, S. VenkataKeerthy, Rohit Aggarwal, Shalini Jain, Maunendra Sankar Desarkar, Ramakrishna Upadrasta, and Y. N. Srikant
[![LLVM](https://img.shields.io/badge/LLVM-v14.0.1-blue)](https://github.com/llvm/llvm-project/releases/tag/llvmorg-14.0.1)
[![LLVM](https://img.shields.io/badge/LLVM-v16.0.1-blue)](https://github.com/llvm/llvm-project/releases/tag/llvmorg-16.0.1)
[![PyPI Version](https://img.shields.io/pypi/v/IR2Vec)](https://pypi.org/project/IR2Vec/)
![Tests](https://github.com/IITH-Compilers/IR2Vec/workflows/Tests/badge.svg)
![Publish](https://github.com/IITH-Compilers/IR2Vec/workflows/Publish/badge.svg)
Expand All @@ -18,7 +18,8 @@ Please see [here](https://compilers.cse.iith.ac.in/projects/ir2vec/) for more de

| LLVM Version | Branch |
| ------------ | ------ |
| LLVM 14.0.1 | [main](https://github.com/IITH-Compilers/IR2Vec) |
| LLVM 16.0.1 | [main](https://github.com/IITH-Compilers/IR2Vec) |
| LLVM 14.0.1 | [llvm14](https://github.com/IITH-Compilers/IR2Vec/tree/llvm14) |
| LLVM 12.0.0 | [llvm12](https://github.com/IITH-Compilers/IR2Vec/tree/llvm12) |
| LLVM 10.0.1 | [llvm10](https://github.com/IITH-Compilers/IR2Vec/tree/llvm10) |
| LLVM 8.0.1 | [llvm8](https://github.com/IITH-Compilers/IR2Vec/tree/llvm8) |
Expand Down Expand Up @@ -68,7 +69,7 @@ If you're a C++ developer and require low-level control, optimization, or integr
## Requirements
* cmake (>= 3.13.4)
* GNU Make (4.2.1)
* LLVM (14.0.1) - [src](https://github.com/llvm/llvm-project/tree/release/14.x), [release](https://releases.llvm.org/download.html#14.0.1)
* LLVM (16.0.1) - [src](https://github.com/llvm/llvm-project/tree/release/16.x), [release](https://releases.llvm.org/download.html#16.0.1)
* Support for latest LLVM versions would be added soon
* Eigen library (3.3.7)
* Python (3.6.7)
Expand Down
4 changes: 2 additions & 2 deletions experiments/Device_Mapping/DevMap.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
],
"source": [
"raw_embeddings, fileIndexNum = readEmd_program(\n",
" \"./output/embeddings/Device_Mapping_Symbolic_llvm14.txt\"\n",
" \"./output/embeddings/Device_Mapping_Symbolic_llvm16txt\"\n",
")\n",
"ir2vec_sym = evaluate(max_depth=10, learning_rate=0.5, n_estimators=70, seed=104)"
]
Expand Down Expand Up @@ -359,7 +359,7 @@
],
"source": [
"raw_embeddings, fileIndexNum = readEmd_program(\n",
" \"./output/embeddings/Device_Mapping_FlowAware_llvm14.txt\"\n",
" \"./output/embeddings/Device_Mapping_FlowAware_llvm16.txt\"\n",
")\n",
"ir2vec_fa = evaluate(max_depth=10, learning_rate=0.5, n_estimators=70, seed=104)"
]
Expand Down
8 changes: 4 additions & 4 deletions experiments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Device_Mapping
| |-- cgo17-nvidia.csv
|-- output
| |-- embeddings
| | |-- Device_Mapping_Symbolic_llvm14.txt
| | |-- Device_Mapping_FlowAware_llvm14.txt
| | |-- Device_Mapping_Symbolic_llvm16.txt
| | |-- Device_Mapping_FlowAware_llvm16.txt
|-- DevMap.ipynb
```
## Thread Coarsening
Expand All @@ -60,8 +60,8 @@ Thread_Coarsening
| |-- pact-2014-runtimes.csv
|-- output
| |-- embeddings
| | |-- Thread_Coarsening_Symbolic_llvm14.txt
| | |-- Thread_Coarsening_FlowAware_llvm14.txt
| | |-- Thread_Coarsening_Symbolic_llvm16.txt
| | |-- Thread_Coarsening_FlowAware_llvm16.txt
|-- ThreadCoarsening.ipynb
```
## Out_Of_Vocabulary
Expand Down
4 changes: 2 additions & 2 deletions experiments/Thread_Coarsening/ThreadCoarsening.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@
],
"source": [
"raw_embeddings, fileIndex = readEmd_program(\n",
" \"./output/embeddings/Thread_Coarsening_Symbolic_llvm14.txt\"\n",
" \"./output/embeddings/Thread_Coarsening_Symbolic_llvm16.txt\"\n",
")\n",
"ir2vec_sym = evaluate(max_depth=1, learning_rate=0.05, n_estimators=140)"
]
Expand Down Expand Up @@ -374,7 +374,7 @@
],
"source": [
"raw_embeddings, fileIndex = readEmd_program(\n",
" \"./output/embeddings/Thread_Coarsening_FlowAware_llvm14.txt\"\n",
" \"./output/embeddings/Thread_Coarsening_FlowAware_llvm16.txt\"\n",
")\n",
"ir2vec_fa = evaluate(max_depth=1, learning_rate=0.05, n_estimators=140)"
]
Expand Down
4 changes: 2 additions & 2 deletions experiments/generate_IR2Vec_embeddings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ fi

if [ $EncodingType = "SYM" ]; then
PASS="sym"
Trans_type="${TASK_DIR}_Symbolic_llvm14"
Trans_type="${TASK_DIR}_Symbolic_llvm16"
elif [ $EncodingType = "FA" ]; then
PASS="fa"
Trans_type="${TASK_DIR}_FlowAware_llvm14"
Trans_type="${TASK_DIR}_FlowAware_llvm16"
else
echo "Please enter SYM or FA for EncodingType"
exit
Expand Down
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
set(LT_LLVM_INSTALL_DIR "" CACHE PATH "LLVM installation directory")
list(APPEND CMAKE_PREFIX_PATH "${LT_LLVM_INSTALL_DIR}/lib/cmake/llvm/")

find_package(LLVM 14.0.0 REQUIRED CONFIG)
find_package(LLVM 16.0.0 REQUIRED CONFIG)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")

Expand Down Expand Up @@ -68,15 +68,15 @@ install(TARGETS ${IR2VEC_LIB} ${IR2VEC_LIB_STATIC}
add_subdirectory(test-suite)

add_custom_target(verify-symbolic
COMMAND bash ./sanity_check.sh SYM llvm14
COMMAND bash ./sanity_check.sh SYM llvm16
COMMENT "Generating Symbolic IR2Vec vectors and comparing with oracle..."
WORKING_DIRECTORY ./test-suite
DEPENDS ${PROJECT_NAME}
VERBATIM
)

add_custom_target(verify-flowaware
COMMAND bash sanity_check.sh FA llvm14
COMMAND bash sanity_check.sh FA llvm16
COMMENT "Generating Flow-Aware IR2Vec vectors and comparing with oracle..."
WORKING_DIRECTORY ./test-suite
DEPENDS ${PROJECT_NAME}
Expand Down
4 changes: 2 additions & 2 deletions src/test-suite/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
configure_file(sanity_check.sh.cmake sanity_check.sh @ONLY)
file(COPY PE-benchmarks-llfiles-llvm14 DESTINATION ./)
file(COPY PE-benchmarks-llfiles-llvm16 DESTINATION ./)
file(COPY oracle DESTINATION ./)
file(COPY ../../vocabulary DESTINATION ./)
file(COPY index-llvm14.files DESTINATION ./)
file(COPY index-llvm16.files DESTINATION ./)
Loading

0 comments on commit dc8fd60

Please sign in to comment.