Skip to content

Commit

Permalink
Merge pull request #135 from KaushalMorankar/main
Browse files Browse the repository at this point in the history
llvm18
  • Loading branch information
svkeerthy authored Jan 20, 2025
2 parents f0d17bc + 1275cd3 commit 455b1c1
Show file tree
Hide file tree
Showing 156 changed files with 8,659 additions and 8,733 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches: [ main ]
jobs:
pre-commit:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
run: |
sudo python3 -m pip install lit
sudo python3 -m pip install filecheck
- name: Install LLVM-17
- name: Install LLVM-18
run: |
wget https://apt.llvm.org/llvm.sh
sudo bash llvm.sh 17
sudo bash llvm.sh 18
- uses: actions/checkout@v2
- name: Eigen-setup
run: |
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
rev: v1.1.1
hooks:
- id: clang-format
args: [-i]
args: [-i, --version=14]
# - repo: https://github.com/dfm/black_nbconvert
# rev: v0.4.0
# hooks:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.13)
project(ir2vec VERSION 2.1.2)
project(ir2vec VERSION 2.1.3)

set(IR2VEC_LIB "IR2Vec")
set(IR2VEC_LIB_STATIC "IR2Vec_Static")
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="17.0.6"
ARG LLVM_VERSION="18.1.8"
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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Please see [here](https://compilers.cse.iith.ac.in/projects/ir2vec/) for more de

| LLVM Version | Branch |
| ------------ | ------ |
| LLVM 17.0.6 | [main](https://github.com/IITH-Compilers/IR2Vec) |
| LLVM 18.1.8 | [main](https://github.com/IITH-Compilers/IR2Vec) |
| LLVM 17.0.6 | [llvm17](https://github.com/IITH-Compilers/IR2Vec/tree/llvm17) |
| LLVM 16.0.1 | [llvm16](https://github.com/IITH-Compilers/IR2Vec/tree/llvm16) |
| 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) |
Expand Down Expand Up @@ -75,7 +76,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 (17.0.6) - [src](https://github.com/llvm/llvm-project/tree/release/17.x), [release](https://releases.llvm.org/download.html#17.0.6)
* LLVM (18.1.8) - [src](https://github.com/llvm/llvm-project/tree/release/18.x), [release](https://releases.llvm.org/download.html#18.1.8)
* Support for latest LLVM versions would be added soon
* Eigen library (3.3.7) (Optional)
* Python (3.6.7)
Expand Down
2 changes: 1 addition & 1 deletion seed_embeddings/OpenKE/generate_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def findRep(src, dest, index_dir):
),
)

findRep(outfile, seedfile, arg_conf.index_dir)
findRep(outfilejson, seedfile, arg_conf.index_dir)

print("Training finished...")
print("seed file : ", seedfile)
10 changes: 5 additions & 5 deletions seed_embeddings/OpenKE/generate_embedding_ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ def test_files(index_dir):

print(entities, relations, train)
if not os.path.exists(entities):
raise Exception(f"{entities} not found")
raise Exception("entity2id.txt not found")
if not os.path.exists(relations):
raise Exception(f"{relations} not found")
raise Exception("relation2id.txt not found")
if not os.path.exists(train):
raise Exception(f"{train} not found")
raise Exception("train2id.txt not found")


def train(config, args=None):
Expand Down Expand Up @@ -153,7 +153,7 @@ def reformat_embeddings(input_str):
metavar="DIRECTORY",
help="Location of the directory entity2id.txt, train2id.txt and relation2id.txt",
required=False,
default="../seed_embeddings/preprocessed/",
default="../preprocessed",
)
parser.add_argument(
"--epoch", dest="epoch", help="Epochs", required=False, type=int, default=1000
Expand Down Expand Up @@ -286,7 +286,7 @@ def reformat_embeddings(input_str):
param_space=search_space,
tune_config=TuneConfig(
search_alg=optuna,
max_concurrent_trials=3,
max_concurrent_trials=12,
scheduler=scheduler,
num_samples=128,
),
Expand Down
8 changes: 3 additions & 5 deletions seed_embeddings/triplets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,13 @@ while read p; do
fi
USED_OPT[$a]=$opt
DEBUG echo "opt from $opt"
${LLVM_BUILD}/bin/opt-17 -S -$opt $p -o $tmpfile
${LLVM_BUILD}/bin/opt-18 -S -$opt $p -o $tmpfile
$COLLECT_BUILD/bin/ir2vec -collectIR -o $4 $tmpfile &>/dev/null
let "a++"
# rm -rf "$tmpfile"
rm "$tmpfile"
done &
if [ $counter == 100 ]; then
echo "========= PAUSE ========="
rm -rf ${PATH_VAR}/tmp/IR2Vec-CollectIR*
sleep 3
sleep 20
counter=0
fi

Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ if(NOT LLVM_IR2VEC)
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 17.0.0 REQUIRED CONFIG)
find_package(LLVM 18.1.8 REQUIRED CONFIG)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")

Expand Down
18 changes: 10 additions & 8 deletions src/test-suite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ set(SQLITE_LLVM_IR

# SQLite IR file is added along side other PE-benchmarks for this version
if(NOT EXISTS ${SQLITE_LLVM_IR} AND ENABLE_SQLITE)
find_program(CLANG_EXECUTABLE clang HINTS "${LLVM_TOOLS_BINARY_DIR}")
if (CLANG_EXECUTABLE)
message(STATUS "Clang executable found at: ${CLANG_EXECUTABLE}")
else()
message(FATAL_ERROR "Clang executable not found.")
endif()

# The downloaded Zip file and source files directory are located at the
# build directory since its already gitignore anyways.
set(SQLITE_ZIP ${CMAKE_CURRENT_BINARY_DIR}/sqlite-amalgamation-3460000.zip)
Expand Down Expand Up @@ -48,13 +55,8 @@ if(NOT EXISTS ${SQLITE_LLVM_IR} AND ENABLE_SQLITE)
endif()
endif()

find_program(CLANG_BIN NAMES clang-17 clang)
if(NOT CLANG_BIN)
message(FATAL_ERROR "Clang not found. Please install it.")
endif()

execute_process(
COMMAND ${CLANG_BIN} -S -emit-llvm ${SQLITE_COMPILE_FLAGS}
COMMAND ${CLANG_EXECUTABLE} -S -emit-llvm ${SQLITE_COMPILE_FLAGS}
-Xclang -disable-O0-optnone
-o ${SQLITE_LLVM_IR}
${SQLITE_SOURCE}/sqlite3.c
Expand All @@ -68,11 +70,11 @@ endif()

# sanity checks and lit configs
configure_file(sanity_check.sh.cmake sanity_check.sh @ONLY)
file(COPY PE-benchmarks-llfiles-llvm17 DESTINATION ./)
file(COPY PE-benchmarks-llfiles-llvm18 DESTINATION ./)
file(COPY sqlite3.ll DESTINATION ./)
file(COPY oracle DESTINATION ./)
file(COPY ../../vocabulary DESTINATION ./)
file(COPY index-llvm17.files DESTINATION ./)
file(COPY index-llvm18.files DESTINATION ./)


configure_file(lit.site.cfg.py.in lit.site.cfg.py @ONLY)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; ModuleID = 'PE-benchmarks/Find_the_closest_pair_from_two_sorted_arrays.cpp'
source_filename = "PE-benchmarks/Find_the_closest_pair_from_two_sorted_arrays.cpp"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

module asm ".globl _ZSt21ios_base_library_initv"

Expand Down Expand Up @@ -71,7 +71,7 @@ define dso_local void @_Z12printClosestPiS_iii(ptr noundef %0, ptr noundef %1, i
%38 = add nsw i32 %32, %37
%39 = load i32, ptr %10, align 4
%40 = sub nsw i32 %38, %39
%41 = call i32 @abs(i32 noundef %40) #5
%41 = call i32 @llvm.abs.i32(i32 %40, i1 true)
%42 = load i32, ptr %11, align 4
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %61
Expand All @@ -94,7 +94,7 @@ define dso_local void @_Z12printClosestPiS_iii(ptr noundef %0, ptr noundef %1, i
%57 = add nsw i32 %51, %56
%58 = load i32, ptr %10, align 4
%59 = sub nsw i32 %57, %58
%60 = call i32 @abs(i32 noundef %59) #5
%60 = call i32 @llvm.abs.i32(i32 %59, i1 true)
store i32 %60, ptr %11, align 4
br label %61

Expand Down Expand Up @@ -148,8 +148,8 @@ define dso_local void @_Z12printClosestPiS_iii(ptr noundef %0, ptr noundef %1, i
ret void
}

; Function Attrs: nounwind willreturn memory(none)
declare i32 @abs(i32 noundef) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #1

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #2

Expand Down Expand Up @@ -182,11 +182,10 @@ define dso_local noundef i32 @main() #3 {
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

attributes #0 = { mustprogress noinline uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nounwind willreturn memory(none) "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress noinline norecurse uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2, !3, !4}
!llvm.ident = !{!5}
Expand All @@ -196,6 +195,6 @@ attributes #5 = { nounwind willreturn memory(none) }
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{i32 7, !"frame-pointer", i32 2}
!5 = !{!"Ubuntu clang version 17.0.6 (++20231208085846+6009708b4367-1~exp1~20231208085949.74)"}
!5 = !{!"clang version 18.1.8 (https://github.com/llvm/llvm-project.git 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)"}
!6 = distinct !{!6, !7}
!7 = !{!"llvm.loop.mustprogress"}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; ModuleID = 'PE-benchmarks/Iterative_QuickSort.cpp'
source_filename = "PE-benchmarks/Iterative_QuickSort.cpp"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

module asm ".globl _ZSt21ios_base_library_initv"

Expand Down Expand Up @@ -133,7 +133,7 @@ define dso_local void @_Z18quickSortIterativePiii(ptr noundef %0, i32 noundef %1
%13 = sub nsw i32 %11, %12
%14 = add nsw i32 %13, 1
%15 = zext i32 %14 to i64
%16 = call ptr @llvm.stacksave()
%16 = call ptr @llvm.stacksave.p0()
store ptr %16, ptr %7, align 8
%17 = alloca i32, i64 %15, align 16
store i64 %15, ptr %8, align 8
Expand Down Expand Up @@ -233,15 +233,15 @@ define dso_local void @_Z18quickSortIterativePiii(ptr noundef %0, i32 noundef %1

80: ; preds = %28
%81 = load ptr, ptr %7, align 8
call void @llvm.stackrestore(ptr %81)
call void @llvm.stackrestore.p0(ptr %81)
ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave() #1
declare ptr @llvm.stacksave.p0() #1

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore(ptr) #1
declare void @llvm.stackrestore.p0(ptr) #1

; Function Attrs: mustprogress noinline uwtable
define dso_local void @_Z8printArrPii(ptr noundef %0, i32 noundef %1) #2 {
Expand Down Expand Up @@ -319,7 +319,7 @@ attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{i32 7, !"frame-pointer", i32 2}
!5 = !{!"Ubuntu clang version 17.0.6 (++20231208085846+6009708b4367-1~exp1~20231208085949.74)"}
!5 = !{!"clang version 18.1.8 (https://github.com/llvm/llvm-project.git 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)"}
!6 = distinct !{!6, !7}
!7 = !{!"llvm.loop.mustprogress"}
!8 = distinct !{!8, !7}
Expand Down
Loading

0 comments on commit 455b1c1

Please sign in to comment.