Skip to content

julia: add cpu_target variant to let user customise JULIA_CPU_TARGET#50676

Closed
giordano wants to merge 3 commits into
spack:developfrom
giordano:mg/julia-cpu-target
Closed

julia: add cpu_target variant to let user customise JULIA_CPU_TARGET#50676
giordano wants to merge 3 commits into
spack:developfrom
giordano:mg/julia-cpu-target

Conversation

@giordano
Copy link
Copy Markdown
Member

@giordano giordano commented May 28, 2025

This is useful when compiling julia on heterogeneous systems where we want to provide a single sysimage usable on different nodes.

Note that this currently doesn't work particularly well because values of variants don't seem to allow commas, and JULIA_CPU_TARGET needs commas to separate target features.

@giordano
Copy link
Copy Markdown
Member Author

Note that this currently doesn't work particularly well because values of variants don't seem to allow commas, and JULIA_CPU_TARGET needs commas to separate target features.

The variant now takes pipes, and they're internally replaced to commas. I verified I could successfully and correctly build the spec

julia cpu_target='generic;sandybridge|-xsaveopt|clone_all;haswell|-rdrnd|base(1);znver4|-rdrnd|base(1)' ^llvm~clang~gold~polly ^openblas threads=openmp

and then

julia> Base.parse_image_targets(Base.parse_cache_header(joinpath(dirname(Sys.BINDIR), "share", "julia", "compiled", "v1.11", "Pkg", "tUTdb_liHqa.ji"))[7])
4-element Vector{Base.ImageTarget}:
 generic; flags=0; features_en=(cx16)
 sandybridge; flags=0; features_en=(sse3, pclmul, ssse3, cx16, sse4.1, sse4.2, popcnt, xsave, avx, sahf)
 haswell; flags=0; features_en=(sse3, pclmul, ssse3, fma, cx16, sse4.1, sse4.2, movbe, popcnt, xsave, avx, f16c, fsgsbase, bmi, avx2, bmi2, sahf, lzcnt)
 znver4; flags=0; features_en=(sse3, pclmul, ssse3, fma, cx16, sse4.1, sse4.2, movbe, popcnt, aes, xsave, avx, f16c, fsgsbase, bmi, avx2, bmi2, avx512f, avx512dq, adx, avx512ifma, clflushopt, clwb, avx512cd, sha, avx512bw, avx512vl, avx512vbmi, pku, avx512vbmi2, shstk, gfni, vaes, vpclmulqdq, avx512vnni, avx512bitalg, avx512vpopcntdq, rdpid, sahf, lzcnt, sse4a, prfchw, mwaitx, xsavec, xsaves, clzero, wbnoinvd, avx512bf16)

which confirms the pkgimage of the the Pkg.jl standard library was indeed compiled for the requested targets.

Comment thread var/spack/repos/spack_repo/builtin/packages/julia/package.py Outdated
giordano added 3 commits June 3, 2025 08:32
This is useful when compiling julia on heterogeneous systems where we want to
provide a single sysimage usable on different nodes.
@giordano giordano force-pushed the mg/julia-cpu-target branch from 24cedae to 4f90699 Compare June 3, 2025 07:32
@giordano giordano requested a review from haampie June 3, 2025 08:19
@haampie
Copy link
Copy Markdown
Member

haampie commented Jun 6, 2025

Hi @giordano, this package-related pull request can be migrated from spack/spack to spack/spack-packages using the migrate-pkg-prs utility.

We encourage authors to run the migration script themselves to preserve author attribution.

You can migrate all your open pull requests at once, following the steps in the documentation.


This comment was posted automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants