MDAPI not supported on macOS
alexbatashev opened this issue · 8 comments
Observed Behavior
On macOS intercept layer is successfully compiled with MDAPI functionality enabled. However, the code for Darwin operating systems is incorrect. See:
opencl-intercept-layer/intercept/mdapi/MetricsDiscoveryHelper.cpp
Lines 49 to 50 in bf87e59
Although there's some kind of MDAPI implementation on macOS, it has a different library name:
objdump -t /System/Library/Extensions/AppleIntelKBLGraphicsGLDriver.bundle/Contents/MacOS/libigdmd.dylib
/System/Library/Extensions/AppleIntelKBLGraphicsGLDriver.bundle/Contents/MacOS/libigdmd.dylib: file format Mach-O 64-bit x86-64
SYMBOL TABLE:
0000000005614542 l d *UND* radr://5614542
0000000000089760 g F __TEXT,__text _CloseMetricsDevice
00000000002355b0 g F __TEXT,__text _ClosePerformanceInterface
0000000000089e40 g F __TEXT,__text _CloseTraceDevice
000000000008a000 g F __TEXT,__text _CreateMDAPIObjectFactory
One could have simply change lib name to the correct one, but then we run into another kind of problem:
opencl-intercept-layer/intercept/mdapi/intercept_mdapi.cpp
Lines 213 to 218 in bf87e59
CL_PROFILING_COMMAND_PERFCOUNTERS_INTEL
is not supported by Apple implementation (in fact, it will never be, as OpenCL is now deprecated on macOS).
Proposed solution
Disable MDAPI on macOS for good and mention this functionality as not supported in documentation to avoid confusion.
Without support from OpenCL runtime, I don't know any way to retrieve profiling data for specific kernel. If there's some, it would be great to know.
Hi, thank you for the report.
I agree that event based sampling is unlikely to be supported on OSX, but I've been meaning to enable time based sampling for all operating systems. Do you happen to know if MDAPI time based sampling is supported on OSX?
My first goal is to get time based sampling working on Linux, since event based sampling isn't working on Linux at the moment either. Once that's working though, I'll track down a Mac to try to enable time based sampling on OSX as well.
Hi @bashbaug,
Do you happen to know if MDAPI time based sampling is supported on OSX?
I'm not sure, but I see methods from MetricsDiscoveryInternal namespace as well as some OpenGL-related methods (INTEL_performance_query
extension, I guess). If you could point me to some sort of documentation/samples or at least show me what methods you'd like to see there, I could have told you for sure.
Once that's working though, I'll track down a Mac to try to enable time based sampling on OSX as well.
I think, we can collaborate on that.
Sorry, this likely unrelated here other than talking about OSX. I found that even the latest OSX on AVX-512 capable CPUs (i/Mac/Pro) does not permit AVX-512 as far as usual/correct CPUID tests determine. It's essentially not supporting the wider registers (ZMM) on a context switch (XSAVE). For LIBXSMM, I have enabled AVX-512 anyway under OSX along with issuing a warning (if library is in verbose state).
@hfp I think your problem is truly unrelated to what's discussed in this thread. Do you have any issue for that in your project? Can you please summon me there?
Sure, unrelated! I just wondered how OpenCL for CPUs would deal with newer iMac runing Xeon with AVX-512. So ignore then my comments please.
@hfp The only Intel supported CPU RT with AVX512 support is the Intel CPU Runtime for OpenCL applications 18.1. That build does not target macOS platform. Regarding feature support in Apple's OpenCL implementation please contact Apple.
Copying a comment from @alexbatashev here, so it doesn't get lost in my (merged) PR: #114 (comment)
"with a little bit of tuning this actually worked on my mac!"
Time based sampling is almost working on OSX, just have one more issue to work out!