### Install Makora CLI from Source Source: https://docs.makora.com/getting-started Install the Makora CLI in editable mode directly from the source code. ```bash pip install -e . ``` -------------------------------- ### Expert Generate Command Example Source: https://docs.makora.com/commands Provides an example of generating an optimized CUDA kernel for the default L40S device using 'makora expert-generate'. ```bash # Generate optimized CUDA kernel for L40S (default) makora expert-generate kernel.py ``` -------------------------------- ### Run Example Script Source: https://docs.makora.com/skills Execute a provided shell script to generate a solution for an example problem. This script loads the problem definition, invokes the Claude Code plugin, and outputs the results. ```bash ./examples/run-example.sh kernelbench-problem-1 ``` -------------------------------- ### Install Makora Source: https://docs.makora.com/ Installs the Makora package using pip. This is the first step to using Makora's CLI. ```bash pip install makora ``` -------------------------------- ### Install Claude Code Plugin Source: https://docs.makora.com/commands Use this command to install the Claude Code plugin for Makora. The output confirms the successful installation. ```bash makora install claude ``` -------------------------------- ### Example Instruction File for Matrix Multiply Optimization Source: https://docs.makora.com/commands An example instruction file (`h100-matmul-hints.txt`) detailing specific CUDA knowledge for optimizing a matrix multiply on H100 GPUs, including asynchronous warp-specialized persistent kernels and tiling strategies. ```text Use an asynchronous warp-specialized persistent kernel design for this matmul: 1. Partition warps into producer and consumer roles. Producer warps issue cp.async (or TMA on H100) to load tiles from global memory into shared memory. Consumer warps compute on the previously loaded tiles using tensor core mma instructions (m16n8k16 for fp32 accum). 2. Use multi-stage software pipelining with at least 3 shared memory buffers so that loads, computes, and stores can overlap across pipeline stages. 3. Use the following tiling: - Thread block tile: 128x256xK - Warp tile: 64x64xK - Use ldmatrix (PTX: ldmatrix.sync.aligned.m8n8.x4) for shared-to-register loads to feed the tensor cores efficiently. 4. Use inline PTX for the cp.async instructions: asm volatile("cp.async.cg.shared.global [%0], [%1], %2;" :: "r"(smem_ptr), "l"(gmem_ptr), "n"(16)); asm volatile("cp.async.commit_group;"); asm volatile("cp.async.wait_group %0;" :: "n"(stages - 2)); 5. Epilogue: use vectorized 128-bit stores (float4) to write the result tile back to global memory with full memory coalescing. ``` -------------------------------- ### Profile Command Examples Source: https://docs.makora.com/commands Demonstrates how to use the 'makora profile' command to analyze kernel performance on different devices. Specify the problem and solution files, and optionally the target device. ```bash # Profile on default device (H100) makora profile problem.py solution.py # Profile on H100 makora profile problem.py solution.py --device H100 # Profile on AMD MI300X makora profile problem.py solution.py --device MI300x ``` -------------------------------- ### Install Makora Plugin for Claude Source: https://docs.makora.com/commands Installs the Makora plugin into Claude Code, enabling direct access to GPU optimization tools within coding sessions. Requires prior login. ```bash pip install makora-skills ``` ```bash makora login ``` ```bash makora install claude ``` -------------------------------- ### Raw Metrics Example Source: https://docs.makora.com/commands Displays raw hardware performance counters and execution statistics for a kernel. Useful for initial performance diagnosis. ```text Metrics: duration_ns: 491234 registers_per_thread: 32 shared_memory_bytes: 8192 grid_size: [128, 1, 1] block_size: [256, 1, 1] occupancy: 0.75 ``` -------------------------------- ### Model Class with Constructor Arguments Source: https://docs.makora.com/problem-format An example of a Model class that accepts constructor arguments, demonstrating how get_init_inputs should provide them. ```python class Model(nn.Module): def __init__(self, in_features, out_features): super().__init__() self.weight = nn.Parameter(torch.randn(out_features, in_features)) def forward(self, x: torch.Tensor) -> torch.Tensor: return x @ self.weight.T def get_init_inputs(): return [1024, 2048] # in_features=1024, out_features=2048 ``` -------------------------------- ### Makora Generate with Instruction Context Source: https://docs.makora.com/commands Provide optimization hints and context by referencing an instruction file. This guides the generation process with specific optimization strategies. ```bash makora generate --file problem.py --device H100 --instr optimization-hints.txt ``` -------------------------------- ### Install Claude Code Plugin Source: https://docs.makora.com/skills Install the Makora plugin for Claude Code. This command clears the plugin cache, installs the latest marketplace configuration, and adds the Makora plugin with all its skills. ```bash makora install claude ``` -------------------------------- ### Detailed Kernel Metrics Example Source: https://docs.makora.com/commands Provides a detailed breakdown of kernel execution, including compute/memory throughput, occupancy, and warp execution efficiency. This output is generated by the 'makora profile' command. ```text Profiling code... Profiling successful! Profiled 2 kernel(s): --- Kernel 1 --- Metrics: duration_ns: 491234 registers_per_thread: 32 shared_memory_bytes: 49152 grid_size: [128, 1, 1] block_size: [256, 1, 1] Details: Compute Throughput: 78.3% Memory Throughput: 45.2% Achieved Occupancy: 75.0% Warp Execution Eff: 98.4% Nsys Report: Time(%) Total Time (ns) Instances Avg (ns) Kernel Name ------- --------------- --------- --------- ----------- 85.2% 491234 1 491234 matmul_kernel 14.8% 85432 1 85432 elementwise_add --- Kernel 2 --- ... ``` -------------------------------- ### Basic Makora Generate Command Source: https://docs.makora.com/commands Use this command to start the code generation process for a Python file. Specify the target device for optimization. ```bash makora generate --file problem.py --device H100 ``` -------------------------------- ### Get Init Inputs Function (No Arguments) Source: https://docs.makora.com/problem-format Returns an empty list when the Model constructor requires no arguments. ```python def get_init_inputs(): return [] # No constructor arguments ``` -------------------------------- ### Check Makora CLI Version Source: https://docs.makora.com/skills Use this command to verify your Makora installation and check your logged-in user information. Ensure you are logged in and have the correct environment variables set. ```bash makora info ``` -------------------------------- ### Run Makora with Expert Matrix Multiply Instructions Source: https://docs.makora.com/commands Execute the Makora generation command with a specific instruction file to guide the optimization of a matrix multiply kernel on H100 GPUs. ```bash makora generate --file matmul.py --device H100 --instr h100-matmul-hints.txt ``` -------------------------------- ### Authenticate Makora Source: https://docs.makora.com/ Logs into your Makora account. This command is required after installation to authenticate your CLI usage. ```bash makora login ``` -------------------------------- ### Check Makora Problem File Source: https://docs.makora.com/problem-format Validates a PyTorch model file without starting an optimization session. ```bash makora check problem.py ``` -------------------------------- ### Execute Makora Optimize Command Source: https://docs.makora.com/skills Use this slash command directly in Claude Code to iteratively optimize a CUDA/Triton kernel. Claude will guide you through the optimization process. ```bash /makora-plugin:optimize ``` -------------------------------- ### Get Inputs Function Source: https://docs.makora.com/problem-format Provides input tensors for the Model's forward method. Tensors must be on CPU and use explicit dtypes if precision is critical. ```python def get_inputs(): A = torch.rand(N, N) B = torch.rand(N, N) return [A, B] ``` -------------------------------- ### Execute Makora Generate Command Source: https://docs.makora.com/skills Use this slash command directly in Claude Code to generate an optimized Triton kernel from a problem description. This provides a starting point for your kernel. ```bash /makora-plugin:generate ``` -------------------------------- ### Validate Problem File Source: https://docs.makora.com/commands Validates a problem file by running compilation, preparation, and benchmarking checks without starting a full optimization session. Use this for quick error detection before committing code. ```bash # Validate on default device (H100) makora check problem.py ``` ```bash # Validate for a specific device makora check problem.py --device L40S ``` ```bash makora check problem.py --device MI300X ``` -------------------------------- ### Search GPU Documentation Source: https://docs.makora.com/commands Searches Makora's document database for GPU programming references. Use this to find relevant documentation. ```bash makora document-search "CUDA shared memory bank conflicts" ``` ```bash makora document-search "matrix multiplication optimization" --max-entries 10 ``` -------------------------------- ### Search GPU Documentation with Filters Source: https://docs.makora.com/commands Searches for GPU documentation, allowing filtering by language and architecture. Use this for targeted documentation retrieval. ```bash makora search-docs "warp shuffle instructions" ``` ```bash makora search-docs "memory hierarchy" --architecture MI300X ``` ```bash makora search-docs "kernel launch configuration" --language cuda ``` -------------------------------- ### List All Kernels Source: https://docs.makora.com/commands Lists all available kernels for a given session ID. This command helps in identifying and managing different kernel versions. ```bash # List all kernels from a session makora kernels a1b2c3d4 ``` -------------------------------- ### Basic Solution File Structure Source: https://docs.makora.com/problem-format Defines the basic structure for a solution file, including a new Model class and a placeholder for the optimized implementation. ```python import torch import torch.nn as nn class ModelNew(nn.Module): def __init__(self): super().__init__() def forward(self, A: torch.Tensor, B: torch.Tensor) -> torch.Tensor: # Optimized implementation here ... ``` -------------------------------- ### CUDA Solution Layout with Triton Source: https://docs.makora.com/problem-format Demonstrates how to integrate a CUDA kernel using load_inline for optimized matrix multiplication within a PyTorch model. ```python import torch import torch.nn as nn from torch.utils.cpp_extension import load_inline cuda_source = """ #include #include __global__ void matmul_kernel(const float* A, const float* B, float* C, int N) { // ... CUDA kernel implementation } torch::Tensor matmul_cuda(torch::Tensor A, torch::Tensor B) { // ... launch kernel } """ cpp_source = "torch::Tensor matmul_cuda(torch::Tensor A, torch::Tensor B);" matmul_module = load_inline( name="matmul_cuda", cpp_sources=cpp_source, cuda_sources=cuda_source, functions=["matmul_cuda"], verbose=False, ) class ModelNew(nn.Module): def __init__(self): super().__init__() def forward(self, A: torch.Tensor, B: torch.Tensor) -> torch.Tensor: return matmul_module.matmul_cuda(A.cuda(), B.cuda()) ``` -------------------------------- ### Select Language with `--language` Flag Source: https://docs.makora.com/supported-hardware Explicitly choose a programming language for a specific device using the `--language` flag. If not specified, Makora uses the device's default language. ```bash # Use Triton on H100 (instead of default CUDA) makora generate --file problem.py --device H100 --language triton ``` ```bash # Use Triton on MI300X (instead of default HIP) makora generate --file problem.py --device MI300X --language triton ``` -------------------------------- ### Pipe Kernel Generation Output to File Source: https://docs.makora.com/commands Generates a kernel and pipes its standard output directly to a solution file. Use this for saving generated code. ```bash makora expert-generate kernel.py --problem problem.py > solution.py ``` -------------------------------- ### Makora Jobs Command Source: https://docs.makora.com/commands List all optimization sessions and their current status. Use the `--fast` flag to skip fetching extra data for quicker output. ```bash makora jobs ``` ```bash makora jobs --fast ``` -------------------------------- ### Combine Multiple Instruction Files Source: https://docs.makora.com/commands Multiple instruction files can be combined using the `--instr` flag to provide comprehensive guidance to the optimization agent. ```bash makora generate --file problem.py --device H100 --instr technique.txt --instr constraints.txt ``` -------------------------------- ### Submit PyTorch Model for GPU Kernel Optimization Source: https://docs.makora.com/getting-started Use the 'makora generate' command to submit your problem file for optimization on a specified GPU device. Makora will validate, compile, and benchmark the operation. ```bash makora generate --file problem.py --device H100 ``` -------------------------------- ### Search GPU Code Optimization Snippets Source: https://docs.makora.com/commands Searches for GPU code optimization snippets and techniques. Use this to find reusable optimization patterns. ```bash makora search-snippets "matrix multiplication tiling" ``` ```bash makora search-snippets "fused attention kernel" --language triton --architecture H100 ``` ```bash makora search-snippets "memory coalescing" --max-entries 10 ``` -------------------------------- ### Generate Kernel with Problem File Context Source: https://docs.makora.com/commands Generates a kernel using a specified problem file for context. This is a basic generation command. ```bash makora expert-generate kernel.py --problem problem.py ``` -------------------------------- ### Log in to Makora CLI with API Token Source: https://docs.makora.com/getting-started Authenticate with the Makora service by logging in. You can either be prompted to paste your token or provide it directly via a command-line argument. ```bash makora login ``` ```bash makora login --token YOUR_TOKEN ``` -------------------------------- ### Execute Makora Search Docs Command Source: https://docs.makora.com/skills Use this slash command directly in Claude Code to search for relevant GPU programming documentation and API references. ```bash /makora-plugin:search-docs ``` -------------------------------- ### Evaluate Optimized Kernel Performance Source: https://docs.makora.com/getting-started Benchmark your optimized kernel against the original PyTorch operation using the 'makora evaluate' command. This compares performance on real hardware. ```bash makora evaluate problem.py solution.py --device H100 ``` -------------------------------- ### Use --instr Flag to Provide Optimization Guidance Source: https://docs.makora.com/commands Steer the Makora optimization agent by providing expert knowledge through instruction files using the `--instr` flag. This allows for pair-programming with the AI agent. ```bash makora generate --file problem.py --device H100 --instr hints.txt ``` -------------------------------- ### Expert Generate Command Usage Source: https://docs.makora.com/commands Shows the basic usage for the 'makora expert-generate' command, which creates a single optimized GPU kernel. The command requires the path to the kernel file. ```bash makora expert-generate [options] ``` -------------------------------- ### Specify Device with `--device` Flag Source: https://docs.makora.com/supported-hardware Use the `--device` or `-d` flag to specify the target hardware for Makora commands. Device enum names can be used directly. ```bash makora generate --file problem.py --device H100 ``` ```bash makora generate --file problem.py --d MI300X ``` ```bash makora evaluate problem.py solution.py --device "Adreno 830" ``` ```bash makora check problem.py --device L40S ``` -------------------------------- ### Execute Makora Search Snippets Command Source: https://docs.makora.com/skills Use this slash command directly in Claude Code to search for GPU optimization snippets and techniques from curated sources. ```bash /makora-plugin:search-snippets ``` -------------------------------- ### Interactive Login Source: https://docs.makora.com/commands Use this command to interactively log in to the Makora API. It will prompt for your token if not provided. ```bash makora login ``` -------------------------------- ### Generate with Tighter Tolerances Source: https://docs.makora.com/problem-format Generates optimized kernels with tighter absolute and relative tolerances (1e-5). Recommended for high-precision workloads. ```bash # Tighter tolerances for high-precision workloads makora generate --file problem.py --device H100 --atol 1e-5 --rtol 1e-5 ``` -------------------------------- ### Triton Solution Layout Source: https://docs.makora.com/problem-format Shows the structure for a Triton-based solution, including the Triton kernel definition and its integration into a PyTorch model. ```python import torch import torch.nn as nn import triton import triton.language as tl @triton.jit def matmul_kernel( a_ptr, b_ptr, c_ptr, M, N, K, stride_am, stride_ak, stride_bk, stride_bn, stride_cm, stride_cn, BLOCK_SIZE_M: tl.constexpr, BLOCK_SIZE_N: tl.constexpr, BLOCK_SIZE_K: tl.constexpr, ): # ... Triton kernel implementation pass class ModelNew(nn.Module): def __init__(self): super().__init__() def forward(self, A: torch.Tensor, B: torch.Tensor) -> torch.Tensor: M, K = A.shape K, N = B.shape C = torch.empty(M, N, device=A.device, dtype=A.dtype) # ... launch Triton kernel return C ``` -------------------------------- ### View Reference Code Source: https://docs.makora.com/commands Retrieves and displays the original reference code (problem file) used for a specific session. This is essential for understanding the baseline implementation. ```bash # View the original problem code makora refcode a1b2c3d4 ``` -------------------------------- ### View and Save Specific Kernel Details Source: https://docs.makora.com/getting-started Inspect the code and performance of a particular kernel by providing its session and kernel IDs. You can also save the best kernel to a Python file. ```bash makora kernels a1b2c3d4 b5a6c7d8 ``` ```bash makora kernels a1b2c3d4 b5a6c7d8 -o solution.py ``` -------------------------------- ### Evaluate Optimized Kernel Source: https://docs.makora.com/commands Benchmarks an optimized kernel against a reference implementation on remote hardware. It returns execution times and calculates the speedup, providing insights into performance improvements. ```bash # Evaluate on default device (H100) makora evaluate problem.py solution.py ``` ```bash # Evaluate on H100 makora evaluate problem.py solution.py --device H100 ``` ```bash # Evaluate on AMD MI300X makora evaluate problem.py solution.py --device MI300x ``` -------------------------------- ### Display Makora Info Source: https://docs.makora.com/commands Shows version information, login status, and environment variable settings for the Makora CLI. Useful for debugging and environment checks. ```bash makora info ``` -------------------------------- ### Generate and Optimize Code Source: https://docs.makora.com/commands Runs code generation and optimization on a specified problem file for a target device. Supports various kernel languages and optimization options. ```bash makora generate --file --device [options] ``` -------------------------------- ### Generate Kernel with Speedup Context Source: https://docs.makora.com/commands Generates a kernel while providing the current speedup value as context. Useful for iterative optimization. ```bash makora expert-generate kernel.py --problem problem.py --speedup 1.5 ``` -------------------------------- ### List Kernels for a Makora Session Source: https://docs.makora.com/getting-started View all generated kernels for a specific optimization session using 'makora kernels '. This lists attempts, kernel IDs, and performance metrics. ```bash makora kernels a1b2c3d4 ``` -------------------------------- ### Natural Language Snippet Search Request Source: https://docs.makora.com/skills Use natural language to search for GPU optimization techniques. Mention the specific technique or problem, such as matrix multiplication. ```text Search for GPU optimization techniques for matrix multiplication. ``` -------------------------------- ### Execute Makora Evaluate Command Source: https://docs.makora.com/skills Use this slash command directly in Claude Code to evaluate your GPU code against a reference implementation. Claude will prompt you for necessary inputs like file paths. ```bash /makora-plugin:evaluate ``` -------------------------------- ### View Best Kernel Code Source: https://docs.makora.com/commands Displays the source code of the best-performing kernel for a given session ID and kernel ID. Use this to examine the most efficient implementation. ```bash # View best kernel's code makora kernels a1b2c3d4 b5a6c7d8 ``` -------------------------------- ### View Kernel Code Source: https://docs.makora.com/commands Displays the full source code of specified kernels along with their performance metrics. Use this to inspect the generated code and its performance characteristics. ```bash makora kernels a1b2c3d4 b5a6c7d8 ``` -------------------------------- ### Natural Language Evaluation Request Source: https://docs.makora.com/skills Use natural language to ask Claude to evaluate your kernel. Specify the solution and reference file paths. This leverages the Makora plugin for the evaluation task. ```text Evaluate my kernel in solution.py against the reference in problem.py using Makora. ``` -------------------------------- ### Makora Generate for AMD Device Source: https://docs.makora.com/commands Generate optimized code for AMD hardware by specifying the appropriate device. This command targets MI300X. ```bash makora generate --file problem.py --device MI300X ``` -------------------------------- ### Makora Kernels Command Source: https://docs.makora.com/commands View optimized kernels generated by a session. You can list all kernels for a session, view a specific kernel's code and performance, or save kernel code to a file. ```bash makora kernels a1b2c3d4 ``` ```bash makora kernels a1b2c3d4 ``` ```bash makora kernels a1b2c3d4 -o ``` -------------------------------- ### Natural Language Optimization Request Source: https://docs.makora.com/skills Use natural language to request optimization for a specific kernel and target hardware. This command utilizes the Makora plugin to perform the optimization. ```text Optimize the kernel in solution.py for H100. ``` -------------------------------- ### Hint for Using --fix Flag Source: https://docs.makora.com/commands If a run fails without the `--fix` flag, a hint is provided suggesting its use for automatic fix suggestions. ```bash Hint: try generating with --fix to get automatic fix suggestions: makora generate --file problem.py --device H100 --fix ``` -------------------------------- ### Convert Standalone PyTorch Code to Makora Format Source: https://docs.makora.com/problem-format Converts standalone PyTorch code to the Makora problem file format by moving operations to Model.forward(), input creation to get_inputs(), and constructor arguments to get_init_inputs(). Removes GPU device placement from input creation. ```python import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, A: torch.Tensor, B: torch.Tensor) -> torch.Tensor: return torch.matmul(A, B) def get_inputs(): return [torch.rand(1024, 1024), torch.rand(1024, 1024)] def get_init_inputs(): return [] ``` -------------------------------- ### Expert Generate Command Output Redirection Source: https://docs.makora.com/commands Illustrates how to redirect the output of 'makora expert-generate' to a file. Kernel code is sent to stdout, while status messages go to stderr. ```bash makora expert-generate kernel.py > optimized_kernel.py ``` -------------------------------- ### Generate with Default Tolerances Source: https://docs.makora.com/problem-format Generates optimized kernels using default absolute and relative tolerances (0.01). Suitable for most float32 operations. ```bash # Default (atol=0.01, rtol=0.01) — good for most float32 operations makora generate --file problem.py --device H100 ``` -------------------------------- ### Makora Generate with Custom Tolerances Source: https://docs.makora.com/commands Generate optimized code while specifying custom absolute and relative tolerances for numerical comparisons. This allows for fine-grained control over optimization accuracy. ```bash makora generate --file problem.py --device H100 --atol 1e-3 --rtol 1e-3 ``` -------------------------------- ### Makora Generate with Triton Language Source: https://docs.makora.com/commands Generate optimized code specifically for Triton, targeting a specified device. Ensure the `--language triton` flag is used. ```bash makora generate --file problem.py --device H100 --language triton ``` -------------------------------- ### Define a PyTorch Model for Optimization Source: https://docs.makora.com/getting-started This Python code defines a simple PyTorch module for matrix multiplication and provides functions to generate input tensors for optimization. ```python import torch import torch.nn as nn class Model(nn.Module): """ Simple model that performs a single square matrix multiplication (C = A * B) """ def __init__(self): super().__init__() def forward(self, A: torch.Tensor, B: torch.Tensor) -> torch.Tensor: return torch.matmul(A, B) N = 2048 * 2 def get_inputs(): A = torch.rand(N, N) B = torch.rand(N, N) return [A, B] def get_init_inputs(): return [] # No special initialization inputs needed ``` -------------------------------- ### Monitor Makora Optimization Job Progress Source: https://docs.makora.com/getting-started Track the status of your optimization jobs using the 'makora jobs' command. This displays active and completed sessions. ```bash makora jobs ``` -------------------------------- ### Generate with Looser Tolerances Source: https://docs.makora.com/problem-format Generates optimized kernels with looser absolute and relative tolerances (1e-1). Suitable for approximate operations like softmax or layer norm. ```bash # Looser tolerances for approximate operations (e.g., softmax, layer norm) makora generate --file problem.py --device H100 --atol 1e-1 --rtol 1e-1 ``` -------------------------------- ### Basic Model Class Definition Source: https://docs.makora.com/problem-format Defines a PyTorch model with a forward pass for matrix multiplication. This serves as the base for optimization. ```python import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, A: torch.Tensor, B: torch.Tensor) -> torch.Tensor: return torch.matmul(A, B) ``` -------------------------------- ### Generate HIP Kernel for MI300X Source: https://docs.makora.com/commands Generates a HIP kernel for the MI300X GPU. This command is for AMD's MI300X architecture using HIP. ```bash makora expert-generate kernel.py --device MY300x --language hip ``` -------------------------------- ### Makora Generate with Label and Fix Source: https://docs.makora.com/commands Generate optimized code with a custom label for identification and enable automatic fixing of suggestions. This is useful for tracking specific optimization runs. ```bash makora generate --file problem.py --device H100 --label "matmul-v2" --fix ``` -------------------------------- ### Define a Rectangular Matrix Multiplication for Optimization Source: https://docs.makora.com/getting-started This Python code defines a PyTorch module for rectangular matrix multiplication and provides functions to generate input tensors. It's suitable for optimization with Makora. ```python import torch import torch.nn as nn class Model(nn.Module): """ Simple model that performs a single matrix multiplication (C = A * B) """ def __init__(self): super().__init__() def forward(self, A: torch.Tensor, B: torch.Tensor) -> torch.Tensor: return torch.matmul(A, B) M = 1024 * 2 K = 4096 * 2 N = 2048 * 2 def get_inputs(): A = torch.rand(M, K) B = torch.rand(K, N) return [A, B] def get_init_inputs(): return [] # No special initialization inputs needed ``` -------------------------------- ### Save Kernel for Evaluation Source: https://docs.makora.com/commands Saves a specific kernel to a file, typically for later evaluation or comparison. This command is part of the workflow for benchmarking optimized code. ```bash # Save kernel for evaluation makora kernels a1b2c3d4 b5a6c7d8 -o solution.py ``` -------------------------------- ### Makora Stop Command Source: https://docs.makora.com/commands Stop a running optimization session using its UUID or a unique prefix. Prefix matching is supported for convenience. ```bash makora stop a1b2c3d4-e5f6-7890-abcd-ef1234567890 ``` ```bash makora stop a1b2c3d4 ``` ```bash makora stop a1b2 ``` -------------------------------- ### Use --fix Flag for Automatic Correction Source: https://docs.makora.com/commands When validation fails, use the `--fix` flag to automatically correct common issues. Makora will suggest changes and prompt for acceptance. ```bash makora generate --file problem.py --device H100 --fix ``` -------------------------------- ### Save Reference Code Source: https://docs.makora.com/commands Saves the original reference code (problem file) to a specified output file. This allows for offline inspection or use in other contexts. ```bash # Save it to a file makora refcode a1b2c3d4 -o original_problem.py ``` -------------------------------- ### Generate Triton Kernel for H100 Source: https://docs.makora.com/commands Generates a Triton kernel specifically for the H100 GPU. Use this when targeting H100 with Triton. ```bash makora expert-generate kernel.py --device H100 --language triton ``` -------------------------------- ### Non-interactive Login with Token Source: https://docs.makora.com/commands Authenticate with the Makora API non-interactively by providing your API token directly. This is useful for scripting. ```bash makora login --token YOUR_TOKEN ``` -------------------------------- ### Profile Optimized Kernel Source: https://docs.makora.com/commands Profiles an optimized kernel on remote hardware to diagnose performance bottlenecks. It provides hardware counters, occupancy data, and trace information to understand GPU execution. ```bash makora profile [options] ``` -------------------------------- ### Rectangular Matrix Multiplication Model Source: https://docs.makora.com/problem-format A PyTorch nn.Module for rectangular matrix multiplication. Input tensors A and B have shapes (M, K) and (K, N) respectively. ```python import torch import torch.nn as nn class Model(nn.Module): """ Simple model that performs a single matrix multiplication (C = A * B) """ def __init__(self): super().__init__() def forward(self, A: torch.Tensor, B: torch.Tensor) -> torch.Tensor: return torch.matmul(A, B) M = 1024 * 2 K = 4096 * 2 N = 2048 * 2 def get_inputs(): A = torch.rand(M, K) B = torch.rand(K, N) return [A, B] def get_init_inputs(): return [] # No special initialization inputs needed ``` -------------------------------- ### Logout from Makora Source: https://docs.makora.com/commands Removes stored credentials from the local machine, effectively logging you out of the Makora API. ```bash makora logout ``` -------------------------------- ### Square Matrix Multiplication Model Source: https://docs.makora.com/problem-format A PyTorch nn.Module for square matrix multiplication. Input tensors A and B are randomly generated with shape (N, N). ```python import torch import torch.nn as nn class Model(nn.Module): """ Simple model that performs a single square matrix multiplication (C = A * B) """ def __init__(self): super().__init__() def forward(self, A: torch.Tensor, B: torch.Tensor) -> torch.Tensor: return torch.matmul(A, B) N = 2048 * 2 def get_inputs(): A = torch.rand(N, N) B = torch.rand(N, N) return [A, B] def get_init_inputs(): return [] # No special initialization inputs needed ``` -------------------------------- ### Save Kernel Code Source: https://docs.makora.com/commands Saves the source code of specified kernels to a Python file. This is useful for further analysis, modification, or integration into other projects. ```bash makora kernels a1b2c3d4 b5a6c7d8 -o solution.py ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.