Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Build LLVM/Clang from source and cache result when matrix.debug_build == true #662

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
197d020
Add Build LLVM/Clang from source and cache result when matrix.debug_b…
alexander-penev Nov 27, 2023
715989c
Fix ci.yaml syntax
alexander-penev Nov 27, 2023
2680cfa
Fix ci.yaml syntax
alexander-penev Nov 27, 2023
ae36b0b
Fix ci.yaml syntax
alexander-penev Nov 27, 2023
8af93d0
Fix ci.yaml syntax
alexander-penev Nov 27, 2023
afc6748
Fix ci.yaml
alexander-penev Nov 28, 2023
97dbe8d
Fix ci.yaml
alexander-penev Nov 28, 2023
be9328d
Fix ci.yaml
alexander-penev Nov 28, 2023
d897b83
Fix ci.yaml
alexander-penev Nov 28, 2023
312246a
Fix ci.yaml
alexander-penev Nov 28, 2023
70699b6
Fix ci.yaml
alexander-penev Nov 28, 2023
58a8f58
Fix ci.yaml
alexander-penev Nov 28, 2023
5f31015
Fix ci.yaml
alexander-penev Nov 28, 2023
bd960af
Fix ci.yaml
alexander-penev Nov 28, 2023
e5f0e2d
Add assertion clause in failed tests
alexander-penev Nov 28, 2023
53d4a95
Add assertion clause in failed tests
alexander-penev Nov 28, 2023
dfac31e
Fix lit config
alexander-penev Nov 28, 2023
209bcad
Fix lit config
alexander-penev Nov 28, 2023
29506a1
Fix lit config
alexander-penev Nov 29, 2023
dac59bc
Fix lit config
alexander-penev Nov 29, 2023
dfbbc7a
Fix assert and debug features
alexander-penev Nov 29, 2023
4ef015a
Remove tmate long wait
alexander-penev Nov 30, 2023
cc88c41
Cleanup and simplify
alexander-penev Nov 30, 2023
613f5ed
Fix pass params to llvm-config
alexander-penev Nov 30, 2023
32f68ff
Fix pass params to llvm-config
alexander-penev Nov 30, 2023
90fc868
Fix pass params to llvm-config
alexander-penev Nov 30, 2023
213de7b
Fix pass params to llvm-config
alexander-penev Nov 30, 2023
14e39c2
Fix pass params to llvm-config
alexander-penev Nov 30, 2023
c44a83a
Fix pass params to llvm-config
alexander-penev Nov 30, 2023
ea41635
Fix pass params to llvm-config
alexander-penev Nov 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 74 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ jobs:
os: ubuntu-20.04
compiler: gcc-9
clang-runtime: '12'

- name: ubu20-clang8-runtime12
os: ubuntu-20.04
compiler: clang-8
Expand Down Expand Up @@ -381,6 +382,12 @@ jobs:
compiler: clang-15
clang-runtime: '16'

- name: ubu22-clang15-runtime16-debug
os: ubuntu-22.04
compiler: clang-15
clang-runtime: '16'
debug_build: true

steps:
- uses: actions/checkout@v3
with:
Expand All @@ -401,11 +408,15 @@ jobs:
name: pr
path: pr/
- uses: nelonoel/[email protected]
- name: Setup default Build Type on *nux
if: runner.os != 'windows'
- name: Setup default Build Type on *nux (coverity)
if: ${{ (matrix.debug_build != true) && (runner.os != 'windows') }}
run: |
echo "BUILD_TYPE=Release" >> $GITHUB_ENV
echo "CODE_COVERAGE=0" >> $GITHUB_ENV
- name: Setup default Build Type on *nux (build_debug & asserts)
if: ${{ (matrix.debug_build == true) && (runner.os != 'windows') }}
run: |
echo "BUILD_TYPE=Debug" >> $GITHUB_ENV
- name: Setup default Build Type on Windows
if: runner.os == 'windows'
run: |
Expand Down Expand Up @@ -546,8 +557,65 @@ jobs:
done
# We need PATH_TO_LLVM_BUILD later
echo "PATH_TO_LLVM_BUILD=$PATH_TO_LLVM_BUILD" >> $GITHUB_ENV

