From 412ac5d9268dff680dfd2b70ceb51fe9bb01397a Mon Sep 17 00:00:00 2001 From: Schrodinger ZHU Yifan Date: Mon, 2 Dec 2024 13:28:17 -0500 Subject: [PATCH 01/11] [gccjit] try build with trunk --- .github/workflows/build-gccjit-trunk.yml | 56 ++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/build-gccjit-trunk.yml diff --git a/.github/workflows/build-gccjit-trunk.yml b/.github/workflows/build-gccjit-trunk.yml new file mode 100644 index 0000000..fb9b89f --- /dev/null +++ b/.github/workflows/build-gccjit-trunk.yml @@ -0,0 +1,56 @@ +name: Build (gccjit-trunk) +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-24.04 + env: + LLVM_DIR: /usr/lib/llvm-18/cmake + steps: + - uses: actions/checkout@v4 + + - name: Install build tools and libraries + run: | + sudo apt-get update + sudo apt-get install -y gcc-14 g++-14 gcc-14-multilib cmake ninja-build llvm-18-dev llvm-18-tools \ + libmlir-18-dev mlir-18-tools python3 python3-pip build-essential \ + libmpfr-dev libmpc-dev libgmp-dev flex bison libbison-dev + pip install lit + + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.6 + + - name: Build GCCJIT + run: | + git clone --depth=1 https://github.com/gcc-mirror/gcc + mkdir gcc-build + mkdir gcc-install + export PREFIX=$(pwd)/gcc-install + export SCCACHE_GHA_ENABLED=true + cd gcc-build + ../gcc/configure CC='sccache gcc-14' CXX='sccache g++-14' \ + --enable-host-shared \ + --enable-languages=jit,c++ \ + --disable-bootstrap \ + --enable-checking=release \ + --prefix=$PREFIX + make -j$(nproc) + make install + echo "GCCJIT_ROOT=$PREFIX" >> $GITHUB_ENV + + + - name: Build + run: | + export SCCACHE_GHA_ENABLED=true + cmake -B build -G Ninja \ + -DGCCJIT_ROOT=${GCCJIT_ROOT} \ + -DCMAKE_C_COMPILER_LAUNCHER=sccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ + -DCMAKE_C_COMPILER=gcc-14 \ + -DCMAKE_CXX_COMPILER=g++-14 . + cmake --build build + cmake --build build --target gccjit-tools + + - name: Run tests + run: | + cmake --build build --target check From 937e9b9fa55f81c6688ef2402d3585bc7972cffb Mon Sep 17 00:00:00 2001 From: Schrodinger ZHU Yifan Date: Mon, 2 Dec 2024 13:50:31 -0500 Subject: [PATCH 02/11] [gccjit] record hash --- .github/workflows/build-gccjit-trunk.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-gccjit-trunk.yml b/.github/workflows/build-gccjit-trunk.yml index fb9b89f..abcfdbb 100644 --- a/.github/workflows/build-gccjit-trunk.yml +++ b/.github/workflows/build-gccjit-trunk.yml @@ -22,7 +22,10 @@ jobs: - name: Build GCCJIT run: | - git clone --depth=1 https://github.com/gcc-mirror/gcc + git clone https://github.com/gcc-mirror/gcc + pushd gcc + git checkout 4df8e6fc0cbc8358f88e81bb64b790af2a848a35 + popd mkdir gcc-build mkdir gcc-install export PREFIX=$(pwd)/gcc-install From fbb98a8a4a28853fb25fcc0865a4e2ec78af0db4 Mon Sep 17 00:00:00 2001 From: Schrodinger ZHU Yifan Date: Mon, 2 Dec 2024 14:00:52 -0500 Subject: [PATCH 03/11] [gccjit] fix jit version and minor fix for code --- src/Translation/TranslateToGCCJIT.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Translation/TranslateToGCCJIT.cpp b/src/Translation/TranslateToGCCJIT.cpp index cacd625..2a4bab0 100644 --- a/src/Translation/TranslateToGCCJIT.cpp +++ b/src/Translation/TranslateToGCCJIT.cpp @@ -991,7 +991,7 @@ gcc_jit_rvalue *RegionVisitor::visitExprWithoutCache(AlignOfOp op) { if (resTy.getKind() != GCC_JIT_TYPE_INT) align = gcc_jit_context_new_cast(getContext(), loc, align, resTyHandle); return align; -#endif +#else auto type = op.getType(); auto *typeHandle = getTranslator().convertType(type); auto *resTyHandle = getTranslator().convertType(op.getResult().getType()); @@ -1018,6 +1018,7 @@ gcc_jit_rvalue *RegionVisitor::visitExprWithoutCache(AlignOfOp op) { return gcc_jit_context_new_cast(getContext(), nullptr, fakeFieldAddrValue, resTyHandle); return fakeFieldAddrValue; +#endif } gcc_jit_rvalue *RegionVisitor::visitExprWithoutCache(AsRValueOp op) { From 151761fc86947030dadabef0bdd532a7bd29a5f6 Mon Sep 17 00:00:00 2001 From: Schrodinger ZHU Yifan Date: Mon, 2 Dec 2024 14:05:39 -0500 Subject: [PATCH 04/11] [gccjit] revert to depth=1 --- .github/workflows/build-gccjit-trunk.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build-gccjit-trunk.yml b/.github/workflows/build-gccjit-trunk.yml index abcfdbb..0ae8c61 100644 --- a/.github/workflows/build-gccjit-trunk.yml +++ b/.github/workflows/build-gccjit-trunk.yml @@ -22,10 +22,7 @@ jobs: - name: Build GCCJIT run: | - git clone https://github.com/gcc-mirror/gcc - pushd gcc - git checkout 4df8e6fc0cbc8358f88e81bb64b790af2a848a35 - popd + git clone https://github.com/gcc-mirror/gcc --depth 1 mkdir gcc-build mkdir gcc-install export PREFIX=$(pwd)/gcc-install From ef28fc3dde4b312edb994f8697aa4605c3349bd5 Mon Sep 17 00:00:00 2001 From: Schrodinger ZHU Yifan Date: Mon, 2 Dec 2024 14:29:05 -0500 Subject: [PATCH 05/11] [gccjit] disable multilib gcc --- .github/workflows/build-gccjit-trunk.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-gccjit-trunk.yml b/.github/workflows/build-gccjit-trunk.yml index 0ae8c61..a246b4f 100644 --- a/.github/workflows/build-gccjit-trunk.yml +++ b/.github/workflows/build-gccjit-trunk.yml @@ -29,6 +29,7 @@ jobs: export SCCACHE_GHA_ENABLED=true cd gcc-build ../gcc/configure CC='sccache gcc-14' CXX='sccache g++-14' \ + --disable-multilib \ --enable-host-shared \ --enable-languages=jit,c++ \ --disable-bootstrap \ From bfc5f97d59683c4ffeb656477e42d77bc05f1cf5 Mon Sep 17 00:00:00 2001 From: Schrodinger ZHU Yifan Date: Mon, 2 Dec 2024 14:45:22 -0500 Subject: [PATCH 06/11] [gccjit] conditionally trigger the build with label --- .github/workflows/build-gccjit-trunk.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-gccjit-trunk.yml b/.github/workflows/build-gccjit-trunk.yml index a246b4f..aeba82e 100644 --- a/.github/workflows/build-gccjit-trunk.yml +++ b/.github/workflows/build-gccjit-trunk.yml @@ -1,9 +1,10 @@ name: Build (gccjit-trunk) -on: [push, pull_request] +on: [push, pull_request, labeled] jobs: build: runs-on: ubuntu-24.04 + if: contains(github.event.issue.labels.*.name, 'check-gcc-trunk') env: LLVM_DIR: /usr/lib/llvm-18/cmake steps: From 4c9b852b7a1f50ce41086f5fa8a8da70d0cf3b71 Mon Sep 17 00:00:00 2001 From: Schrodinger ZHU Yifan Date: Mon, 2 Dec 2024 14:48:31 -0500 Subject: [PATCH 07/11] [gccjit] still need to build multilib --- .github/workflows/build-gccjit-trunk.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-gccjit-trunk.yml b/.github/workflows/build-gccjit-trunk.yml index aeba82e..cd0db1e 100644 --- a/.github/workflows/build-gccjit-trunk.yml +++ b/.github/workflows/build-gccjit-trunk.yml @@ -30,7 +30,6 @@ jobs: export SCCACHE_GHA_ENABLED=true cd gcc-build ../gcc/configure CC='sccache gcc-14' CXX='sccache g++-14' \ - --disable-multilib \ --enable-host-shared \ --enable-languages=jit,c++ \ --disable-bootstrap \ From dd01c7f9764967497154ce30938c247b2100f7a8 Mon Sep 17 00:00:00 2001 From: Schrodinger ZHU Yifan Date: Mon, 2 Dec 2024 14:55:01 -0500 Subject: [PATCH 08/11] [gccjit] fix label check --- .github/workflows/build-gccjit-trunk.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-gccjit-trunk.yml b/.github/workflows/build-gccjit-trunk.yml index cd0db1e..f53d5d8 100644 --- a/.github/workflows/build-gccjit-trunk.yml +++ b/.github/workflows/build-gccjit-trunk.yml @@ -1,5 +1,8 @@ name: Build (gccjit-trunk) -on: [push, pull_request, labeled] +on: + push: + pull_request: + types: [labeled, synchronize, opened, reopened] jobs: build: From c6cf72a38e3b3bad67ae2faf316d6fa7c97ef2e6 Mon Sep 17 00:00:00 2001 From: Schrodinger ZHU Yifan Date: Mon, 2 Dec 2024 14:59:33 -0500 Subject: [PATCH 09/11] [gccjit] fix label check --- .github/workflows/build-gccjit-trunk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-gccjit-trunk.yml b/.github/workflows/build-gccjit-trunk.yml index f53d5d8..212c02c 100644 --- a/.github/workflows/build-gccjit-trunk.yml +++ b/.github/workflows/build-gccjit-trunk.yml @@ -7,7 +7,7 @@ on: jobs: build: runs-on: ubuntu-24.04 - if: contains(github.event.issue.labels.*.name, 'check-gcc-trunk') + if: contains(github.event.pull_request.labels.*.name, 'check-gcc-trunk') env: LLVM_DIR: /usr/lib/llvm-18/cmake steps: From b4ca4b35d7f448b790087fdd17a5768e1b8adfe7 Mon Sep 17 00:00:00 2001 From: Schrodinger ZHU Yifan Date: Mon, 2 Dec 2024 15:30:44 -0500 Subject: [PATCH 10/11] [gccjit] mock env for testing --- .github/workflows/build-gccjit-trunk.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-gccjit-trunk.yml b/.github/workflows/build-gccjit-trunk.yml index 212c02c..7d6acfe 100644 --- a/.github/workflows/build-gccjit-trunk.yml +++ b/.github/workflows/build-gccjit-trunk.yml @@ -33,6 +33,7 @@ jobs: export SCCACHE_GHA_ENABLED=true cd gcc-build ../gcc/configure CC='sccache gcc-14' CXX='sccache g++-14' \ + --disable-multilib \ --enable-host-shared \ --enable-languages=jit,c++ \ --disable-bootstrap \ @@ -57,4 +58,5 @@ jobs: - name: Run tests run: | + sudo ln -s /usr/lib/x86_64-linux-gnu /usr/lib64 cmake --build build --target check From 3864f2ab64de9b1e55b18316ba0856ea208ae31d Mon Sep 17 00:00:00 2001 From: Schrodinger ZHU Yifan Date: Mon, 2 Dec 2024 16:45:58 -0500 Subject: [PATCH 11/11] [gccjit] mock env for testing --- .github/workflows/build-gccjit-trunk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-gccjit-trunk.yml b/.github/workflows/build-gccjit-trunk.yml index 7d6acfe..3953279 100644 --- a/.github/workflows/build-gccjit-trunk.yml +++ b/.github/workflows/build-gccjit-trunk.yml @@ -58,5 +58,5 @@ jobs: - name: Run tests run: | - sudo ln -s /usr/lib/x86_64-linux-gnu /usr/lib64 + sudo ln -sf /usr/lib/gcc/x86_64-linux-gnu/14/* /usr/lib64 cmake --build build --target check