-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix imaging value for generating sysimages for multiple targets #48809
Conversation
Could you add a test here? |
test/cmdlineargs.jl
Outdated
@@ -597,6 +597,34 @@ let exename = `$(Base.julia_cmd()) --startup-file=no --color=no` | |||
"Int(Base.JLOptions().fast_math)"`)) == JL_OPTIONS_FAST_MATH_DEFAULT | |||
end | |||
|
|||
# --pkgimages with multiple cpu targets | |||
@testset let v = readchomperrors(`$exename |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably needs a guard for x86_64 or a different list for supported architectures.
test/cmdlineargs.jl
Outdated
end | ||
|
||
@test success(`$exename | ||
--cpu-target='generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test/cmdlineargs.jl
Outdated
@@ -597,6 +597,34 @@ let exename = `$(Base.julia_cmd()) --startup-file=no --color=no` | |||
"Int(Base.JLOptions().fast_math)"`)) == JL_OPTIONS_FAST_MATH_DEFAULT | |||
end | |||
|
|||
# --pkgimages with multiple cpu targets | |||
@testset let v = readchomperrors(`$exename | |||
--cpu-target='generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--cpu-target='generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)' | |
--cpu-target='generic;generic' |
test/cmdlineargs.jl
Outdated
--cpu-target='generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)' | ||
--output-o=$object_file $outputo_file | ||
--pkgimages=no`) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test sounds slow, and should not be included without further reconsideration of performance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I've noticed that this test adds ~160s. It is too much time for 1 single test.
So, for easy dropping, I've added it in a dedicated commit.
I couldn't think of any other simpler test for output-o, which is faster, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vtjnash How about this: we intentionally don't pass the sysimage arg. When it fails we know everything before that passed, including our case. This takes only 0.05s
# Sysimage with multiple cpu targets
@testset "Sysimage for multiple microarchitectures" begin
julia_path = joinpath(Sys.BINDIR, Base.julia_exename())
outputo_file = tempname()
write(outputo_file, "1")
object_file = tempname() * ".o"
# This is to test that even with `pkgimages=no`, we can create object file
# with multiple cpu-targets
# The cmd is checked for --object-o as soon as it is run. So, to avoid long
# testing times, intentionally don't pass sysimage; when we reach the
# corresponding error, we know that `check_cmdline` has already passed
let v = readchomperrors(`$julia_path
--cpu-target='native;native'
--output-o=$object_file $outputo_file
--pkgimages=no`)
@test v[1] == false
@test v[2] == ""
err = first(split(v[3], "\n\n"))
@test err != "fatal: error thrown and no exception handler available.\nErrorException(\"More than one command line CPU targets specified without a `--output-` flag specified\")"
@test err == "ERROR: File \"boot.jl\" not found"
end
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, though let's do @test !contains(err, "More than one command line CPU targets specified")
so it will still work if other minor aspects change (though the second test for ==
will also catch those)
Also, looks like the PowerPC build is broken @vchuravy |
70b36e6
to
ceb107e
Compare
ceb107e
to
01e97f7
Compare
@vchuravy Do you want me to mark the PowerPC build as "allow fail"? (The PowerPC tests are already marked as "allow fail", but currently the PowerPC build is marked as "regular".) |
No the PPC build is not allowed to fail. Edit: I do not see how this change got impacted the architecture, but we should not downgrade the platform. |
01e97f7
to
9b28ad0
Compare
9b28ad0
to
31b155b
Compare
It seems like this PR is a release blocker for 1.9. Are we willing to let a broken PowerPC build block this PR? The website says that PowerPC is a Tier 3 platform. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
That's a good observation. This PR also seems to change JIT compliation when
versus
|
b6fd51b
to
3fa1bcb
Compare
@ven-k can you please confirm that this PR fixes your original issue? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, modulo checking that we are not using imaging mode in normal JIT mode.
I ran a check with |
With this I can pass Note that when it is added to env via JULIA_CPU_TARGET (Currently PackageCompiler does that for >=v1.9), on relocating I got a segfault. (But considering passing the
|
@vchuravy @staticfloat Would it be possible to make |
Fix imaging value for generating sysimages for multiple targets (cherry picked from commit fc4b079)
Fixes
imaging_default
function, so that sysimages for multiple architectures can be built without settingpkgimages=yes
Current issue:
For versions >1.9-dev,
For a use-case like:
This is because, with
pkgimages=no
, even if output-o is passed, theimaging_default
returns false. This in-turn causes issues while generating sysimages for multiple cpu-targetsAfter this PR, these work:
From the docs, there should be a unified cache. It's unclear to me if the current change results an issue in that regard. An alternative would be changing to
return jl_options.image_codegen || jl_generating_output()
.