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

AMD Zen 3 CPU support (Fixes #45657) #45663

Merged
merged 1 commit into from
Jun 14, 2022
Merged

Conversation

LebedevRI
Copy link
Contributor

I've omitted invpcid feature since it's clearly omitted for other CPU's.

It's a bit sad that the very same code
is being repeated in every project :/

Fixes #45657

@LebedevRI
Copy link
Contributor Author

CC @yuyichao, thanks.

@vchuravy vchuravy added the backport 1.8 Change should be backported to release-1.8 label Jun 13, 2022
@vchuravy
Copy link
Member

It's a bit sad that the very same code is being repeated in every project

There is some community around archspec

@LebedevRI
Copy link
Contributor Author

image
Yes, please, i was just about to ask for that :)

@LebedevRI
Copy link
Contributor Author

One caveat that i'm observing here, is that specifying JULIA_CPU_TARGET=native in Make.user
produces bad sysimage:

$ ./usr/bin/julia --cpu-target znver3
ERROR: Unable to find compatible target in system image.

... but it works with JULIA_CPU_TARGET=znver3.

I guess it's expected?

@yuyichao
Copy link
Contributor

I guess it's expected?

This should not happen on the same machine.

src/processor_x86.cpp Outdated Show resolved Hide resolved
@LebedevRI
Copy link
Contributor Author

I guess it's expected?

This should not happen on the same machine.

Oh, i get it now. Zen 3 also implemented cet_ss (Control flow enforcement (CET) shadow stack),
it is being detected for sysimage, but i didn't list it in features.

@LebedevRI
Copy link
Contributor Author

Now with JULIA_CPU_TARGET=native, both the --cpu-target native and the --cpu-target znver3 work.

@LebedevRI LebedevRI requested a review from yuyichao June 13, 2022 17:50
@LebedevRI
Copy link
Contributor Author

I'm not sure i understand those test failures.
They seem to be happening even on znver2 and AArch64 builds.

src/processor_x86.cpp Show resolved Hide resolved
src/processor_x86.cpp Outdated Show resolved Hide resolved
@vchuravy
Copy link
Member

vchuravy commented Jun 13, 2022

They seem to be happening even on znver2 and AArch64 builds.

Yeah not relevant to your PR. x-ref: #45613 (comment)

I've omitted `invpcid` feature since it's clearly omitted for other CPU's.

It's a bit sad that the very same code
is being repeated in every project :/

Fixes JuliaLang#45657
@yuyichao
Copy link
Contributor

Oh, i get it now. Zen 3 also implemented cet_ss (Control flow enforcement (CET) shadow stack),
it is being detected for sysimage, but i didn't list it in features.

Was the thing that didn't work compiling with native and running with znver3? Yeah that'll not work if there's a mismatch. Compiling and running with native (the default) should work though no matter what feature you've listed for znver3..

Copy link
Contributor

@yuyichao yuyichao left a comment

Choose a reason for hiding this comment

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

LGTM. I'm just assuming that the feature set and CPU id is correct.......

@vchuravy vchuravy added the merge me PR is reviewed. Merge when all tests are passing label Jun 13, 2022
@LebedevRI
Copy link
Contributor Author

Oh, i get it now. Zen 3 also implemented cet_ss (Control flow enforcement (CET) shadow stack),
it is being detected for sysimage, but i didn't list it in features.

Was the thing that didn't work compiling with native and running with znver3? Yeah that'll not work if there's a mismatch. Compiling and running with native (the default) should work though no matter what feature you've listed for znver3..

Something like that, yes. I've debugged that by dumping the imgt.en.features and target.dis.features
in match_sysimg_targets(), looking for the mismatched bit, and comparing the bit index to the enum

JL_FEATURE_DEF(shstk, 32 * 3 + 7, 0)
.

LGTM. I'm just assuming that the feature set and CPU id is correct.......

I'm confident that it is, and it works now.

@yuyichao
Copy link
Contributor

You could just do a ccall(:jl_dump_host_cpu, Cvoid, ()) to see the detected featured .......

@LebedevRI
Copy link
Contributor Author

You could just do a ccall(:jl_dump_host_cpu, Cvoid, ()) to see the detected featured .......

I could, but i didn't know i could. Still looks good:

julia> ccall(:jl_dump_host_cpu, Cvoid, ())
CPU: znver3
Features: sse3, pclmul, ssse3, fma, cx16, sse4.1, sse4.2, movbe, popcnt, aes, xsave, avx, f16c, rdrnd, fsgsbase, bmi, avx2, bmi2, rdseed, adx, clflushopt, clwb, sha, pku, shstk, vaes, vpclmulqdq, rdpid, sahf, lzcnt, sse4a, prfchw, mwaitx, xsaveopt, xsavec, xsaves, clzero, wbnoinvd

@LebedevRI
Copy link
Contributor Author

Apologies, i'm not familiar with the julia's PR workflow.
Do i need to do anything further to get this merged?
It seems like #45613 still has not been reverted, so CI will stay red.

@KristofferC KristofferC merged commit 3f047f7 into JuliaLang:master Jun 14, 2022
@LebedevRI LebedevRI deleted the znver3 branch June 14, 2022 10:51
LebedevRI added a commit to LebedevRI/julia that referenced this pull request Jun 14, 2022
I've omitted `invpcid` feature since it's clearly omitted for other CPU's.

Fixes JuliaLang#45657

(cherry picked from commit 3f047f7)
@LebedevRI
Copy link
Contributor Author

@KristofferC thank you!

KristofferC pushed a commit that referenced this pull request Jun 14, 2022
I've omitted `invpcid` feature since it's clearly omitted for other CPU's.

Fixes #45657

(cherry picked from commit 3f047f7)
@DilumAluthge DilumAluthge removed the merge me PR is reviewed. Merge when all tests are passing label Jun 16, 2022
@KristofferC KristofferC mentioned this pull request Jul 5, 2022
36 tasks
@KristofferC KristofferC removed the backport 1.8 Change should be backported to release-1.8 label Jul 6, 2022
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.

Julia v1.8.0-rc1: support for znver3 (even though underlying LLVM13 supports is) is missing
5 participants