Creating Kernel Code
Making kernel code is pretty simple! Here’s what you need to know:
- Include the Essential Header
Always start by including the mu/mu.hpp header. It’s a must-have!#include "mu/mu.hpp"
-
Pick Your Host-Callable Functions
Choose which functions you want to call from the host.
Just remember to use MU_KERNEL_ADD macro to show it’s host-callable.For example:
void kernel_callable(int size) { ... } void host_callable(int* data, int size) { // Your awesome code here } MU_KERNEL_ADD(host_callable)
-
Keep Parameters in Check
You can use up to 9 parameters for your kernel function. No more! - Memory Constraints
- Heap Size: The kernel’s heap size is limited to 3MB.
- Stack Size: The kernel’s stack size is limited to 64KB.
Stick to these guidelines, and you’ll be creating great kernel code in no time!