James Molloy
2012-May-11 07:25 UTC
[LLVMdev] Request for Help: Teach ARM target to auto-detect cpu / subtarget features
On 11/05/12 04:56, 陳韋任 wrote:>> I've just filed PR12794: Add ARM cpu / subtarget features auto-detection. And I would very much appreciate the community's help to implement this. >> >> What motivated this? Well this: >> http://www.phoronix.com/scan.php?page=news_item&px=MTA5OTM >> >> I believe one of the reason the benchmark numbers are totally bogus is that the compilation are done on ARM hosts. Given the benchmarks are apparently compiled without -mcpu=cortex-a9, I suspect LLVM ended up generating code for "generic" ARMv4 cpu. This article makes me sick in my stomach. > I skip through MCTargetDesc/ARMAsmBackend.cpp, it seems llvm::createARMAsmBackend > only pickup different ARM ISA for Darwin. As for Linux, I guess we need to tweak > ELFARMAsmBackend? Do we need to modify Clang as well? > > Regards, > chenwj >The backend sounds like the wrong place to implement this feature. I'd have thought the Clang driver would be the ideal place?
Chris Lattner
2012-May-11 16:25 UTC
[LLVMdev] Request for Help: Teach ARM target to auto-detect cpu / subtarget features
On May 11, 2012, at 12:25 AM, James Molloy wrote:> On 11/05/12 04:56, 陳韋任 wrote: >>> I've just filed PR12794: Add ARM cpu / subtarget features auto-detection. And I would very much appreciate the community's help to implement this. >>> >>> What motivated this? Well this: >>> http://www.phoronix.com/scan.php?page=news_item&px=MTA5OTM >>> >>> I believe one of the reason the benchmark numbers are totally bogus is that the compilation are done on ARM hosts. Given the benchmarks are apparently compiled without -mcpu=cortex-a9, I suspect LLVM ended up generating code for "generic" ARMv4 cpu. This article makes me sick in my stomach. >> I skip through MCTargetDesc/ARMAsmBackend.cpp, it seems llvm::createARMAsmBackend >> only pickup different ARM ISA for Darwin. As for Linux, I guess we need to tweak >> ELFARMAsmBackend? Do we need to modify Clang as well? >> >> Regards, >> chenwj >> > The backend sounds like the wrong place to implement this feature. > > I'd have thought the Clang driver would be the ideal place?The right place to implement this is in lib/Support/Host.cpp. X86 has an implementation of sys::getHostCPUName(), but everything else just uses the: std::string sys::getHostCPUName() { return "generic"; } implementation. -Chris
陳韋任
2012-May-11 17:37 UTC
[LLVMdev] Request for Help: Teach ARM target to auto-detect cpu / subtarget features
Hi James,> > The backend sounds like the wrong place to implement this feature. > > > > I'd have thought the Clang driver would be the ideal place? > > The right place to implement this is in lib/Support/Host.cpp. X86 has an implementation of sys::getHostCPUName(), but everything else just uses the: > > std::string sys::getHostCPUName() { > return "generic"; > } >Do you happened to know examples show how to get cpu model like X86 does in Host.cpp? Regards, chenwj -- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj
Evan Cheng
2012-May-11 18:39 UTC
[LLVMdev] Request for Help: Teach ARM target to auto-detect cpu / subtarget features
On May 11, 2012, at 9:25 AM, Chris Lattner wrote:> > On May 11, 2012, at 12:25 AM, James Molloy wrote: > >> On 11/05/12 04:56, 陳韋任 wrote: >>>> I've just filed PR12794: Add ARM cpu / subtarget features auto-detection. And I would very much appreciate the community's help to implement this. >>>> >>>> What motivated this? Well this: >>>> http://www.phoronix.com/scan.php?page=news_item&px=MTA5OTM >>>> >>>> I believe one of the reason the benchmark numbers are totally bogus is that the compilation are done on ARM hosts. Given the benchmarks are apparently compiled without -mcpu=cortex-a9, I suspect LLVM ended up generating code for "generic" ARMv4 cpu. This article makes me sick in my stomach. >>> I skip through MCTargetDesc/ARMAsmBackend.cpp, it seems llvm::createARMAsmBackend >>> only pickup different ARM ISA for Darwin. As for Linux, I guess we need to tweak >>> ELFARMAsmBackend? Do we need to modify Clang as well? >>> >>> Regards, >>> chenwj >>> >> The backend sounds like the wrong place to implement this feature. >> >> I'd have thought the Clang driver would be the ideal place? > > The right place to implement this is in lib/Support/Host.cpp. X86 has an implementation of sys::getHostCPUName(), but everything else just uses the: > > std::string sys::getHostCPUName() { > return "generic"; > } > > implementation.Right. There are many advantages to doing this in the backend. It would work for everything, such as llc or arbitrary clients of ARM backend. Also the support library is being used by Clang frontend to handle -march=native. Evan> > -Chris > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
陳韋任
2012-May-13 03:16 UTC
[LLVMdev] Request for Help: Teach ARM target to auto-detect cpu / subtarget features
Hi Chris,> The right place to implement this is in lib/Support/Host.cpp. X86 has an implementation of sys::getHostCPUName(), but everything else just uses the: > > std::string sys::getHostCPUName() { > return "generic"; > } > > implementation.I tried to let it return "armv7l" or "cortex-a9" on pandaboard, but the bitcode output by clang still has target triple = "armv4t-unknown-linux-gnueabi" not what I expect target triple = "armv7l-unknown-linux-gnueabi" Do I miss something? Thanks. Regards, chenwj -- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj
Seemingly Similar Threads
- [LLVMdev] Request for Help: Teach ARM target to auto-detect cpu / subtarget features
- [LLVMdev] Request for Help: Teach ARM target to auto-detect cpu / subtarget features
- [LLVMdev] About LLVM 3.1 ARM testing
- [LLVMdev] Stuck on linking llc on ARM
- [LLVMdev] Cross-compiler to arm