-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add support for microarchitecture levels #31
Conversation
c4b211e
to
19ea8a6
Compare
Thanks a lot for looking info this @pikacic ! I would really like it if we could use more meaningful names like |
@boegel we don't currently have aliases, and the names are pretty much set by gcc and clang -- it's in the ABI spec now. I think we can add aliases later if we grow a feature. I want to do that so that so that |
cpu/microarchitectures.json
Outdated
"flags": "-march={name} -mtune=generic" | ||
}, | ||
{ | ||
"versions": "4.6:10.3", |
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.
which is the correct way of specifying gcc < 11.1
? Should I use the latest known 10.x
version or a dummy 10.99
?
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.
Just :11.0
should work. The ranges are (for better or for worse) inclusive.
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.
Done, although GCC 11.0 does not exist (it looks like they have been skipping the x.0
tag recently).
What about Clang?
@boegel, I agree with you, but, as @tgamblin said, it's not my choice. About the aliasing, at the current state we cannot detect to be on a OTOH |
I think we should break the tie by detecting the actual architecture. In some cases the feature lists are tweaked so that we can detect on cloud nodes and VMs, where certain features are disabled. But we still know with very strong likelihood that, e.g., the chip is a
|
I think the above actually works out pretty well in the implementation -- arch spec will take the "highest" architecture in the DAG that has the features of the host. If |
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/microarchitectures.json
Outdated
"flags": "-march={name} -mtune=generic" | ||
}, | ||
{ | ||
"versions": "4.6:10.3", |
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.
Just :11.0
should work. The ranges are (for better or for worse) inclusive.
OK, |
I generally prefer dashes to |
cpu/microarchitectures.json
Outdated
} | ||
}, | ||
"nehalem": { | ||
"from": ["x86_64_v2"], |
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.
I wonder if:
"from": ["x86_64_v2"], | |
"from": ["core2", "x86_64_v2"], |
is a better modeling choice (and similarly for the other virtual versions below). Need to give some more thought at it.
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.
Thanks a lot, this looks great! I am just marking a request for change to be sure:
- We go through the comment on inheritance I left above
- We test these changes in a branch of the archspec library before merging them
@alalazo is there more left to do here? It would be good to have more tests, but if this works with archspec right now I'm tempted to say we should merge it. Can you try it out? |
@tgamblin Will do by tomorrow. Do we have any preference on this #31 (comment) ? Basically right now we have:
This PR makes it like:
I think it would be better to branch in like:
|
@alalazo, something like
hides the fact that
|
@pikacic @tgamblin I'm reading the documents more closely and my understanding is that the modeling here is currently incorrect, since it adds properties to what is in the definitions of the virtual levels. For instance in this PR we have As per #31 (comment) I think a better modeling would be to:
I suggest point 2 specifically since, by reading the documents, it doesn't seem the virtual levels are only for Intel so it would be good to keep them separated from the vendors - since they could also branch into AMD procs?
That would be true for Let me know if I missed or misunderstood any point. |
@alalazo, I think now I understand a bit better the archspec architecture and I agree completely with your suggestion. |
It took me a bit longer than expected because I tweaked a bit the flags to match a bit better the instructions enabled by the uarch levels. With the latest change (if I understand correctly how this all works) the I also declared the compatibility of AMD CPUs with the new microarchitecture levels (deduced from GCC docs). |
I'll have a look at this asap and try it in |
I couldn't decide if to have them grouped at the beginning or at the end, so I kept them interleaved. |
No worries. We'll squash merge the PR in the end 🙂 |
Thanks @pikacic I'll double check the entries and add a draft PR in archspec. I'll get back here as soon as I have news. |
@pikacic I think |
@alalazo, you are right... I missed that I also changed the compatibility list of |
@pikacic Thanks! This looks great to me! |
For reference, once this is merged I'll update archspec/archspec#51 |
LGTM! |
Thanks @pikacic! |
Introduced definitions for the x86-64 microarchitecture levels: - x86-64-v2 (basically an alias to nehalem with generic tuning) - x86-64-v3 (alias to haswell with generic tuning) - x86-64-v4 (alias to skylake_avx512 with generic tuning) Added compiler flags also for gcc < 11.1 and clang < 12.0.
Introduced definitions for the x86-64 microarchitecture levels: - x86-64-v2 (basically an alias to nehalem with generic tuning) - x86-64-v3 (alias to haswell with generic tuning) - x86-64-v4 (alias to skylake_avx512 with generic tuning) Added compiler flags also for gcc < 11.1 and clang < 12.0.
This introduces definitions for the microarchitecture levels:
x86-64-v2
(basically an alias tonehalem
with generic tuning)x86-64-v3
(alias tohaswell
with generic tuning)x86-64-v4
(alias toskylake_avx512
with generic tuning)I also implemented equivalent compiler flags for gcc < 11.1 and clang < 12.0.
It's my first PR pm archspec, so I have some doubts about how to tune the compiler version ranges and the features list.
Resolves #30