Building Machine Learning Error

I am trying to include in your reference image the eIQ package following your tutorial .
It says to use the meta layer of meta-ml from the mickledore-6.1.22-2.0.0.0 branch while for the image it says to use the manifest from the kirkstone-6.x.y branch.
When trying to build the image I get the following error:
Layer meta-ml is not compatible with the core layer which only supports these series: kirkstone (layer is compatible with mickledore)
As far as I have been able to check the BSP 6.4.0 for the imx8m plus does not use kernel 6.1.22 so it is not possible to follow your recommendations.
I tried to use the meta layer of meta-ml from previous branches and I got failures with the arm-compute-library:

DEBUG: Executing shell function do_compile 
| scons: Reading SConscript files ...
| Unknown variables: MAXLINELENGTH 
| ERROR: scons build execution failed.

I had to roll back to the 5.15.32-2.0.0.0 branch of the meta-ml for the error to go away.
Could you point me to a solution so that I can use a newer branch for BSP 6.4.0.

I am using a Verdin imx8m plus module on a Dahlia board.

Any suggestions?
Thanks to all of you for your collaboration.
Julián

Hello @jbruno,

Layer meta-ml is not compatible with the core layer which only supports these series: kirkstone (layer is compatible with mickledore)

This error is caused by copying the whole meta-ml layer from meta-imx.

In our instructions, in the section Copying the Recipes to your environment, we describe steps to create a new layer, remove the example recipes, and then add the recipes from meta-ml.

The reason behind this is to guarantee a compatible layer.conf file on the meta-ml layer, therefore I would recommend that you follow the same steps to add meta-ml to your project.

As far as I have been able to check the BSP 6.4.0 for the imx8m plus does not use kernel 6.1.22 so it is not possible to follow your recommendations.

You are correct when you state that the Toradex BSP 6.4.0 for the Verdin iMX8M Plus does not use the 6.1.22 kernel for which the mickledore-6.1.22-2.0.0 meta-ml layer is intended for.
That being said, it works without issues based on our internal testing.

We took the same approach in the past, to enable newer machine learning libraries on the Toradex BSP 5.

Please let me know if this resolves the problems with the build process or if you face any other issues with the newer meta-ml integration.

Best Regards,
Bruno

Hi @bruno.tx,
After doing this:

$ mkdir -p ~/yocto-ml-build/bsp-toradex
$ cd ~/yocto-ml-build/bsp-toradex
$ repo init -u git://git.toradex.com/toradex-manifest.git -b kirkstone-6.x.y -m tdxref/default.xml
$ repo sync

The meta layer meta-ml is not in the directory tree. So if you copy the recipes with this command:
cp -r ../meta-imx/meta-ml/recipes-* ../layers/meta-ml/
the layer.conf is missing and when trying to build the build it fails.

If you copy the whole meta-ml folder, when you try to build the image you get the error I mention here:

Therefore and according to the private conversation, the proposed solution would be to copy the whole folder and modify the /meta-ml/conf/layer.conf file in the following way:

- LAYERSERIES_COMPAT_meta-ml = "mickledore"
+ LAYERSERIES_COMPAT_meta-ml = "kirkstone" 

this change solves the issue.

On the other hand, it makes me a little bit noisy to use ML libraries, which are intended for a newer kernel (6.1.X), in a distribution that has an older kernel (5.15.X). From some conversations with NXP technical support I thought I understood that there was some interdependency between the ML libraries and the kernel, so this solution proposed here would not be adequate.

We will need a few weeks to be able to test our algorithms with this new version of the libraries and verify that everything works correctly.

We are in contact.
Julián

Hi @bruno.tx,
We have tested our algorithms and they fail. Although you can compile the ML libraries (in their most recent version), as you are using an older kernel, it does not support the full instruction set and some bugs have not been fixed. It is similar to using older versions of these libraries.

We have consulted NXP technical support and they have confirmed that the ML libraries are kernel dependent and that NPU is inside the GPU driver.

On the other hand, following the steps recommended in this tutorial, PyTorch cannot be included.

I think the solution is, as they have done with the rest of SOM, to upgrade the imx8 family to kernel 6.1.

We are in contact.
Julián

Hi @jbruno,

Thanks for the update regarding the compatibility of your ML algorithms with the updated ML libraries on top of the Toradex BSP 6.

I will look further into the issue to see if there is something we can do about it with the current BSP.

As you said, the PyTorch version included in this version of meta-ml does not work with the current BSP, as it requires Python 3.11. This is something that can likely be worked around but would require some some effort to modify the BSP to work with Python 3.11.

Best Regards,
Bruno

Hi @jbruno

We looked at this issue and it seems as you wrote there are some bigger changes between the GPU/NPU driver we are using and what you would need to run the newest version of the ML framework. Unfortunately, there is no simple solution.

Compiling the latest GPU/NPU driver for kernel 5.15 is possible, but this will break the GPU stack. So if you need GPU support this will not work.

You could try to switch to the NXP BSP and include our kernel 5.15 in the BSP but most likely this will create new issues.

Because none of this is a solution, we can only ask you to wait for BSP7 where everything should be updated to a newer version.

Regards,
Stefan

Hi @stefan_e.tx,
I agree with you that this is not a solution, so my next question is: when will the first version of your BSP 7 be available?
Best Regards,
Julián

Hi @jbruno,

Unfortunately, I can’t tell you a date yet. The information I have is that it will not be here before July.

You could try to boot the NXP kernel and rootfs with our device tree. Most likely some things will not work (e.g. the MIPI DSI to HDMI stuff and most likely some more things) but it should boot and would allow you to test the MM-related stuff. However, we don’t support this at the moment.

Regards,
Stefan