Rick Veens via llvm-dev
2017-Nov-09 12:41 UTC
[llvm-dev] Get basic-block cycle cost from LLVM
Hi all, I'm interested in obtaining the cycles spend by the CPU from LLVM and i was wondering if this was possible to obtain this with the scheduling information from LLVM. (For the cortex-m0 in particular). I found the following function : getInstrLatency() in the TargetInstrInfo class. If i sum the latencies of the instructions in a basic block i suppose i will get the total cycle cost for the cortex-m0.>From what i understand is that there are multiple ways of doing schedulingin LLVM. I have read about one way which is using Itenaries and another which is using SchedMachineModel. Will the above function always give me the latencies, independent on the scheduling method used ? Sorry if this is a stupid question, i'm a beginner to LLVM. Best regards, Rick Veens -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171109/1bd42dfd/attachment.html>
I believe so, though I am not expert in this field. :) 2017-11-09 20:41 GMT+08:00 Rick Veens via llvm-dev <llvm-dev at lists.llvm.org> :> Hi all, > > I'm interested in obtaining the cycles spend by the CPU from LLVM and i > was wondering if this was possible to obtain this with the scheduling > information from LLVM. (For the cortex-m0 in particular). > > I found the following function : getInstrLatency() in the TargetInstrInfo > class. > > If i sum the latencies of the instructions in a basic block i suppose i > will get the total cycle cost for the cortex-m0. > > From what i understand is that there are multiple ways of doing scheduling > in LLVM. > I have read about one way which is using Itenaries and another which is > using SchedMachineModel. > > Will the above function always give me the latencies, independent on the > scheduling method used ? > > Sorry if this is a stupid question, i'm a beginner to LLVM. > > Best regards, > > Rick Veens > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-- Wei-Ren Chen (陳韋任) Homepage: https://people.cs.nctu.edu.tw/~chenwj -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171110/1a67bb29/attachment.html>
CC'ed the list. I agreed. Since Rick tends to compute latency for cortex-m0, I think the result is okay? 2017-11-11 4:22 GMT+08:00 UE US <uexplorer666 at gmail.com>:> The related functions compute scheduling hazards at the DAG level and use > it for optimization purposes. They can provide info ALUs which have a > defined latency, but otherwise guess both MachineInstructions and > TargetInstructions to be one cycle, which isn't true for most processors or > instructions these days. You'd likely get reasonable results out of MIPS > or ARM with it, but I don't think x86 models all of the instructions well > enough to be accurate. It's mainly for schduling ALU instructions > alongside AVX and AGU and making sure their counts (execution + op) match > up in a way that will allow simultaneous execution on the same core and > prefetch as close to optimal as possible, as I understand things. > Splitting a basic block naively might cause various extra cycles to occur, > and according to Intel the instruction reordering hardware isn't free > either. With prefetches, branch prediction, reordering, and speculative > execution there are too many factors to do more than best predict what will > run best on the machine knowing those cycles, but they're more of a > guideline. > > GNOMETOYS > > On Fri, Nov 10, 2017 at 8:22 AM, 陳韋任 via llvm-dev <llvm-dev at lists.llvm.org > > wrote: > >> I believe so, though I am not expert in this field. :) >> >> 2017-11-09 20:41 GMT+08:00 Rick Veens via llvm-dev < >> llvm-dev at lists.llvm.org>: >> >>> Hi all, >>> >>> I'm interested in obtaining the cycles spend by the CPU from LLVM and i >>> was wondering if this was possible to obtain this with the scheduling >>> information from LLVM. (For the cortex-m0 in particular). >>> >>> I found the following function : getInstrLatency() in the TargetInstrInfo >>> class. >>> >>> If i sum the latencies of the instructions in a basic block i suppose i >>> will get the total cycle cost for the cortex-m0. >>> >>> From what i understand is that there are multiple ways of doing >>> scheduling in LLVM. >>> I have read about one way which is using Itenaries and another which is >>> using SchedMachineModel. >>> >>> Will the above function always give me the latencies, independent on the >>> scheduling method used ? >>> >>> Sorry if this is a stupid question, i'm a beginner to LLVM. >>> >>> Best regards, >>> >>> Rick Veens >>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> llvm-dev at lists.llvm.org >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>> >>> >> >> >> -- >> Wei-Ren Chen (陳韋任) >> Homepage: https://people.cs.nctu.edu.tw/~chenwj >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> >-- Wei-Ren Chen (陳韋任) Homepage: https://people.cs.nctu.edu.tw/~chenwj -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171111/7bf9d950/attachment.html>
Reasonably Related Threads
- [LLVMdev] Instruction Scheduling - migration from v3.1 to v3.2
- Instruction Itineraries: question about operand latencies
- Instruction Itineraries: question about operand latencies
- variable instruction latency using itineraries
- Is there a way to convert between SchedMachineModel and Itineraries?