Programming the Steam Deck's GPU with Mojo and MAX

This morning’s nightly release has a fun addition: the ability to program the Steam Deck’s GPU using Mojo and MAX!

SteamOS 3.8 upgraded the version of the AMD HIP driver to one that was new enough to be used with Mojo and MAX (6.4.1), so when I saw that I knew exactly what we had to do. The Steam Deck contains within it an AMD Van Gogh APU with an RDNA2 GPU component. We registered the architecture in Mojo and MAX, and as you can see above that means that you can clone the modular repository and use any of our Mojo GPU programming examples.

If you want to try this at home, you need to make sure you’ve updated your Steam Deck to the latest OS version, then here are the steps to install the right dev tools. First, switch to Desktop Mode on your Steam Deck. Then go to Konsole (the terminal) and set a password for the system user via passwd if you haven’t already. To install packages, you’ll need to enable dev mode on your device:

sudo steamos-devmode enable

Once that’s enabled, install all the necessary AMD developer tools:

sudo pacman -S hip-runtime-amd rocminfo rocm-smi-lib rocm-hip-runtime

and then set the right permissions:

sudo usermod -aG render,video deck

After that, you should be good to use your Steam Deck like any other Linux development machine for Mojo and MAX. You’re not exactly going to be running Minimax M3 on here, but there’s something deeply satisfying about seeing Mojo code running on a handheld Linux system like this. Kudos to Valve for making this possible via SteamOS.

Some caveats right now: it looks like MAX graphs are currently writing out all-zeroes when run on the Steam Deck, so I’m investigating that. Additionally, we’ve been adding support for RDNA3 and newer AMD GPUs in MAX kernels, but haven’t yet put in place paths for RDNA2 GPUs like the Steam Deck, so full models won’t run until those are added. The kernels are all open-source, so if you want to help with compatibility on your hardware, that’d be welcome.

Super good,
this can also be an perfect controller for an computer running an mojo app too.
(With an screen)

I could definetly see this as an controller for an wider app,
with the small screen having more infos on it :smiley: .

The advantage is that both controller and app can use parts of the same mojo project.
Where as before historically, you’d have to use an different language for the controller.

So by not duplicating code, development is smoother :partying_face: