[llvm-dev] Is there any relationship between IR instruction and execution time

via llvm-dev llvm-dev at lists.llvm.org
Tue May 8 23:16:13 PDT 2018


Hi Yin,

MCA does support the –mcpu and –mtriple options.  We have one arm test in llvm/test/tools/llvm-mca/ARM for a cortex-9, which is an Out of Order chip.
Hope that helps!

-Matt

From: Yin Liu <yinliu.tiger at gmail.com>
Sent: Tuesday, May 8, 2018 2:49 PM
To: Davis, Matthew <Matthew.Davis at sony.com>
Cc: llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] Is there any relationship between IR instruction and execution time

Hi Matt,

Thanks you so much for the reply!

I've tried the llvm-mca, it is helpful.
I was wondering whether the llvm-mca support the assembly code for the ARM?

I cross-compile the test file for ARM like that: clang test.c -O2 -target arm-linux-gnueabihf -static -S -o test.s

If I want to check the performance using llvm-mca, is there any option of "-mcpu" for ARM ?


Thanks,
Yin


2018-05-07 21:52 GMT-04:00 <Matthew.Davis at sony.com<mailto:Matthew.Davis at sony.com>>:
Hi Yin,

From: llvm-dev <llvm-dev-bounces at lists.llvm.org<mailto:llvm-dev-bounces at lists.llvm.org>> On Behalf Of Yin Liu via llvm-dev
> Hello,
>
> As is known to all, there is a relationship between program's instructions and its execution time. In other words, we can estimate the execution time based on the number of program > instructions.
>
> I'm curious about what the relationship between IR instruction and execution time. I know the number of program instructions and the execution time is highly related to the
> platform and architecture, while the IR instruction is independent and intermediate. But, intuitively, there may be some relationship between IR instruction and execution time.
>
> Would it be possible to give me some advice about it?

What instructions finally get emitted by the compiler is highly dependent on the specified target.  As you pointed out, IR is relatively abstract, and can at best only generate a "rough" estimate to timing.  Maybe that loss of fidelity is acceptable in your case.  Be aware that there are also target specific optimizations that operate after the IR is lowered to a target friendly representation.  Any early approximation of IR performance will be less accurate after target specific optimization passes are ran.    For more accurate results, you will need to wait until the IR is lowered to the target architecture and emitted as assembly or object code.  But it seems that might be too late for what you are looking for.  In any case, if you do want to analyze the assembly code, then look no further than llvm's Machine Code Analyzer(MCA).  This tool takes an assembly code as input and generates throughput and latency information.  For more details see: https://llvm.org/docs/CommandGuide/llvm-mca.html

-Matt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180509/149bf0a9/attachment.html>


More information about the llvm-dev mailing list