intel / ittapi

Intel® Instrumentation and Tracing Technology (ITT) and Just-In-Time (JIT) API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Where is `IttnotifyInfo` defined/declared?

iamkroot opened this issue · comments

LLVM includes the IntelJITEventsWrapper that was updated in Profiling the code generated by MCJIT engine using Intel VTune profiler.

The commit message mentions-

To overcome limitations described above, we have introduced new APIs as a part of Intel ITT APIs to report the entire in-memory ELF module to be further processed as regular ELF binaries with debug information.

And from the diff, it seems to revolve around calling the iJitIttNotifyInfo func with the memory region that contains the generated ELF.

...Except, IttnotifyInfoFunc is initialized to 0. And there is no mention of a similarly-named method inside jitprofiling.h as there is for iJIT_NotifyEvent (the older API).

As a result, the default IntelJITEventListener in LLVM is totally non-functional. It simply ignores the events when IttnotifyInfoFunc is 0.

So the question is- where is IttnotifyInfoFunc declared, and how can we use it from inside the LLVM listener?

@iamkroot, we use iJitIttNotifyInfo functionality only for testing purposes in the llvm-jitlistener tool.

To create an Intel JIT event listener for the llvm-jitlistener we provide it with the IttnotifyInfo function
in llvm/tools/llvm-jitlistener/llvm-jitlistener.cpp

image

Could you please describe how you would you like to use these listeners?
Theoretically, we could link the functionality of this LLVM listener with __itt_module_load_with_sections and __itt_module_unload_with_sections ITT APIs

Could you please describe how you would you like to use these listeners?

I have a JIT-ted program running through LLVM's MCJIT ExecutionEngine. I want to profile this using VTune (great software!), but my code is heavily inlined.

From reading the LLVM PR, I assumed that this was something that we could handle out-of-the-box using IntelJITEventListener. But as you mentioned, the iJitIttNotifyInfo is only used for debugging/dumping the ELF and is not calling anything on the VTune/ittnotify side in the default listener.

Theoretically, we could link the functionality of this LLVM listener with __itt_module_load_with_sections and __itt_module_unload_with_sections ITT APIs

Would that handle inlined functions? I also see iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED inside jitprofiling.c, and was planning to use that instead.

I have a JIT-ted program running through LLVM's MCJIT ExecutionEngine. I want to profile this using VTune (great software!), but my code is heavily inlined.

Well, since your JIT-ted program running through LLVM's MCJIT ExecutionEngine you just need to make sure that it was compiled with DLLVM_USE_INTEL_JITEVENTS=ON option. LLVM's MCJIT already has VTune profiling support and you do not need to make changes in LLVM project.

From reading the LLVM PR, I assumed that this was something that we could handle out-of-the-box using IntelJITEventListener. But as you mentioned, the iJitIttNotifyInfo is only used for debugging/dumping the ELF and is not calling anything on the VTune/ittnotify side in the default listener.

MCJIT already instrumented with ITT API __itt_module_load_with_sections which dumps ELF file and provides VTune with all the necessary information during profiling.
In this case inlines are not a problem :)
And you do not need the iJitIttNotifyInfo functionality, we have it only for testing purposes in the llvm-jitlistener tool.

Also I would like to note, that in case of VTune attach to a launched application, we recommend to manually set INTEL_LIBITTNOTIFY64 (and INTEL_LIBITTNOTIFY32 for 32 bit) environment variable before launching the application.

@iamkroot sorry for the delayed reply, I was on a vacation.