Skip to content

Commit 1be9bc4

Browse files
Fix allocations on 1.4 (#142)
One of the tests seems to be broken. We're leaving it for now as an `@test_broken`. * @allocated -> @ballocated * Bump patch * Requires BenchmarkTools 0.5 * Update test/differentials/composite.jl Co-Authored-By: Lyndon White <[email protected]> Co-authored-by: Lyndon White <[email protected]>
1 parent 838e444 commit 1be9bc4

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ julia:
1212
jobs:
1313
allow_failures:
1414
- julia: nightly
15-
- julia: 1.4
1615
include:
1716
- stage: "Documentation"
1817
julia: 1

Project.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
name = "ChainRulesCore"
22
uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
3-
version = "0.7.2"
3+
version = "0.7.3"
44

55
[deps]
66
MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221"
77

88
[compat]
9+
BenchmarkTools = "0.5"
910
MuladdMacro = "0.2.1"
1011
StaticArrays = "0.11, 0.12"
1112
julia = "^1.0"
1213

1314
[extras]
15+
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
1416
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1517
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1618
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1719

1820
[targets]
19-
test = ["Test", "LinearAlgebra", "StaticArrays"]
21+
test = ["Test", "BenchmarkTools", "LinearAlgebra", "StaticArrays"]

test/differentials/composite.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ end
107107
@testset "Structs" begin
108108
@test Foo(3.5, 1.5) + Composite{Foo}(x=2.5) == Foo(6.0, 1.5)
109109
@test Composite{Foo}(x=2.5) + Foo(3.5, 1.5) == Foo(6.0, 1.5)
110-
@test (@allocated Bar(0.5) + Composite{Bar}(; x=0.5)) == 0
110+
@test (@ballocated Bar(0.5) + Composite{Bar}(; x=0.5)) == 0
111111
end
112112

113113
@testset "Tuples" begin
@@ -177,8 +177,10 @@ end
177177

178178
@testset "Internals don't allocate a ton" begin
179179
bk = (; x=1.0, y=2.0)
180-
@test (@allocated(ChainRulesCore.construct(Foo, bk))) <= 32
181-
@test (@allocated ChainRulesCore.elementwise_add(bk, bk)) <= 48
180+
@test_broken (@ballocated(ChainRulesCore.construct($Foo, $bk))) <= 32
181+
# weaker version of the above (which should pass, but make sure not failing too bad)
182+
@test (@ballocated(ChainRulesCore.construct($Foo, $bk))) <= 48
183+
@test (@ballocated ChainRulesCore.elementwise_add($bk, $bk)) <= 48
182184
end
183185
end
184186

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Base.Broadcast: broadcastable
2+
using BenchmarkTools
23
using ChainRulesCore
34
using LinearAlgebra: Diagonal
45
using Test

0 commit comments

Comments
 (0)