Skip to content

Commit ea88cb0

Browse files
authored
Refactor compile and test buffer donation (#126)
* Format code * Delete `CompiledModule` and rename function to `compile_mlir!` * Refactor out MLIR `Context` preparation before `compile_mlir!` call * Refactor `compile` into smaller `codegen_*` and `compile_*` methods * Test preserved arguments in buffer donation tests * Fix rebase on top of #123 * Fix test * Add some comments * Add compiler hints to `traced_getfield` * Refactor `create_result` * Wrap "Compiler.jl" into a `Compiler` module * Refactor `compile` calls for `@compile` macrocalls * Fix imports * Fix `@compile` tests on broadcast * Refactor `@compile` calls for broadcasting syntax * Stop printing MLIR in `show` method for `TracedRArray` Segfaults if MLIR has not been correctly generated * Fix call to compiled function in Flux test * Import `compile` symbol to top-level * Fix function compilation in Lux test * Revert refactor to `@compile` on Lux test * Another fix for the Lux test * Revert refactor to `@compile` on benchmarks
1 parent aefba5a commit ea88cb0

File tree

13 files changed

+397
-291
lines changed

13 files changed

+397
-291
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function sinsum_add(x, y)
4444
return sum(sin.(x) .+ y)
4545
end
4646

47-
f=Reactant.compile(sinsum_add, (input1,input2))
47+
f= @compile sinsum_add(input1,input2)
4848

4949
# one can now run the program
5050
f(input1, input2)

benchmark/benchmarks.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ SUITE["comptime"]["basics"]["Basic cos"] = @benchmarkable Reactant.compile(cos,
2626
SUITE["comptime"]["lux neural networks"] = BenchmarkGroup()
2727

2828
for depth in [11, 13, 16, 19]
29-
SUITE["comptime"]["lux neural networks"]["vgg$depth"] = @benchmarkable begin
30-
Reactant.compile(vgg, (x, ps_concrete, st_concrete))
31-
end setup = begin
29+
SUITE["comptime"]["lux neural networks"]["vgg$depth"] = @benchmarkable Reactant.compile(
30+
vgg, (x, ps_concrete, st_concrete)
31+
) setup = begin
3232
vgg = Vision.VGG($depth; pretrained=false, batchnorm=false)
3333
ps, st = Lux.setup(Random.default_rng(), vgg)
3434
ps_concrete = Reactant.to_rarray(ps)

0 commit comments

Comments
 (0)