Skip to content

Commit b4fb31c

Browse files
github-actions[bot]CompatHelper JuliaCopilotyebaiwilltebbutt
authored
CompatHelper: bump compat for JET in [weakdeps] to 0.10, (keep existing compat) (#691)
* CompatHelper: bump compat for JET in [weakdeps] to 0.10, (keep existing compat) * Set tangent_type for AbstractLogger to NoTangent (#710) * Initial plan * Set tangent_type for Logging.ConsoleLogger to NoTangent Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Apply suggestions from code review Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> * Add ConsoleLogger test to verify AbstractLogger tangent type coverage Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Add Base.CoreLogging.SimpleLogger to type union Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> * Update test/tangents.jl Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> --------- Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Add better error messages for tangent accessors when types are passed (#707) * Initial plan * Add better error messages for tangent accessors when types are passed Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Hong Ge <hg344@cam.ac.uk> Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Tidy up (#715) * Tidy up error-generating methods * Remove redundant tests * Remove more redundant test cases * Bump patch version * add rule for complex logdet (#664) * working complex logdet * bump version * proper getrf! tests * improve tests * move tests * generalize tests * formatting and version --------- Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> Signed-off-by: Mateus Araújo <maltusan@gmail.com> Co-authored-by: Hong Ge <3279477+yebai@users.noreply.github.com> * Delete .github/copilot-instructions.md (#722) Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> * Uncomment b_binv_test_case for PlanarLayer (#727) Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> * Add DiffEq integration test for Mooncake (#726) * Initial plan * Add DiffEq integration test with original example from issue Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Finalize DiffEq integration test with comprehensive structure Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Remove @info and @test_broken statements to reduce clutter Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * fix formatting (#728) * Fix DiffEq integration test by restricting to reverse mode only (#731) * Initial plan * Fix DiffEq integration test by testing reverse mode only Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * formatting --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> Co-authored-by: Hong Ge <hg344@cam.ac.uk> * Fix IR docs duplication and improve documentation structure (#718) * Initial plan * Update IR docs title and remove duplication, add comparison section Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Address PR feedback: update title and simplify Optics reference Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Restore IRCode field details that were incorrectly removed Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Add robust Julia version-dependent JET version handling to CI workflow (#733) * Fix changelog version (#693) * remove `const M` (#696) * remove const M * fix formatting * Update Project.toml Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> --------- Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> * Update README.md (#697) Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> * minimal print io output (#699) * minimal print * vers bump * remove prev tests * include show in derived * Update algorithmic_differentiation.md (#703) I noticed a typo. I likely won't look at this again for a week or so, so please feel free to merge for me. Signed-off-by: Will Tebbutt <3628294+willtebbutt@users.noreply.github.com> * Fix 660 (#705) * Fix + tests * Bump patch version * Use _stable_typeof directly * Comment on the use of _stable_typeof * Extend arrayify for complex numbers (#706) * Fix + tests * Bump patch version * Use _stable_typeof directly * Add arrayify tests * Widen permitted types * Bump patch version again * Formatting * Uncomment blas tests * Create contribution guidelines in copilot-instructions.md (#713) Added contribution guidelines for the automatic differentiation package. Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> * Set tangent_type for AbstractLogger to NoTangent (#710) * Initial plan * Set tangent_type for Logging.ConsoleLogger to NoTangent Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Apply suggestions from code review Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> * Add ConsoleLogger test to verify AbstractLogger tangent type coverage Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Add Base.CoreLogging.SimpleLogger to type union Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> * Update test/tangents.jl Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> --------- Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Add better error messages for tangent accessors when types are passed (#707) * Initial plan * Add better error messages for tangent accessors when types are passed Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Hong Ge <hg344@cam.ac.uk> Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Tidy up (#715) * Tidy up error-generating methods * Remove redundant tests * Remove more redundant test cases * Bump patch version * add rule for complex logdet (#664) * working complex logdet * bump version * proper getrf! tests * improve tests * move tests * generalize tests * formatting and version --------- Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> Signed-off-by: Mateus Araújo <maltusan@gmail.com> Co-authored-by: Hong Ge <3279477+yebai@users.noreply.github.com> * Delete .github/copilot-instructions.md (#722) Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> * Uncomment b_binv_test_case for PlanarLayer (#727) Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> * Add DiffEq integration test for Mooncake (#726) * Initial plan * Add DiffEq integration test with original example from issue Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Finalize DiffEq integration test with comprehensive structure Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Remove @info and @test_broken statements to reduce clutter Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * fix formatting (#728) * Fix DiffEq integration test by restricting to reverse mode only (#731) * Initial plan * Fix DiffEq integration test by testing reverse mode only Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * formatting --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> Co-authored-by: Hong Ge <hg344@cam.ac.uk> * Fix IR docs duplication and improve documentation structure (#718) * Initial plan * Update IR docs title and remove duplication, add comparison section Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Address PR feedback: update title and simplify Optics reference Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Restore IRCode field details that were incorrectly removed Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Initial plan * Add Julia version-dependent JET version selection to CI workflow Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Improve JET version handling to support complex constraints and remove need for explicit version on Julia 1.12+ Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> * Apply suggestions from code review Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> * Update CI.yml Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> --------- Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> Signed-off-by: Will Tebbutt <3628294+willtebbutt@users.noreply.github.com> Signed-off-by: Mateus Araújo <maltusan@gmail.com> Co-authored-by: Penelope Yong <penelopeysm@gmail.com> Co-authored-by: Hong Ge <3279477+yebai@users.noreply.github.com> Co-authored-by: Astitva Aggarwal <84859349+AstitvaAggarwal@users.noreply.github.com> Co-authored-by: Will Tebbutt <3628294+willtebbutt@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Hong Ge <hg344@cam.ac.uk> Co-authored-by: Mateus Araújo <maltusan@gmail.com> --------- Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com> Signed-off-by: Mateus Araújo <maltusan@gmail.com> Signed-off-by: Will Tebbutt <3628294+willtebbutt@users.noreply.github.com> Co-authored-by: CompatHelper Julia <compathelper_noreply@julialang.org> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: yebai <3279477+yebai@users.noreply.github.com> Co-authored-by: Hong Ge <hg344@cam.ac.uk> Co-authored-by: Will Tebbutt <3628294+willtebbutt@users.noreply.github.com> Co-authored-by: Mateus Araújo <maltusan@gmail.com> Co-authored-by: Penelope Yong <penelopeysm@gmail.com> Co-authored-by: Astitva Aggarwal <84859349+AstitvaAggarwal@users.noreply.github.com>
1 parent 1507b4d commit b4fb31c

File tree

13 files changed

+183
-35
lines changed

13 files changed

+183
-35
lines changed

.github/copilot-instructions.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/CI.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,27 @@ jobs:
6969
arch: ${{ matrix.arch }}
7070
include-all-prereleases: false
7171
- uses: julia-actions/cache@v2
72+
- name: Adjust JET version based on Julia version
73+
run: |
74+
julia_version=$(julia --version | grep -oE '[0-9]+\.[0-9]+')
75+
echo "Detected Julia version: $julia_version"
76+
77+
# Remove any existing JET constraint from [compat] section
78+
sed -i '/^JET = "[0-9]\.[0-9]/d' Project.toml
79+
80+
# Compare version using version sort
81+
if printf '%s\n' "1.12" "$julia_version" | sort -V | head -n1 | grep -q "1.12"; then
82+
echo "Julia version >= 1.12, using latest JET version (no constraint)"
83+
else
84+
echo "Julia version < 1.12, setting JET = \"0.9\""
85+
# Add JET = "0.9" constraint in the [compat] section
86+
sed -i '/^\[compat\]/a JET = "0.9"' Project.toml
87+
fi
88+
89+
# Show the current JET constraint (if any)
90+
echo "Current JET constraint in Project.toml:"
91+
grep -A 20 "^\[compat\]" Project.toml | grep "JET = " || echo "No JET constraint found"
92+
shell: bash
7293
- uses: julia-actions/julia-buildpkg@v1
7394
- uses: julia-actions/julia-runtest@v1
7495
env:
@@ -96,6 +117,7 @@ jobs:
96117
{test_type: 'integration_testing', label: 'array'},
97118
{test_type: 'integration_testing', label: 'bijectors'},
98119
{test_type: 'integration_testing', label: 'diff_tests'},
120+
{test_type: 'integration_testing', label: 'diffeq'},
99121
{test_type: 'integration_testing', label: 'dispatch_doctor'},
100122
{test_type: 'integration_testing', label: 'distributions'},
101123
{test_type: 'integration_testing', label: 'dynamicppl'},
@@ -120,6 +142,27 @@ jobs:
120142
arch: ${{ matrix.arch }}
121143
include-all-prereleases: false
122144
- uses: julia-actions/cache@v2
145+
- name: Adjust JET version based on Julia version
146+
run: |
147+
julia_version=$(julia --version | grep -oE '[0-9]+\.[0-9]+')
148+
echo "Detected Julia version: $julia_version"
149+
150+
# Remove any existing JET constraint from [compat] section
151+
sed -i '/^JET = "[0-9]\.[0-9]/d' Project.toml
152+
153+
# Compare version using version sort
154+
if printf '%s\n' "1.12" "$julia_version" | sort -V | head -n1 | grep -q "1.12"; then
155+
echo "Julia version >= 1.12, using latest JET version (no constraint)"
156+
else
157+
echo "Julia version < 1.12, setting JET = \"0.9\""
158+
# Add JET = "0.9" constraint in the [compat] section
159+
sed -i '/^\[compat\]/a JET = "0.9"' Project.toml
160+
fi
161+
162+
# Show the current JET constraint (if any)
163+
echo "Current JET constraint in Project.toml:"
164+
grep -A 20 "^\[compat\]" Project.toml | grep "JET = " || echo "No JET constraint found"
165+
shell: bash
123166
- uses: julia-actions/julia-buildpkg@v1
124167
- run: |
125168
if [ ${{ matrix.test_group.test_type }} == 'ext' ]; then

Project.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Mooncake"
22
uuid = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
33
authors = ["Will Tebbutt, Hong Ge, and contributors"]
4-
version = "0.4.152"
4+
version = "0.4.154"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
@@ -61,20 +61,20 @@ FunctionWrappers = "1.1.3"
6161
GPUArraysCore = "0.1, 0.2"
6262
Graphs = "1"
6363
InteractiveUtils = "1"
64-
JET = "0.9"
64+
JET = "0.9, 0.10"
6565
JuliaFormatter = "1.0, 2.1"
6666
JuliaInterpreter = "0.9"
6767
LinearAlgebra = "1"
6868
LuxLib = "1"
69-
MistyClosures = "2"
7069
MLDataDevices = "1.10.0"
70+
MistyClosures = "2"
7171
NNlib = "0.9"
7272
Pkg = "1"
7373
Random = "1"
7474
SLEEFPirates = "0.6.43"
7575
SpecialFunctions = "2"
76-
Static = "1.1.1"
7776
StableRNGs = "1"
77+
Static = "1.1.1"
7878
Test = "1"
7979
julia = "~1.10.8, 1.11.6"
8080

docs/src/developer_documentation/ir_representation.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# IR Representation
1+
# IR Representations and Code Transformations
22

33
Mooncake.jl works by transforming Julia's SSA-form (static single assignment) Intermediate Representation (IR), so a good understanding of Julia's IR is needed to understand Mooncake.
44
Furthermore, Mooncake holds Julia's IR in a different data structure than the one usually used when producing code for reverse-mode AD.
@@ -555,6 +555,12 @@ Reverse-mode AD makes extensive use of such transformations, so `BBCode` is curr
555555
There are efforts such as [this PR](https://github.com/JuliaLang/julia/pull/45305) to augment `IRCode` with the capability to manipulate the CFG structure in a convenient manner.
556556
Ideally these efforts will succeed, then we can do away with `BBCode`.
557557
558+
### Comparison with Alternative Approaches
559+
560+
It's worth noting that other automatic differentiation systems have taken different approaches to IR manipulation. For example, [Diffractor.jl](https://github.com/JuliaDiff/Diffractor.jl) uses an "Optics" approach for IR transformations.
561+
562+
For readers interested in learning more about Julia's IR representation beyond what's covered here, the [Scientific Programming in Julia course materials](https://github.com/JuliaTeachingCTU/Scientific-Programming-in-Julia/blob/2023W/docs/src/lecture_09/ircode.md) provide additional valuable context.
563+
558564
## Docstrings
559565
560566
```@autodocs; canonical=true

docs/src/developer_documentation/reverse_mode_design.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ Do line by line transformation of the statements and then possibly refresh the C
7272
Examples of how line-by-line transformations can be done, are defined in [`Mooncake.make_ad_stmts!`](@ref).
7373
The `IRCode` nodes are not explicitly documented in <https://docs.julialang.org/en/v1/devdocs/ast/#Lowered-form> or <https://docs.julialang.org/en/v1/devdocs/ssair/#Main-SSA-data-structure>. Might need completion of official docs, but Mooncake docs in the meantime.
7474

75+
For additional information about `IRCode` and `BBCode` data structures and transformation examples, see [IR Representations and Code Transformations](@ref).
76+
7577
Inlining pass can prevent us from using high-level rules by inlining the function (e.g. unrolling a loop).
7678
The contexts in [`interpreter/contexts.jl`](https://github.com/chalk-lab/Mooncake.jl/blob/src/interpreter/contexts.jl) are `MinimalCtx` (necessary for AD to work) and `DefaultCtx` (ensure that we hit all of the rules).
7779
Distinction between rules is not well maintained in Mooncake at the moment.

src/fwds_rvs_data.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ function fdata(t::T) where {T}
258258
return F(fdata(t.fields))
259259
end
260260

261+
function fdata(::Type{T}) where {T}
262+
error("$T is a type. Perhaps you meant fdata_type($T) or fdata(instance_of_tangent)?")
263+
end
264+
261265
function fdata(t::T) where {T<:PossiblyUninitTangent}
262266
F = fdata_type(T)
263267
return is_init(t) ? F(fdata(val(t))) : F()
@@ -530,6 +534,10 @@ function rdata(t::T) where {T}
530534
return R(rdata(t.fields))
531535
end
532536

537+
function rdata(::Type{T}) where {T}
538+
error("$T is a type. Perhaps you meant rdata_type($T) or rdata(instance_of_tangent)?")
539+
end
540+
533541
function rdata(t::T) where {T<:PossiblyUninitTangent}
534542
R = rdata_type(T)
535543
return is_init(t) ? R(rdata(val(t))) : R()

src/rrules/blas.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,13 @@ function invertible_blas_matrices(rng::AbstractRNG, P::Type{<:BlasFloat}, p::Int
11091109
end
11101110
end
11111111

1112+
function positive_definite_blas_matrices(rng::AbstractRNG, P::Type{<:BlasFloat}, p::Int)
1113+
return map(blas_matrices(rng, P, p, p)) do A
1114+
A .= A'A + I
1115+
return A
1116+
end
1117+
end
1118+
11121119
function blas_vectors(rng::AbstractRNG, P::Type{<:BlasFloat}, p::Int)
11131120
xs = Any[
11141121
randn(rng, P, p),

src/rrules/lapack.jl

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# See https://sethaxen.com/blog/2021/02/differentiating-the-lu-decomposition/ for details.
2-
@is_primitive(MinimalCtx, Tuple{typeof(LAPACK.getrf!),AbstractMatrix{<:BlasRealFloat}})
2+
@is_primitive(MinimalCtx, Tuple{typeof(LAPACK.getrf!),AbstractMatrix{<:BlasFloat}})
33
function frule!!(
44
::Dual{typeof(LAPACK.getrf!)}, A_dA::Dual{<:AbstractMatrix{P}}
5-
) where {P<:BlasRealFloat}
5+
) where {P<:BlasFloat}
66
_, ipiv, info = LAPACK.getrf!(primal(A_dA))
77
return _getrf_fwd(A_dA, ipiv, info)
88
end
99
function rrule!!(
1010
::CoDual{typeof(LAPACK.getrf!)}, _A::CoDual{<:AbstractMatrix{P}}
11-
) where {P<:BlasRealFloat}
11+
) where {P<:BlasFloat}
1212
A, dA = arrayify(_A)
1313
A_copy = copy(A)
1414

@@ -28,16 +28,14 @@ end
2828

2929
@is_primitive(
3030
MinimalCtx,
31-
Tuple{
32-
typeof(Core.kwcall),NamedTuple,typeof(LAPACK.getrf!),AbstractMatrix{<:BlasRealFloat}
33-
},
31+
Tuple{typeof(Core.kwcall),NamedTuple,typeof(LAPACK.getrf!),AbstractMatrix{<:BlasFloat}},
3432
)
3533
function frule!!(
3634
::Dual{typeof(Core.kwcall)},
3735
_kwargs::Dual{<:NamedTuple},
3836
::Dual{typeof(getrf!)},
3937
A_dA::Dual{<:AbstractMatrix{P}},
40-
) where {P<:BlasRealFloat}
38+
) where {P<:BlasFloat}
4139
check = primal(_kwargs).check
4240
_, ipiv, info = LAPACK.getrf!(primal(A_dA); check)
4341
return _getrf_fwd(A_dA, ipiv, info)
@@ -47,7 +45,7 @@ function rrule!!(
4745
_kwargs::CoDual{<:NamedTuple},
4846
::CoDual{typeof(getrf!)},
4947
_A::CoDual{<:AbstractMatrix{P}},
50-
) where {P<:BlasRealFloat}
48+
) where {P<:BlasFloat}
5149
check = _kwargs.x.check
5250
A, dA = arrayify(_A)
5351
A_copy = copy(A)
@@ -505,6 +503,7 @@ end
505503
function generate_hand_written_rrule!!_test_cases(rng_ctor, ::Val{:lapack})
506504
rng = rng_ctor(123)
507505
Ps = [Float64, Float32]
506+
complexPs = [Float64, Float32, ComplexF64, ComplexF32]
508507
bools = [false, true]
509508
test_cases = vcat(
510509

@@ -516,7 +515,7 @@ function generate_hand_written_rrule!!_test_cases(rng_ctor, ::Val{:lapack})
516515
(false, :stability, nothing, getrf!, A)
517516
end
518517
end...,
519-
map_prod(bools, Ps) do (check, P)
518+
map_prod(bools, complexPs) do (check, P)
520519
As = blas_matrices(rng, P, 5, 5)
521520
ipiv = Vector{Int}(undef, 5)
522521
return map(As) do A
@@ -583,13 +582,33 @@ end
583582

584583
function generate_derived_rrule!!_test_cases(rng_ctor, ::Val{:lapack})
585584
rng = rng_ctor(123)
585+
complexPs = [Float64, Float32, ComplexF64, ComplexF32]
586586
getrf_wrapper!(x, check) = getrf!(x; check)
587-
test_cases = vcat(map_prod([false, true], [Float64, Float32]) do (check, P)
588-
As = blas_matrices(rng, P, 5, 5)
589-
return map(As) do A
590-
(false, :none, nothing, getrf_wrapper!, A, check)
591-
end
592-
end...)
587+
test_cases = vcat(
588+
# getrf
589+
map_prod([false, true], complexPs) do (check, P)
590+
As = blas_matrices(rng, P, 5, 5)
591+
return map(As) do A
592+
(false, :none, nothing, getrf_wrapper!, A, check)
593+
end
594+
end...,
595+
596+
# real logdet
597+
map([Float64, Float32]) do P
598+
As = positive_definite_blas_matrices(rng, P, 3)
599+
return map(As) do A
600+
(false, :none, nothing, logdet, A)
601+
end
602+
end...,
603+
604+
# complex logdet
605+
map(complexPs) do P
606+
As = blas_matrices(rng, P, 3, 3)
607+
return map(As) do A
608+
(false, :none, nothing, real logdet complex, A)
609+
end
610+
end...,
611+
)
593612
memory = Any[]
594613
return test_cases, memory
595614
end

src/tangents.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,8 @@ tangent_type(::Type{<:Base.TTY}) = NoTangent
370370

371371
tangent_type(::Type{<:IOStream}) = NoTangent
372372

373+
tangent_type(::Type{<:Base.CoreLogging.AbstractLogger}) = NoTangent
374+
373375
function split_union_tuple_type(tangent_types)
374376

375377
# Create first split.
@@ -1353,6 +1355,7 @@ tangents, but they're unable to check that `increment!!` is correct in an absolu
13531355
(Union, NoTangent),
13541356
(UnionAll, NoTangent),
13551357
(typeof(<:), NoTangent),
1358+
(Base.CoreLogging.SimpleLogger, NoTangent),
13561359
(IOStream(""), NoTangent),
13571360
]
13581361
# Construct test cases containing circular references. These typically require multiple

test/fwds_rvs_data.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,9 @@ end
157157
@test verify_rdata_value(Ptr{Float64}(), NoRData()) === nothing
158158
end
159159
end
160+
161+
@testset "Helpful error messages for misuse of fdata and rdata" begin
162+
@test_throws "Float64 is a type. Perhaps you meant" fdata(Float64)
163+
@test_throws "Float64 is a type. Perhaps you meant" rdata(Float64)
164+
end
160165
end

0 commit comments

Comments
 (0)