Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cap old JET.jl versions to Julia < 1.11, and cap all JET.jl versions to LoweredCodeUtils < v2.4 #104590

Merged
merged 1 commit into from
Apr 14, 2024

Conversation

DilumAluthge
Copy link
Member

@DilumAluthge DilumAluthge commented Apr 9, 2024

Fixes #104585

This PR applies the following retroactive caps:

  1. All versions of JET.jl prior to JET v0.8.28 are capped to Julia < 1.11.0.
  2. All versions of JET.jl are capped to LoweredCodeUtils < 2.3.

Script to generate this PR

Here is the script I used to generate this PR: (click to expand)
import Pkg
import RegistryTools

# Note: this script uses a lot of non-public internals, such as
# `Pkg.Versions.semver_spec`.

JET_package_path = "./J/JET"

JET_compat_filename = joinpath(abspath(JET_package_path), "Compat.toml")
JET_compat_dict = RegistryTools.Compress.load(JET_compat_filename)

JET_deps_dict = RegistryTools.Compress.load(joinpath(abspath(JET_package_path), "Deps.toml"))

deps_to_first_good_JET_version = Dict(
    "julia" => v"0.8.28",
    "LoweredCodeUtils" => v"",
)

deps_to_cap = Dict(
    "julia" => only(Pkg.Versions.semver_spec("< 1.11.0").ranges),
    "LoweredCodeUtils" => only(Pkg.Versions.semver_spec("< 2.4.0").ranges),
)

for (ver, info) in pairs(JET_compat_dict)
    for (dep, first_good_JET_version) in pairs(deps_to_first_good_JET_version)
        dep_is_julia = dep == "julia"
        this_ver_has_this_dep = haskey(get(JET_deps_dict, ver, Dict()), dep)
        if dep_is_julia || this_ver_has_this_dep
            if ver < first_good_JET_version
                old_compat_str = info[dep]
                old_compat_r = Pkg.Versions.VersionRange(old_compat_str)
                cap_to_add = deps_to_cap[dep]
                new_compat_r = intersect(old_compat_r, cap_to_add)
                new_compat_str = string(new_compat_r)

                # Now we mutate the `info` dict (and thus the `JET_compat_dict`
                # dict) with our new `[compat]` string.
                info[dep] = new_compat_str

                @info "" ver dep old=old_compat_str new=info[dep]
            end
        else
            @warn "JET.jl v$(ver) does not directly depend on $(dep)"
        end
    end
end

# Now we write our modified `JET_compat_dict` file back to the `Compat.toml`
# file.
RegistryTools.Compress.save(JET_compat_filename, JET_compat_dict)
I ran the script with the following Julia version and RegistryTools version: (click to expand)
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.2 (2024-03-01)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(@v1.10) pkg> st
Status `~/.julia/environments/v1.10/Project.toml`
  [d1eb7eb1] RegistryTools v2.2.3

@mkitti
Copy link
Contributor

mkitti commented Apr 9, 2024

Is this a duplicate of #104587 . Feel free to close that one in favor of this one.

@DilumAluthge DilumAluthge deleted the dpa/jet-compat-0.2.28-julia-1.11 branch April 9, 2024 23:03
@mkitti
Copy link
Contributor

mkitti commented Apr 9, 2024

I think this is also an issue. The upper bound should be 2.3

["0.5.4-0.8.22"]
LoweredCodeUtils = "2.2.0-2"

@DilumAluthge
Copy link
Member Author

I think this is also an issue. The upper bound should be 2.3

So the upper bound should be LoweredCodeUtils v2.3.0?

@DilumAluthge DilumAluthge restored the dpa/jet-compat-0.2.28-julia-1.11 branch April 9, 2024 23:04
@DilumAluthge DilumAluthge reopened this Apr 9, 2024
@DilumAluthge DilumAluthge marked this pull request as draft April 9, 2024 23:04
@DilumAluthge DilumAluthge changed the title Cap old JET.jl versions to Julia < 1.11 Cap old JET.jl versions to Julia < 1.11 and LoweredCodeUtils < v2.3 Apr 9, 2024
@DilumAluthge
Copy link
Member Author

I think this is also an issue. The upper bound should be 2.3

So the upper bound should be LoweredCodeUtils v2.3.0?

And to which JET versions should this bound be applied? The same versions, i.e. JET < v0.8.28?

@DilumAluthge
Copy link
Member Author

I think this is also an issue. The upper bound should be 2.3

So the upper bound should be LoweredCodeUtils v2.3.0?

@mkitti Is this strictly less than LoweredCodeUtils v2.3.0, or less than or equal to LoweredCodeUtils v2.3.0?

@mkitti
Copy link
Contributor

mkitti commented Apr 9, 2024

All current JET versions are only compatible with LoweredCodeUtils 2.3 or earlier as far as I understand.

See the comment here:
https://github.com/aviatesk/JET.jl/blob/93f06e20769a53d3575df42600d3c455c3bf8923/Project.toml#L25

@DilumAluthge
Copy link
Member Author

All current JET versions are only compatible with LoweredCodeUtils 2.3 or earlier as far as I understand.

Are they compatible with all LoweredCodeUtils 2.3.x?

If yes, then I'll do LoweredCodeUtils < 2.4.0, right?

@DilumAluthge DilumAluthge changed the title Cap old JET.jl versions to Julia < 1.11 and LoweredCodeUtils < v2.3 Cap old JET.jl versions to Julia < 1.11 and LoweredCodeUtils < v2.4 Apr 9, 2024
@DilumAluthge DilumAluthge force-pushed the dpa/jet-compat-0.2.28-julia-1.11 branch from 07014fa to 37cbc51 Compare April 9, 2024 23:17
@DilumAluthge DilumAluthge changed the title Cap old JET.jl versions to Julia < 1.11 and LoweredCodeUtils < v2.4 Cap old JET.jl versions to Julia < 1.11, and cap all JET.jl versions to LoweredCodeUtils < v2.4 Apr 9, 2024
@DilumAluthge DilumAluthge force-pushed the dpa/jet-compat-0.2.28-julia-1.11 branch from 37cbc51 to fff1059 Compare April 9, 2024 23:22
@DilumAluthge DilumAluthge marked this pull request as ready for review April 9, 2024 23:22
@DilumAluthge
Copy link
Member Author

cc: @aviatesk

@DilumAluthge
Copy link
Member Author

@mkitti Can you do another review of this?

Copy link
Contributor

@mkitti mkitti left a comment

Choose a reason for hiding this comment

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

These changes look good to me, but I do not know how to test the changes. Let me see if I can figure that out.

@mkitti
Copy link
Contributor

mkitti commented Apr 10, 2024

xref: #104585 (comment) from aviatesk

Ah, I see. So the PR edits Julia upper bound for the earlier version of JET only. That sounds fine. 

@mkitti
Copy link
Contributor

mkitti commented Apr 10, 2024

@giordano or @fredrikekre , do you have any thoughts on this pull request?

@DilumAluthge DilumAluthge merged commit 5d73d35 into master Apr 14, 2024
10 checks passed
@DilumAluthge DilumAluthge deleted the dpa/jet-compat-0.2.28-julia-1.11 branch April 14, 2024 02:39
@DilumAluthge
Copy link
Member Author

Let's try it out. We can revert if needed.

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.

JET versions before 0.8.28 are not compatible with Julia 1.11
2 participants