[PATCH] D121410: Have cpu-specific variants set 'tune-cpu' as an optimization hint

Phoebe Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 11 00:42:16 PST 2022


pengfei added a comment.

Typos in `wiht different feature lists` and `In the even that`.



================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:2067
+      // favor this processor.
+      TuneCPU = SD->getCPUName(GD.getMultiVersionIndex())->getName();
+    }
----------------
erichkeane wrote:
> andrew.w.kaylor wrote:
> > Unfortunately, I don't think it's this easy. The list of names used for cpu_specific doesn't come from the same place as the list of names used by "tune-cpu". For one thing, the cpu_specific names can't contain the '-' character, so we have names like "skylake_avx512" in cpu_specific that would need to be translated to "skylake-avx512" for "tune-cpu". I believe the list of valid names for "tune-cpu" comes from here: https://github.com/llvm/llvm-project/blob/26cd258420c774254cc48330b1f4d23d353baf05/llvm/lib/Support/X86TargetParser.cpp#L294
> > 
> > Also, some of the aliases supported by cpu_specific don't have any corresponding "tune-cpu" name. You happen to have picked one of these for the test. I believe "core_4th_gen_avx" should map to "haswell".
> Hmm... this is unfortunate.  I wonder if we add some 'translation' type field to the X86TargetParser.def entries?  Any idea who the right one to populate said list would be?
> I believe the list of valid names for "tune-cpu" comes from ...

I think it's here https://github.com/llvm/llvm-project/blob/26cd258420c774254cc48330b1f4d23d353baf05/llvm/lib/Target/X86/X86.td#L1408

So back to Andy's problems, where we consume the cpu_specific names in compiler previously, e.g., mapping to different targets? Or it is done by external libraries like compiler-rt?

I think I have the same requirments that mapping `-` and `_` for "tune-cpu" in https://github.com/llvm/llvm-project/issues/50125 where the preprocessor defines use `_` as well.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121410/new/

https://reviews.llvm.org/D121410



More information about the cfe-commits mailing list