Skip to content

Make JET happy#188

Closed
kshyatt wants to merge 1 commit intomainfrom
ksh/jet
Closed

Make JET happy#188
kshyatt wants to merge 1 commit intomainfrom
ksh/jet

Conversation

@kshyatt
Copy link
Member

@kshyatt kshyatt commented Mar 16, 2026

I know @lkdvos has said he dislikes these ticky-tacky small changes to make the linter happy, which I am very sympathetic to. On the other hand, I dislike red "x"s in CI. Happy to modify this though (please just feel free to push stuff!).

@kshyatt kshyatt requested review from Jutho and lkdvos March 16, 2026 10:38
@kshyatt
Copy link
Member Author

kshyatt commented Mar 16, 2026

The tests pass on macOS + Julia 1.12 locally for me... 😱

Comment on lines +144 to +145
jpvt = Vector{Int}(undef, 0)
τ = Vector{eltype(A)}(undef, 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the least impactful: making these nothing and having a small type union, or the current approach, which I think does require a small allocation?

G = V' * V

VᴴΔV = !iszerotangent(ΔV) ? V' * ΔV : zero(G)
ΔVperp = ΔV - V * inv(G) * VᴴΔV
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this even work if iszerotangent(ΔV), e.g. ΔV could be nothing on some of the AD engines like Zygote, no?

Comment on lines +50 to +51
indU = axes(U, 2)
indV = axes(Vᴴ, 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can probably immediately get their final value, since ind is always defined, even if we end up not needing them.

for i in 1:2 # first call returns lwork as work[1]
#! format: off
if eltype(A) <: Complex
rwork_ = isnothing(rwork) ? Vector{$relty}(undef, 0) : rwork
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this one helps? if eltype(A) <: Complex, then also rwork is not nothing. Is it just a matter of trying to show this to the compiler? How about

rwork_::Vector{$relty} = rwork

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if eltype(A) <: Complex, then also rwork is not nothing

JET seems unable to deduce this fact :(

Let's try the suggestion and see how it reacts!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, no dice, because from JET's PoV this could still involve a conversion from Nothing to a Vector{$relty}...

Copy link
Member

@lkdvos lkdvos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have anything against making JET happy by inserting things that don't matter in the end, but I am incredibly annoyed by the idea of having to introduce (small) type instabilities or allocations just to make a linter happy. On that note, I would actually be more inclined to simply turn off JET tests rather than trying to keep working around this. On top of that, these days for me it seems the JET tests on 1.12 seem to fail often because of errors rather than test failures, so even if we work around it, it still gives red X's too often 😛

@kshyatt
Copy link
Member Author

kshyatt commented Mar 16, 2026

It's also a real pain that I see everything passing locally but it fails in Pkg.test and I cannot get it to spit out a log explaining why...

@lkdvos
Copy link
Member

lkdvos commented Mar 16, 2026

Then let's just disable JET for now, we can revisit this in the future if the need arises.

@kshyatt kshyatt closed this Mar 17, 2026
@kshyatt kshyatt deleted the ksh/jet branch March 17, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants