[llvm-dev] Get llvm-mca results inside opt?

Lewis, Cannada via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 24 09:07:23 PST 2019


I am trying to generate performance models for specific pieces of code like an omp.outlined function. Lets say I have the following code:

start_collect_parallel_for_data(-1.0,-1.0,-1.0, size, “tag for this region”);
#pragma omp parallel for
for(auto i = 0; i < size; ++i){
	// … do work

The omp region will get outlined into a new function and what I would like to be be able to do in opt is compile just that function to assembly, for some target that I have chosen, run llvm-mca just on that function, and then replace the -1.0s with uOps Per Cycle, IPC, and Block RThroughput so that my logging code has some estimate of the performance of that region. 

Is there any reasonable way to do this from inside opt? I already have everything in place to find the start_collect_parallel_for_data calls and find the functions called between start and stop, but I could use some help with the rest of my idea.

-Cannada Lewis

More information about the llvm-dev mailing list