Skip to content

Conversation

@oscardssmith
Copy link
Member

@oscardssmith oscardssmith commented Oct 5, 2022

Separated from #46679 as the easiest way to fix #47065. Needs tests.

closes #46586
closes #46587

@oscardssmith oscardssmith added needs tests Unit tests are required for this change bugfix This change fixes an existing bug sorting Put things in order labels Oct 5, 2022
@LilithHafner LilithHafner removed the needs tests Unit tests are required for this change label Oct 6, 2022
@LilithHafner
Copy link
Member

This is a combination of

The algorithmic changes in #46586 and #46587 have little practical performance impact, but what impact there is is positive.

I think what is holding this back right now is that we need review of those changes by someone familiar with the appropriate sections of the compiler.

@aviatesk
Copy link
Member

aviatesk commented Oct 6, 2022

@nanosoldier runbenchmarks("inference", vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - no performance regressions were detected. A full report can be found here.

@oscardssmith oscardssmith force-pushed the oscardssmith-Compiler-Sort branch from 3533c60 to 1ab8885 Compare October 7, 2022 15:15
@oscardssmith oscardssmith merged commit 17afb66 into master Oct 8, 2022
@oscardssmith oscardssmith deleted the oscardssmith-Compiler-Sort branch October 8, 2022 20:15
Comment on lines +110 to +124
@testset "many basic blocks" begin
n = 1000
ex = :(return 1)
for _ in 1:n
ex = :(if rand()<.1
$(ex) end)
end
@eval begin
function f_1000()
$ex
return 0
end
end
@test f_1000()===0
end
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused at this test case. What's being tested here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe that this is testing compilation of a function with a bunch of basic blocks. Is there a better version of this test?

Copy link
Member

Choose a reason for hiding this comment

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

Is the compilation performance being tested, or is there any correctness issue? And why f_1000 always returns 0?

Copy link
Member Author

@oscardssmith oscardssmith Oct 9, 2022

Choose a reason for hiding this comment

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

There was a correctness issue (#47065) where the compiler would try to sort a big list and fail. f_1000 doesn't technically always return 0, but it returns 1 1 in 10^1000 times which is close enough to never that it will never fail.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, I understand. I'd prefer not having @testset there though.


# Make sure that the compiler can sort things.
# https://github.com/JuliaLang/julia/issues/47065
@testset "Compiler Sorting" begin
Copy link
Member

Choose a reason for hiding this comment

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

I think this is redundant with (or at least should be in the same place as) test/compiler/sort.jl

aviatesk added a commit that referenced this pull request Oct 10, 2022
aviatesk added a commit that referenced this pull request Oct 10, 2022
aviatesk added a commit that referenced this pull request Oct 10, 2022
aviatesk added a commit to aviatesk/JET.jl that referenced this pull request Oct 13, 2022
aviatesk added a commit that referenced this pull request Feb 8, 2024
This commit refines `interpreter_exec.jl` further, on top of #53218.
In detail, by using `Base.Experimental.@compiler_options compile=min`,
it's now possible to mimic the effect of `julia --compile=[min|yes]`.
This commit is leveraging it and includes `interpreter_exec.jl` from
`test/compiler/ssair.jl`, allowing us to get better stack traces and
test summaries.

In addition, I've introduced several tests concerning the `src.inferred`
values and have relocated the tests from #47066 within
`interpreter_exec.jl` to `test/compiler/irpasses.jl`, since it is
related to Julia-level compilation and not to interpreter execution.
aviatesk added a commit that referenced this pull request Feb 8, 2024
This commit refines `interpreter_exec.jl` further, on top of #53218.
In detail, by using `Base.Experimental.@compiler_options compile=min`,
it's now possible to mimic the effect of `julia --compile=[min|yes]`.
This commit is leveraging it and includes `interpreter_exec.jl` from
`test/compiler/ssair.jl`, allowing us to get better stack traces and
test summaries.

In addition, I've introduced several tests concerning the `src.inferred`
values and have relocated the tests from #47066 within
`interpreter_exec.jl` to `test/compiler/irpasses.jl`, since it is
related to Julia-level compilation and not to interpreter execution.
aviatesk added a commit that referenced this pull request Feb 9, 2024
This commit refines `interpreter_exec.jl` further, on top of #53218.
In detail, by using `Base.Experimental.@compiler_options compile=min`,
it's now possible to mimic the effect of `julia --compile=[min|yes]`.
This commit is leveraging it and includes `interpreter_exec.jl` from
`test/compiler/ssair.jl`, allowing us to get better stack traces and
test summaries.

In addition, I've introduced several tests concerning the `src.inferred`
values and have relocated the tests from #47066 within
`interpreter_exec.jl` to `test/compiler/irpasses.jl`, since it is
related to Julia-level compilation and not to interpreter execution.
aviatesk added a commit that referenced this pull request Feb 9, 2024
This commit refines `interpreter_exec.jl` further, on top of #53218. In
detail, by using `Base.Experimental.@compiler_options compile=min`, it's
now possible to mimic the effect of `julia --compile=[min|yes]`. This
commit is leveraging it and includes `interpreter_exec.jl` from
`test/compiler/ssair.jl`, allowing us to get better stack traces and
test summaries.

In addition, I've introduced several tests concerning the `src.inferred`
values and have relocated the tests from #47066 within
`interpreter_exec.jl` to `test/compiler/irpasses.jl`, since it is
related to Julia-level compilation and not to interpreter execution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This change fixes an existing bug sorting Put things in order

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Core.Compiler.sort! is broken

7 participants