mojo-gpu-fundamentals

Write, launch, and debug Mojo GPU kernels with TileTensor and shared memory.

7|1|Updated Apr 9, 2026
One-click install
npx skills add https://github.com/Hundo1018/wgpu-mojo --skill mojo-gpu-fundamentals-hundo1018
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mojo-gpu-fundamentals
Source: https://github.com/Hundo1018/wgpu-mojo/tree/main/.agents/skills/mojo-gpu-fundamentals
Command: npx skills add https://github.com/Hundo1018/wgpu-mojo --skill mojo-gpu-fundamentals-hundo1018

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill corrects common CUDA-based assumptions and provides concise, authoritative guidance for writing, launching, and managing GPU code in Mojo so developers avoid subtle correctness and performance mistakes.

Core Features & Use Cases

  • Maps familiar CUDA concepts to Mojo equivalents (kernels, launches, memory, and synchronization).
  • Explains TileTensor usage, layout creation, indexing, rebind rules, and vectorized access for correct element typing.
  • Documents buffer allocation, host-device copies, enqueue_function launch semantics, shared memory via stack_allocation, and DeviceContext workflows.
  • Use cases: porting CUDA kernels to Mojo, authoring tiled matmul and vector-add kernels, benchmarking and debugging mojo GPU code.

Quick Start

Translate this CUDA kernel into a correct Mojo kernel that uses TileTensor, stack_allocation for shared memory, and enqueue_function launch syntax.

Frequently Asked Questions about mojo-gpu-fundamentals

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate a CUDA kernel to Mojo without making correctness mistakes?

Migrating CUDA kernels to Mojo requires correcting common CUDA assumptions by mapping concepts to Mojo equivalents, utilizing TileTensor for layouts, and applying enqueue_function for launches to ensure accurate GPU execution.

How do I launch a Mojo GPU kernel with compile-time parameters?

Launching Mojo GPU kernels requires using the enqueue_function launch syntax with compile-time kernel parameters, ensuring proper host-device synchronization and DeviceContext buffer creation to execute correctly.

How does TileTensor indexing and rebind work for Mojo GPU programming?

TileTensor in Mojo GPU programming manages layout creation and indexing, enforcing vectorized access and rebind rules to guarantee correct element typing for kernel buffers.

Can I use stack_allocation for shared memory when porting CUDA idioms to Mojo?

Yes, Mojo GPU programming replaces CUDA shared memory patterns by using stack_allocation to manage shared memory buffers within DeviceContext workflows for kernel execution.

What is the best way to benchmark and debug Mojo GPU code?

Benchmarking and debugging Mojo GPU code involves validating DeviceContext copy semantics, host-device synchronization, and TileTensor rebind usage to identify subtle performance and correctness mistakes.

Why does my vector addition kernel fail when moving from CUDA to Mojo?

Vector addition kernels fail during CUDA to Mojo migration due to incorrect enqueue_function launch syntax, improper TileTensor indexing, or unresolved DeviceContext buffer copy semantics.