This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Python.h> | |
| #include <numpy/arrayobject.h> | |
| #include "chi2.h" | |
| /* Docstrings */ | |
| static char module_docstring[] = | |
| "This module provides an interface for calculating chi-squared using C."; | |
| static char chi2_docstring[] = | |
| "Calculate the chi-squared of some data given a model."; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import Optional, Callable, Sequence, Any | |
| import torch | |
| from torch import nn, fx | |
| from torch.library import Library | |
| import torch.nn.functional as F | |
| import torch._inductor | |
| import torch._inductor.compile_fx | |
| mirage_lib = Library("mirage", "FRAGMENT") # noqa |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Debugging Spurious Copies: Mini Example | |
| https://gist.github.com/matthias-springer/81748fe1e530974dd5ff6b3ad57e3eeb | |
| Debugging Spurious Copies: Matmul, Tiled | |
| https://gist.github.com/matthias-springer/372162baa30e79c49180bb3ace216995 | |
| https://gist.github.com/matthias-springer/b664feb23be0159f72726025923bb9ca | |
| Empty Tensor Elimination | |
| https://gist.github.com/matthias-springer/b3f40d1667c977c29a76cc7a469cc1a0 | |
| https://gist.github.com/matthias-springer/e531580242d27f14e0a239e0b6fe80ae |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import math | |
| import cutlass.cute as cute | |
| import cutlass | |
| def visualize_tv_layout( | |
| tiler_mn: tuple[int, int], | |
| tv_layout, # (((thr_shape),(val_shape)), | |
| # ((thr_stride),(val_stride))) | |
| *, | |
| font_size: int = 10, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import List | |
| import cutlass | |
| import cutlass.cute as cute | |
| from cutlass.cute.runtime import from_dlpack | |
| @cute.kernel | |
| def kernel_use_vec_as_arg(vec, res: cute.Tensor): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cutlass | |
| import cutlass.cute as cute | |
| from cutlass.cute.runtime import from_dlpack | |
| @cute.kernel | |
| def kernel_use_vec_as_arg(vec, res: cute.Tensor): | |
| # cute.print_tensor(vec) | |
| res.store(vec) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ctypes | |
| import torch | |
| import time | |
| def nvrtc_compile(source: str) -> str: | |
| from ctypes import CDLL, c_void_p, c_char_p, c_size_t, byref, create_string_buffer | |
| libnvrtc = CDLL('libnvrtc.so') | |
| def get_error_string() -> str: | |
| err_p = c_char_p() | |
| libnvrtc.nvrtcGetErrorString(result, byref(err_str)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cutlass | |
| import cutlass.cute as cute | |
| from cutlass._mlir.dialects import llvm | |
| from cutlass._mlir.extras import types as T | |
| def compare_and_swap_i32(a: cutlass.Int32, b: cutlass.Int32) -> tuple[cutlass.Int32, cutlass.Int32]: | |
| out_i32x2 = llvm.inline_asm( | |
| llvm.StructType.get_literal([T.i32(), T.i32()]), | |
| [cutlass.Int32(a).ir_value(), cutlass.Int32(b).ir_value()], | |
| "{\n\t" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| from vllm import LLM, SamplingParams | |
| from vllm.inputs import PromptType | |
| from vllm.outputs import PoolingRequestOutput, RequestOutput | |
| from typing import Union, cast, Sequence | |
| from multiprocessing import Queue, Event | |
| import threading | |
| class MyLLM(LLM): | |
| def keep_running( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import argparse | |
| import time | |
| from typing import Type | |
| import torch | |
| import torch.nn.functional as F | |
| import torch._inductor.config | |
| torch._inductor.config.triton.multi_kernel = True |
NewerOlder