From bec3148480ba690e73e45d3fc4cfe323c94984ab Mon Sep 17 00:00:00 2001 From: Bagaev Dmitry Date: Wed, 12 Jun 2024 11:14:56 +0200 Subject: [PATCH] add JET analysis --- Project.toml | 3 ++- ext/StaticArraysCoreExt.jl | 6 +++--- test/fastcholesky_setuptests.jl | 2 +- test/fastcholesky_tests.jl | 6 ++++++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Project.toml b/Project.toml index 67cb52c..84920d3 100644 --- a/Project.toml +++ b/Project.toml @@ -20,10 +20,11 @@ StaticArraysCore = "1" julia = "1.6" [extras] +JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" ReTestItems = "817f1d60-ba6b-4fd5-9520-3cf149f6a823" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Test", "StaticArrays", "StaticArraysCore", "ReTestItems"] +test = ["Test", "StaticArrays", "StaticArraysCore", "ReTestItems", "JET"] diff --git a/ext/StaticArraysCoreExt.jl b/ext/StaticArraysCoreExt.jl index f4827fb..c5dabff 100644 --- a/ext/StaticArraysCoreExt.jl +++ b/ext/StaticArraysCoreExt.jl @@ -8,10 +8,10 @@ function FastCholesky.fastcholesky(input::StaticArraysCore.StaticArray) u = C.uplo c = C.info if !LinearAlgebra.issuccess(C) - C_ = cholesky(Positive, C, tol = PositiveFactorizations.default_δ(C)) + C_ = cholesky(Positive, Matrix(C), tol = PositiveFactorizations.default_δ(C)) f = typeof(C.factors)(C_.factors) - u = C_.uplo - c = C_.info + u = typeof(C.uplo)(C_.uplo) + c = typeof(C.info)(C_.info) end return Cholesky(f, u, c) end diff --git a/test/fastcholesky_setuptests.jl b/test/fastcholesky_setuptests.jl index ae53a86..5cf0596 100644 --- a/test/fastcholesky_setuptests.jl +++ b/test/fastcholesky_setuptests.jl @@ -1,4 +1,4 @@ -using Test, FastCholesky, LinearAlgebra, StaticArrays, StaticArraysCore +using Test, FastCholesky, LinearAlgebra, StaticArrays, StaticArraysCore, JET const SupportedTypes = (Float32, Float64, BigFloat) diff --git a/test/fastcholesky_tests.jl b/test/fastcholesky_tests.jl index 1b64509..1ed0fe1 100644 --- a/test/fastcholesky_tests.jl +++ b/test/fastcholesky_tests.jl @@ -39,6 +39,12 @@ # Check that we do not lose the static type in the process for example @test typeof(cholesky(input)) === typeof(fastcholesky(input)) + + @test_opt unoptimize_throw_blocks=false ignored_modules=(Base,) fastcholesky(input) + @test_opt unoptimize_throw_blocks=false ignored_modules=(Base,) cholinv(input) + @test_opt unoptimize_throw_blocks=false ignored_modules=(Base,) cholsqrt(input) + @test_opt unoptimize_throw_blocks=false ignored_modules=(Base,) chollogdet(input) + @test_opt unoptimize_throw_blocks=false ignored_modules=(Base,) cholinv_logdet(input) end end end