Skip to content

Instantly share code, notes, and snippets.

@drisspg
drisspg / scaled_mm_api.md
Last active February 8, 2025 16:03
Scaled MM API

Summary

This doc servers as a quick reference for the _scaled_mm API and how it has changed overtime for each major version of PyTorch.


NOTE The leading underscore is intended here and we make no current FC/BC guarantees on this API. That being said it is currently the only OP that has native support for FP8 matmuls within the PyTorch Libary. We are planning to make an official Public api for this. Until then this is subject to change but you can use this doc as a reference.


@drisspg
drisspg / sdpa.py
Created October 19, 2024 00:51
sdpa.py
import itertools
from collections import defaultdict
from contextlib import nullcontext
from dataclasses import asdict, dataclass
from typing import Callable, List, Tuple
from tabulate import tabulate
from tqdm import tqdm
import torch
import torch
torch.set_float32_matmul_precision("high")
import torch.utils.benchmark as benchmark
from diffusers import DiffusionPipeline
import gc
# from torchao.quantization import (
# int4_weight_only,
@drisspg
drisspg / update-alternatives-clang.sh
Last active May 10, 2023 20:11
Update alternatives to new version of clang
#!/usr/bin/env bash
# Install newest clang with `bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"`
# chmod u+x update_alternatives_clang.sh
# ./update_alternatives_clang.sh <version> <priority>
update_alternatives() {
local version=${1}
local priority=${2}
local master=${3}
local slaves=${4}