Verdin IMX8mp opencl gpu size

Hi teams,
- Verdin iMX8M Plus 8GB WB IT V1.1A
- bsp :linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules

we have some demo on llm, llm need more size in gpu.

Currently, the GPU memory size setting is 256MByte.
How can we change the setting to 512MByte, 1GB … etc?

We already tried the following method, but didn’t seem to change:

  • adding gpumem argument for Linux Kernel parameter
  • changing DeviceTree’s register mapping node of mix_gpu_ml
&mix_gpu_ml {
        reg = <0x0 0x40000000 0x0 0xC0000000>, <0x0 0x0 0x0 0x20000000>;

we use the clinfo the check the global memory, it always return 256M.

Does the gpu share dram with cpu?

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


For the Verdin iMX8M Plus module, adjusting the GPU memory size involves configuring the Contiguous Memory Allocator (CMA) size, as the GPU memory in this context is allocated from the CMA pool. The default CMA size is determined by the BSP settings, and for the Verdin iMX8M Plus, it is set to a maximum of 256MB or 25% of the DDR size, whichever is smaller, as per the BSP release notes you’ve referenced.

Since you’ve attempted to adjust the GPU memory size using the gpumem kernel parameter and modifying the Device Tree without success, it’s important to note that these methods might not directly influence the CMA allocation for the GPU. Instead, you should focus on adjusting the CMA size itself to provide more memory to the GPU.

To increase the CMA size for your Verdin iMX8M Plus module, you should:

  1. Modify the Kernel Boot Parameters: You can adjust the CMA size by passing a boot parameter to the kernel. This is done by adding cma=<size>M to the kernel command line, where <size> is the desired size in megabytes. For example, to set the CMA size to 512MB, you would add cma=512M to the kernel command line. This can be done in the U-Boot environment or through your bootloader configuration.

  2. Reconfigure the Device Tree: If the CMA size is defined within the Device Tree for your specific module, you may need to adjust it there as well. However, based on the context provided, the primary method for adjusting the CMA size on the Verdin iMX8M Plus should be through the kernel boot parameters rather than the Device Tree.

  3. Verify Changes: After making these changes, you should verify that the CMA size has been successfully increased by checking the kernel boot logs for messages indicating the allocated CMA size. Additionally, using tools like clinfo to check the available GPU memory should reflect the changes.

Yes, the GPU shares the DRAM with the CPU in this architecture. The CMA is used to allocate a contiguous block of memory in the DRAM that can be used by the GPU, ensuring that large buffers for graphics operations can be accommodated.

Please ensure that any changes made to the kernel command line or Device Tree are compatible with your system’s configuration and that you have backups of any files you modify.

Best regards,
Toradex AI

Please, also check if these links can help you solve your problem:

Contiguous Memory Allocator - CMA (Linux) | Toradex Developer Center.

Hi @nigel_wang , mix_gpu_ml by default defines 3GB region starting from 0x40000000 for phys_baseaddr and 256MB region starting from 0x0 for contiguous_mem. 3GB + 256MB are the entire memory region which is accessible by the GPU. Yes, GPU and CPU share the DDR RAM.

mix_gpu_ml: mix_gpu_ml {
		compatible = "fsl,imx8mp-gpu", "fsl,imx8-gpu-ss";
		cores = <&gpu_3d>, <&ml_vipsi>, <&gpu_2d>;
		reg = <0x0 0x40000000 0x0 0xC0000000>, <0x0 0x0 0x0 0x10000000>;
		reg-names = "phys_baseaddr", "contiguous_mem";
		status = "disabled";

thanks for your replay,
the default physical size is 0xC0000000 - 0x40000000 ? right?
I have another question, why when i use clinfo to get gpu info, it shows the size is 256MB?

The physical address for phys_baseaddr is from 0x4000_0000 to 0x1_0000_0000. I don’t know what kind of memory type clinfo returns and I have to look into it. What is the image installed on your Verdin iMX8M Plus SoM?

I follow above link to build our image with yocto