Skip to content

Commit

Permalink
optimized builds
Browse files Browse the repository at this point in the history
  • Loading branch information
yretenai committed Sep 29, 2023
1 parent 42e5c2e commit b19255d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build-rivet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
build:
strategy:
matrix:
type: [release, custom]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -52,7 +53,7 @@ jobs:
run: |
mkdir build
cd build
meson setup ..
meson setup .. --buildtype=${{matrix.type}}
cd ..
- name: Fix Ninja script for LLVM on Windows
if: runner.os == 'Windows'
Expand All @@ -67,5 +68,5 @@ jobs:
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: build-${{matrix.os}}
name: rivet-${{runner.os}}-${{matrix.type}}
path: build/staging
32 changes: 20 additions & 12 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -67,43 +67,51 @@ cpp_args = compiler.get_supported_arguments(
)

if get_option('buildtype') == 'custom'
cpp_args += compiler.get_supported_arguments(
'-march=native',
'-mtune=native',
opt_args = compiler.get_supported_arguments(
'-march=knl',
'-mtune=knl',
'-fopenmp'
)

if compiler.get_id() == 'clang'
add_project_arguments('-Ofast', language: 'cpp')

if compiler.compiles('void test() { }', name: 'has polly', args: ['-mllvm', '-polly'])
cpp_args += ['-mllvm', '-polly']
opt_args += ['-mllvm', '-polly']

if compiler.compiles('void test() { }', name: 'has polly vectorizer', args: ['-mllvm', '-polly-vectorizer=stripmine'])
cpp_args += ['-mllvm', '-polly-vectorizer=stripmine']
opt_args += ['-mllvm', '-polly-vectorizer=stripmine']
endif

if compiler.compiles('void test() { }', name: 'has polly parallel', args: ['-mllvm', '-polly-parallel'])
cpp_args += ['-mllvm', '-polly-parallel']
opt_args += ['-mllvm', '-polly-parallel']
endif

if compiler.compiles('void test() { }', name: 'has polly omp backend', args: ['-mllvm', '-polly-omp-backend=LLVM'])
cpp_args += ['-mllvm', '-polly-omp-backend=LLVM']
opt_args += ['-mllvm', '-polly-omp-backend=LLVM']
endif

if compiler.compiles('void test() { }', name: 'has polly num threads', args: ['-mllvm', '-polly-num-threads=24'])
cpp_args += ['-mllvm', '-polly-num-threads=24']
opt_args += ['-mllvm', '-polly-num-threads=24']
endif

if compiler.compiles('void test() { }', name: 'has polly scheduling', args: ['-mllvm', '-polly-scheduling=dynamic'])
cpp_args += ['-mllvm', '-polly-scheduling=dynamic']
opt_args += ['-mllvm', '-polly-scheduling=dynamic']
endif

if compiler.compiles('void test() { }', name: 'has polly scheduling chunksize', args: ['-mllvm', '-polly-scheduling-chunksize=1'])
cpp_args += ['-mllvm', '-polly-scheduling-chunksize=1']
opt_args += ['-mllvm', '-polly-scheduling-chunksize=1']
endif

add_project_arguments('-O3', language: 'cpp')
endif
else
if compiler.get_id() == 'msvc'
opt_args += ['/Ox']
else
opt_args += ['-O2']
endif
endif

add_global_arguments(opt_args, language: 'cpp')
endif

add_project_arguments(cpp_args, language: 'cpp')
Expand Down

0 comments on commit b19255d

Please sign in to comment.