- name: Restore Cache LLVM/Clang runtime build directory (debug_build==true)
if: ${{ (matrix.debug_build == true) && (runner.os != 'windows') }}
uses: actions/cache/restore@v3
id: cache
with:
path: |
llvm-project
key: ${{ matrix.os }}-clang-${{ matrix.clang-runtime }}.x-${{ env.BUILD_TYPE }}
- name: Build LLVM/Cling on Unix if the cache is invalid (debug_build==true)
if: ${{ (matrix.debug_build == true) && (runner.os != 'windows') && (steps.cache.outputs.cache-hit != 'true') }}
run: |
os="${{ matrix.os }}"
git clone --depth=1 -b release/${{ matrix.clang-runtime }}.x https://github.com/llvm/llvm-project.git
cd llvm-project
# Build
mkdir build
cd build
export CPU_COUNT="$(nproc --all)"
cmake \
-DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_TARGETS_TO_BUILD="host;NVPTX" \
-DCMAKE_BUILD_TYPE=`[[ -z "$BUILD_TYPE" ]] && echo RelWithDebInfo || echo $BUILD_TYPE` \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCLANG_ENABLE_STATIC_ANALYZER=OFF \
-DCLANG_ENABLE_ARCMT=OFF \
-DCLANG_ENABLE_FORMAT=OFF \
-DCLANG_ENABLE_BOOTSTRAP=OFF \
-DLLVM_ENABLE_TERMINFO=OFF \
-DCLANG_INCLUDE_TESTS=OFF \
-DCLANG_INCLUDE_DOCS=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_INCLUDE_DOCS=OFF \
../llvm
cmake --build . --target clang FileCheck llvm-config --parallel ${CPU_COUNT}
cd ../../
- name: Save Cache LLVM/Clang runtime build directory (debug_build==true)
uses: actions/cache/save@v3
if: ${{ (matrix.debug_build == true) && (runner.os != 'windows') && (steps.cache.outputs.cache-hit != 'true') }}
with:
path: |
llvm-project
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Set LLVM/Cling build path on Unix (debug_build==true)
if: ${{ (matrix.debug_build == true) && (runner.os != 'windows') }}
run: |
export PATH_TO_LLVM_BUILD="$PWD/llvm-project/build"
echo "PATH_TO_LLVM_BUILD=$PATH_TO_LLVM_BUILD"
echo "PATH_TO_LLVM_BUILD=$PATH_TO_LLVM_BUILD" >> $GITHUB_ENV
pip3 install lit # LLVM lit is not part of the llvm releases...
vers="${compiler#*-}"
if [[ ! -f "$PATH_TO_LLVM_BUILD/bin/FileCheck" ]]; then
ln -s /usr/bin/FileCheck-$vers $PATH_TO_LLVM_BUILD/bin/FileCheck
fi
env:
compiler: ${{ matrix.compiler }}

- name: Setup LLVM/Clang on Linux
if: runner.os == 'Linux'
if: ${{ (runner.os == 'Linux') && (matrix.debug_build != true) }}
run: |
UNIX_DISTRO=$(lsb_release -rs)
PATH_TO_LLVM_BUILD=/usr/lib/llvm-${{ matrix.clang-runtime }}/
Expand All @@ -564,7 +632,7 @@ jobs:
# We need PATH_TO_LLVM_BUILD later
echo "PATH_TO_LLVM_BUILD=$PATH_TO_LLVM_BUILD" >> $GITHUB_ENV
- name: Setup LLVM/Clang on Windows
if: runner.os == 'windows'
if: ${{ runner.os == 'windows' }}
run: |
C:\Miniconda\condabin\conda.bat install -y -c conda-forge "clangdev=${{ matrix.clang-runtime }}"
$env:PATH_TO_LLVM_BUILD="$env:CONDA\Library"
Expand Down Expand Up @@ -593,7 +661,7 @@ jobs:
echo "CODE_COVERAGE=1" >> $GITHUB_ENV
echo "BUILD_TYPE=Debug" >> $GITHUB_ENV
- name: Display config *nix
if: runner.os != 'windows'
if: ${{ runner.os != 'windows' }}
run: |
cmake --version
$CC --version
Expand All @@ -604,7 +672,7 @@ jobs:
echo "Building clad in `[[ -z "$BUILD_TYPE" ]] && echo RelWithDebInfo || echo $BUILD_TYPE`"
python3 --version
- name: Display config Windows
if: runner.os == 'windows'
if: ${{ runner.os == 'windows' }}
run: |
cmake --version
echo "CC=$env:CC"
Expand Down
2 changes: 2 additions & 0 deletions test/Arrays/ArrayInputsReverseMode.C
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// RUN: %cladclang %s -I%S/../../include -Wno-unused-value -oArrayInputsReverseMode.out 2>&1 | FileCheck %s
// RUN: ./ArrayInputsReverseMode.out | FileCheck -check-prefix=CHECK-EXEC %s

// XFAIL: asserts

//CHECK-NOT: {{.*error|warning|note:.*}}

#include "clad/Differentiator/Differentiator.h"
Expand Down
2 changes: 2 additions & 0 deletions test/Arrays/ArrayInputsVectorForwardMode.C
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// RUN: %cladclang %s -I%S/../../include -oArrayInputsVectorForwardMode.out 2>&1 | FileCheck %s
// RUN: ./ArrayInputsVectorForwardMode.out | FileCheck -check-prefix=CHECK-EXEC %s

