[LLVMdev] Proposal: Move host CPU auto-detection out of the TargetMachine

Robinson, Paul Paul_Robinson at playstation.sony.com
Wed Apr 9 14:01:49 PDT 2014


We've seen similar problems, a test passes for one person but not another, because of having different desktop models.  Having that stop would be kind of nice.
I guess currently every target must have some generic/default and only a few do the auto-detect thing?  Probably don't want to make it mandatory to support -mcpu=native but refactoring the existing targets that do that seems fine.
--paulr

From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Philip Reames
Sent: Wednesday, April 09, 2014 1:00 PM
To: Jim Grosbach; LLVM Developers Mailing List
Subject: Re: [LLVMdev] Proposal: Move host CPU auto-detection out of the TargetMachine

I support the general direction of this change.  I haven't reviewed the actual code changes.

Philip
On 04/07/2014 05:59 PM, Jim Grosbach wrote:

All,



Currently the X86 backend does CPU auto-detection and subtarget feature detection when the TargetMachine is created if no explicit CPU was specified. It's counterintuitive for low level tools like 'llc' to do this, as it means the same .ll file compiled on heterogenous machines generates different results from the same 'llc' command line. It is still useful to be able to opt-in to such behavior to, for example, replicate clang's behavior when -mcpu=native is supplied to clang. My thought is to do something similar here and teach 'llc' to recognize -mcpu=native and probe the host CPU if that is given. The subtarget features will then be filled in according to the feature string for that CPU. This (a) changes the auto-detection from opt-out to opt-in and (b) moves the logic out of the core target backend and into the tools drivers.



Attached are draft patches that do this for X86. Similar but smaller cleanups can also be done for SystemZ and PowerPC if it's agreed this is a good idea.



-Jim








_______________________________________________

LLVM Developers mailing list

LLVMdev at cs.uiuc.edu<mailto:LLVMdev at cs.uiuc.edu>         http://llvm.cs.uiuc.edu

http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140409/1e03a8bb/attachment.html>


More information about the llvm-dev mailing list