Skip to content

Instantly share code, notes, and snippets.

nadavrot /
Last active Apr 11, 2021
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).


Matrix multiplication is a mathematical operation that defines the product of

View gist:50e856b4711798a1c8bc6ecc061d77d0
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#include <execinfo.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define BT_BUF_SIZE 100
nadavrot /
Created Nov 29, 2020
A working malloc implementation in 250 LOC
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <pthread.h>
#include <unistd.h>
namespace {
/// A Block is a header to a managed memory buffer. Blocks are arranged as