Skip to content

Commit 32d4106

Browse files
authored
Merge pull request #76 from brenhinkeller/master
Add more integration tests, reorganize CI, update to GPUCompiler 0.16
2 parents 0cfcfdc + e9a6b69 commit 32d4106

20 files changed

Lines changed: 1156 additions & 335 deletions

.github/workflows/CompatHelper.yml

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,16 @@
11
name: CompatHelper
2-
32
on:
43
schedule:
5-
- cron: '0 1 * * *'
6-
issues:
7-
types: [opened, reopened]
8-
4+
- cron: 0 0 * * 0
5+
workflow_dispatch:
96
jobs:
10-
build:
11-
runs-on: ${{ matrix.os }}
12-
strategy:
13-
matrix:
14-
julia-version: [1.3.1]
15-
julia-arch: [x64]
16-
os: [ubuntu-latest]
7+
CompatHelper:
8+
runs-on: ubuntu-latest
179
steps:
18-
- uses: julia-actions/setup-julia@latest
19-
with:
20-
version: ${{ matrix.julia-version }}
21-
- name: Install dependencies
22-
run: julia -e 'using Pkg; Pkg.add(Pkg.PackageSpec(name = "CompatHelper", url = "https://github.com/bcbi/CompatHelper.jl.git"))'
23-
- name: CompatHelper.main
10+
- name: Pkg.add("CompatHelper")
11+
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
12+
- name: CompatHelper.main()
2413
env:
2514
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26-
JULIA_DEBUG: CompatHelper
15+
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
2716
run: julia -e 'using CompatHelper; CompatHelper.main()'
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI (Integration nightly)
2+
on:
3+
push:
4+
branches:
5+
- '**'
6+
paths-ignore:
7+
- 'README.md'
8+
pull_request:
9+
branches:
10+
- master
11+
paths-ignore:
12+
- 'README.md'
13+
jobs:
14+
test-integration-nightly:
15+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
version:
21+
- 'nightly'
22+
os:
23+
- ubuntu-latest
24+
- macOS-latest
25+
arch:
26+
- x64
27+
group:
28+
- Integration
29+
steps:
30+
- uses: actions/checkout@v2
31+
- uses: julia-actions/setup-julia@latest
32+
with:
33+
version: ${{ matrix.version }}
34+
arch: ${{ matrix.arch }}
35+
- uses: julia-actions/julia-buildpkg@latest
36+
- uses: julia-actions/julia-runtest@latest
37+
env:
38+
GROUP: ${{ matrix.group }}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI (Integration)
2+
on:
3+
push:
4+
branches:
5+
- '**'
6+
paths-ignore:
7+
- 'README.md'
8+
pull_request:
9+
branches:
10+
- master
11+
paths-ignore:
12+
- 'README.md'
13+
jobs:
14+
test-integration:
15+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
version:
21+
- '~1.8.0-0'
22+
os:
23+
- ubuntu-latest
24+
- macOS-latest
25+
arch:
26+
- x64
27+
group:
28+
- Integration
29+
steps:
30+
- uses: actions/checkout@v2
31+
- uses: julia-actions/setup-julia@latest
32+
with:
33+
version: ${{ matrix.version }}
34+
arch: ${{ matrix.arch }}
35+
- uses: julia-actions/julia-buildpkg@latest
36+
- uses: julia-actions/julia-runtest@latest
37+
env:
38+
GROUP: ${{ matrix.group }}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI (Julia nightly)
2+
on:
3+
push:
4+
branches:
5+
- '**'
6+
paths-ignore:
7+
- 'README.md'
8+
pull_request:
9+
branches:
10+
- master
11+
paths-ignore:
12+
- 'README.md'
13+
jobs:
14+
test-julia-nightly:
15+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
version:
21+
- 'nightly'
22+
os:
23+
- ubuntu-latest
24+
- macOS-latest
25+
arch:
26+
- x64
27+
group:
28+
- Core
29+
steps:
30+
- uses: actions/checkout@v2
31+
- uses: julia-actions/setup-julia@latest
32+
with:
33+
version: ${{ matrix.version }}
34+
arch: ${{ matrix.arch }}
35+
- uses: julia-actions/julia-buildpkg@latest
36+
- uses: julia-actions/julia-runtest@latest
37+
env:
38+
GROUP: ${{ matrix.group }}

.github/workflows/ci.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
name: CI
22
on:
3-
- push
4-
- pull_request
3+
push:
4+
branches:
5+
- '**'
6+
paths-ignore:
7+
- 'README.md'
8+
pull_request:
9+
branches:
10+
- master
11+
paths-ignore:
12+
- 'README.md'
513
jobs:
614
test:
715
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
@@ -12,12 +20,13 @@ jobs:
1220
version:
1321
- '1.7'
1422
- '~1.8.0-0'
15-
- 'nightly'
1623
os:
1724
- ubuntu-latest
1825
- macOS-latest
1926
arch:
2027
- x64
28+
group:
29+
- Core
2130
steps:
2231
- uses: actions/checkout@v2
2332
- uses: julia-actions/setup-julia@latest
@@ -26,3 +35,9 @@ jobs:
2635
arch: ${{ matrix.arch }}
2736
- uses: julia-actions/julia-buildpkg@latest
2837
- uses: julia-actions/julia-runtest@latest
38+
env:
39+
GROUP: ${{ matrix.group }}
40+
- uses: julia-actions/julia-processcoverage@v1
41+
- uses: codecov/codecov-action@v2
42+
with:
43+
files: lcov.info

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/dev/
66
/test/standalone
77
/test/test.*
8+
Manifest.toml
89

