This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Not able to trace OpenCL api's using MGD V.4.2.1

I am trying to trace the OpenCL calls using the MGD V4.2.1 but I don't see any calls being traced.

I have done the setup both on the target and host side and able to trace the OpenGL calls using the same setup.

Setup I have done on my host and target:

adb remount

adb push "C:\Program Files\ARM\Mali Developer Tools\Mali Graphics Debugger v4.2.0\target\android\arm\mgddaemon" /system/bin/mgddaemon

adb push "C:\Program Files\ARM\Mali Developer Tools\Mali Graphics Debugger v4.2.0\target\android\arm\egl.cfg"  /vendor/lib/egl/egl.cfg

adb push "C:\Program Files\ARM\Mali Developer Tools\Mali Graphics Debugger v4.2.0\target\android\arm\egl.cfg"  /vendor/lib64/egl/egl.cfg

adb push "C:\Program Files\ARM\Mali Developer Tools\Mali Graphics Debugger v4.2.0\target\android\arm\armeabi-v7a\libGLES_mgd.so" /vendor/lib/egl/libGLES_mgd.so

adb push "C:\Program Files\ARM\Mali Developer Tools\Mali Graphics Debugger v4.2.0\target\android\arm\arm64-v8a\libGLES_mgd.so" /vendor/lib64/egl/libGLES_mgd.so

adb shell chmod 777 /system/bin/mgddaemon

adb shell chmod 777 /vendor/lib/egl/*

adb shell chmod 777 /vendor/lib64/egl/*

adb shell ln -s /vendor/lib/egl/libGLES_mgd.so /vendor/lib/egl/libGLES.so

adb shell ln -s /vendor/lib64/egl/libGLES_mgd.so /vendor/lib64/egl/libGLES.so

adb forward tcp:5002 tcp:5002

After doing all these setup I am able to run the mgddaemon on the host side and able to connect host to target but can't see any OpenCL calls in MGD.

I am using the 64bit kernel and 64bit Android M and application that I am using to trace for tracing the calls is Opencl-X Benchmark.

Need help to figure out what I am missing so that I can trace the calls?

  • An OpenCL application doesn't link libGLES.so, so shimming the graphics driver isn't going to work. There isn't a standard OpenCL library name for Android, so I can't tell you exactly how you have linked that, but you need to set up the OpenCL library as a symlink in the same way that you've set up the libGLES.so symlink.

    HTH,
    Pete

  • Thanks Pete for you response. I am curious that if there no standard OpenCL library in the Android then how will MGD be able to trace the OpenCL application.

    In my case both OpenGL and OpenCL are build into one single libGLES_mali.so. I have linked my OpenCL application to this lib and trying to run it from the Android Shell but not able to get any traces in the MGD because as you mentioned there is no symlink.

    I am not sure what and where to create the symlink. Need help with the same.

    Regards

    Virender

  • You can't link against libGLES_mali.so directly when trying to insert a layer driver - you need to create an intermediate name to bounce the redirection off.

    The process needs to be something like this:

    When building your application:

    1. Rename libGLES_mali.so to libOpenCL.so and link against that.
    2. Ensure you do not link statically so it will search for the libOpenCL.so library on the target device.

    When running your application normally:

    1. On the target create a symlink called libOpenCL.so to point at libGLES_mali.so.

    When running your application with MGD:

    1. On the target create a symlink called libOpenCL.so to point at libGLES_mgd.so.
    2. The MGD interceptor should then correctly auto-load libGLES_mali.so when needed.

    Let me know how that goes.

    Cheers,
    Pete

  • Thanks Pete for your suggestion. Its working for me now. I am able to get the API trace in the MGD with above steps.

    Cheers

    Virender