https://github.com/google/cpu_features was recently contributed with an Apache 2.0 license. Investigate whether this is something that can replace the CPU feature detection logic in the port library and if so, whether it could be extended for Z as well.
Note, it would also seem to be a replacement for the CPU detection features in the compiler itself. However, the strategic direction there is to deprecate this code in favour of the implementation in the port library.
However, the strategic direction there is to deprecate this code in favour of the implementation in the port library.
Shouldn't this be the direction we take regardless of what detection mechanism we use under the hood? No reason why the port library can't use https://github.com/google/cpu_features transparently while the JIT just interfaces with the port library.
Yes, that's what I was trying to say if I didn't say it clearly.
Taking a look at https://github.com/google/cpu_features/tree/master/src it doesn't look too hard to add z/Architecture support, since we support the STFLE instruction on z9 onwards. I do agree we should definitely investigate the potential to use an externally available library rather than rolling our own since the entire area of CPU detection does need an overhaul.
Taking a look at https://github.com/google/cpu_features/tree/master/src it doesn't look too hard to add z/Architecture support, since we support the STFLE instruction on z9 onwards.
In addition to the STFLE instruction on Z, we will also need to roll in auxvector (linux) and CVT (z/OS) bits detection. The auxvector is already used for other platforms in that project.
I had forgotten about this project. Just bumping this to raise it to the attention of those doing CPU work in the port library lately as a possible longer-term direction. @harryyu1994 @fjeremic
Most helpful comment
I had forgotten about this project. Just bumping this to raise it to the attention of those doing CPU work in the port library lately as a possible longer-term direction. @harryyu1994 @fjeremic