910
test.o
1011
test.so

Project.toml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
1111
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
1212

1313
[compat]
14-
GPUCompiler = "0.13"
14+
GPUCompiler = "0.16"
1515
LLVM = "4.8"
1616
julia = "1.7"
17-
18-
[extras]
19-
Formatting = "59287772-0a20-5a39-b81b-1366585eb4c0"
20-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
21-
22-
[targets]
23-
test = ["Test", "Formatting"]

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# StaticCompiler
22

3-
[![CI](https://github.com/tshort/StaticCompiler.jl/actions/workflows/ci.yml/badge.svg)](https://github.com/tshort/StaticCompiler.jl/actions/workflows/ci.yml)
4-
[![Codecov](https://codecov.io/gh/tshort/StaticCompiler.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/tshort/StaticCompiler.jl)
3+
[![CI](https://github.com/tshort/StaticCompiler.jl/workflows/CI/badge.svg)](https://github.com/tshort/StaticCompiler.jl/actions/workflows/ci.yml)
4+
[![CI (Integration)](https://github.com/tshort/StaticCompiler.jl/workflows/CI%20(Integration)/badge.svg)](https://github.com/tshort/StaticCompiler.jl/actions/workflows/ci-integration.yml)
5+
[![CI (Julia nightly)](https://github.com/tshort/StaticCompiler.jl/workflows/CI%20(Julia%20nightly)/badge.svg)](https://github.com/tshort/StaticCompiler.jl/actions/workflows/ci-julia-nightly.yml)
6+
[![CI (Integration nightly)](https://github.com/tshort/StaticCompiler.jl/workflows/CI%20(Integration%20nightly)/badge.svg)](https://github.com/tshort/StaticCompiler.jl/actions/workflows/ci-integration-nightly.yml)
7+
[![Coverage](https://codecov.io/gh/tshort/StaticCompiler.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/tshort/StaticCompiler.jl)
58

69
This is an experimental package to compile Julia code to standalone libraries. A system image is not needed.
710

@@ -45,7 +48,7 @@ marked with `@test_skip`)
4548

4649
This package uses the [GPUCompiler package](https://github.com/JuliaGPU/GPUCompiler.jl) to generate code.
4750

48-
## Limitations
51+
## Limitations
4952

5053
* GC-tracked allocations and global variables do work with `compile`, but the way they are implemented is brittle and can be dangerous. Allocate with care.
5154
* GC-tracked allocations and global variables do *not* work with `compile_executable` (yet).

codecov.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
comment: false
2+
3+
coverage:
4+
status:
5+
project:
6+
default:
7+
threshold: 1%
8+
target: 1%
9+
patch:
10+
default:
11+
threshold: 1%
12+
target: 1%

src/StaticCompiler.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,9 @@ function generate_obj(f, tt, path::String = tempname(), name = GPUCompiler.safe_
141141
tm = GPUCompiler.llvm_machine(NativeCompilerTarget())
142142
job, kwargs = native_job(f, tt; name, kwargs...)
143143
#Get LLVM to generated a module of code for us. We don't want GPUCompiler's optimization passes.
144-
mod, meta = GPUCompiler.codegen(:llvm, job; strip=strip_llvm, only_entry=false, validate=false, optimize=false)
145-
144+
mod, meta = GPUCompiler.JuliaContext() do context
145+
GPUCompiler.codegen(:llvm, job; strip=strip_llvm, only_entry=false, validate=false, optimize=false, ctx=context)
146+
end
146147
# Use Enzyme's annotation and optimization pipeline
147148
annotate!(mod)
148149
optimize!(mod, tm)
@@ -230,7 +231,7 @@ function compile_executable(f, types=(), path::String="./", name=GPUCompiler.saf
230231
kwargs...)
231232

232233
tt = Base.to_tuple_type(types)
233-
tt == Tuple{} || tt == Tuple{Int, Ptr{Ptr{UInt8}}} || error("input type signature $types must be either () or (Int, Ptr{Ptr{UInt8}})")
234+
# tt == Tuple{} || tt == Tuple{Int, Ptr{Ptr{UInt8}}} || error("input type signature $types must be either () or (Int, Ptr{Ptr{UInt8}})")
234235

235236
rt = only(native_code_typed(f, tt))[2]
236237
isconcretetype(rt) || error("$f$types did not infer to a concrete type. Got $rt")
@@ -448,7 +449,9 @@ end
448449
# Return an LLVM module
449450
function native_llvm_module(f, tt, name = GPUCompiler.safe_name(repr(f)); kwargs...)
450451
job, kwargs = native_job(f, tt; name, kwargs...)
451-
m, _ = GPUCompiler.codegen(:llvm, job; strip=true, only_entry=false, validate=false)
452+
m, _ = GPUCompiler.JuliaContext() do context
453+
GPUCompiler.codegen(:llvm, job; strip=true, only_entry=false, validate=false, ctx=context)
454+
end
452455
return m
453456
end
454457

0 commit comments

Comments
 (0)