// XFAIL: asserts

// CHECK-NOT: {{.*error|warning|note:.*}}

#include "clad/Differentiator/Differentiator.h"
Expand Down
1 change: 1 addition & 0 deletions test/FirstDerivative/Overloads.C
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// RUN: %cladclang %s -I%S/../../include -oOverloads.out 2>&1 | FileCheck %s
// RUN: ./Overloads.out | FileCheck -check-prefix=CHECK-EXEC %s
// XFAIL: asserts
//CHECK-NOT: {{.*error|warning|note:.*}}

#include "clad/Differentiator/Differentiator.h"
Expand Down
1 change: 1 addition & 0 deletions test/FirstDerivative/VirtualMethodsCall.C
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// RUN: %cladclang %s -I%S/../../include -oVirtualMethodsCall.out 2>&1 | FileCheck %s
// RUN: ./VirtualMethodsCall.out | FileCheck -check-prefix=CHECK-EXEC %s
// XFAIL: asserts
//CHECK-NOT: {{.*error|warning|note:.*}}

#include "clad/Differentiator/Differentiator.h"
Expand Down
2 changes: 2 additions & 0 deletions test/ForwardMode/UserDefinedTypes.C
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// RUN: %cladclang %s -I%S/../../include -oUserDefinedTypes.out | FileCheck %s
// RUN: ./UserDefinedTypes.out | FileCheck -check-prefix=CHECK-EXEC %s

// XFAIL: asserts

// CHECK-NOT: {{.*error|warning|note:.*}}

#include "clad/Differentiator/Differentiator.h"
Expand Down
2 changes: 2 additions & 0 deletions test/ForwardMode/VectorMode.C
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// RUN: %cladclang %s -I%S/../../include -oVectorMode.out 2>&1 | FileCheck %s
// RUN: ./VectorMode.out | FileCheck -check-prefix=CHECK-EXEC %s

// XFAIL: asserts

//CHECK-NOT: {{.*error|warning|note:.*}}

#include "clad/Differentiator/Differentiator.h"
Expand Down
2 changes: 2 additions & 0 deletions test/ForwardMode/VectorModeInterface.C
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// RUN: %cladclang %s -I%S/../../include -fsyntax-only -Xclang -verify 2>&1 | FileCheck %s

// XFAIL: asserts

//CHECK-NOT: {{.*error|warning|note:.*}}

#include "clad/Differentiator/Differentiator.h"
Expand Down
2 changes: 2 additions & 0 deletions test/Gradient/MemberFunctions.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// RUN: %cladclang -std=c++17 %s -fno-exceptions -I%S/../../include -oMemberFunctions-cpp17.out 2>&1 | FileCheck %s
// RUN: ./MemberFunctions-cpp17.out | FileCheck -check-prefix=CHECK-EXEC %s

// XFAIL: asserts

//CHECK-NOT: {{.*error|warning|note:.*}}
#include "clad/Differentiator/Differentiator.h"

Expand Down
1 change: 1 addition & 0 deletions test/Gradient/UserDefinedTypes.C
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// RUN: %cladclang %s -I%S/../../include -oUserDefinedTypes.out 2>&1 | FileCheck %s
// RUN: ./UserDefinedTypes.out | FileCheck -check-prefix=CHECK-EXEC %s
// XFAIL: asserts
// CHECK-NOT: {{.*error|warning|note:.*}}

#include "clad/Differentiator/Differentiator.h"
Expand Down
1 change: 1 addition & 0 deletions test/Misc/RunDemos.C
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// RUN: %cladclang %S/../../demos/RosenbrockFunction.cpp -I%S/../../include 2>&1
// RUN: %cladclang %S/../../demos/ComputerGraphics/smallpt/SmallPT.cpp -I%S/../../include 2>&1

// XFAIL: asserts

//-----------------------------------------------------------------------------/
// Demo: Gradient.cpp
Expand Down
12 changes: 11 additions & 1 deletion test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import os
import platform
import re

import lit.util
import lit.formats
import lit.util

from lit.llvm import llvm_config

# name: The name of this test suite.
config.name = 'clad'
Expand Down Expand Up @@ -322,3 +324,11 @@ if libcudart_path is not None:

if(config.have_enzyme):
config.available_features.add('Enzyme')

# Ask llvm-config about asserts and build mode
llvm_config.feature_config(
[
("--assertion-mode", {"ON": "asserts"}),
("--build-mode", {"[Dd][Ee][Bb][Uu][Gg]": "debug"}),
]
)
3 changes: 3 additions & 0 deletions test/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ except KeyError:
key, = e.args
lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))

import lit.llvm
lit.llvm.initialize(lit_config, config)

# Let the main config do the real work.
lit_config.load_config(config, "@CLAD_SOURCE_DIR@/test/lit.cfg")
Loading