Skip to content

Instantly share code, notes, and snippets.

View clausecker's full-sized avatar

Robert Clausecker clausecker

View GitHub Profile
@VictorTaelin
VictorTaelin / sat.md
Last active December 7, 2024 20:59
Simple SAT Solver via superpositions

Solving SAT via interaction net superpositions

I've recently been amazed, if not mind-blown, by how a very simple, "one-line" SAT solver on Interaction Nets can outperform brute-force by orders of magnitude by exploiting "superposed booleans" and optimal evaluation of λ-expressions. In this brief note, I'll provide some background for you to understand how this works, and then I'll present a simple code you can run in your own computer to observe and replicate this effect. Note this is a new observation, so I know little about how this algorithm behaves asymptotically, but I find it quite

@Earnestly
Earnestly / posix-issue8.md
Last active October 30, 2024 12:40
A Selected List of Additions and Changes Coming With POSIX Issue 8
@animetosho
animetosho / gf2p8affineqb-articles.md
Last active February 17, 2025 10:45
A list of articles documenting uses of the GF2P8AFFINE instruction

Unexpected Uses for the Galois Field Affine Transformation Instruction

Intel added the Galois Field instruction set (GFNI) extensions to their Sunny Cove and Tremont cores. What’s particularly interesting is that GFNI is the only new SIMD extension that came with SSE and VEX/AVX encodings (in addition to EVEX/AVX512), to allow it to be supported on all future Intel cores, including those which don’t support AVX512 (such as the Atom line, as well as Celeron/Pentium branded “big” cores).

I suspect GFNI was aimed at accelerating SM4 encryption, however, one of the instructions can be used for many other purposes. The extension includes three instructions, but of particular interest here is the Affine Transformation (GF2P8AFFINEQB), aka bit-matrix multiply, instruction.

There have been various articles which discuss out-of-band

@clausecker
clausecker / pretty_print.c
Created November 7, 2011 20:47
Pretty printer for MMIX opcodes
#include <stdio.h>
#include <inttypes.h>
#include "pretty_print.h"
const char *opcodes[256] = {
"trap","fcmp","fun","feql","fadd","fix","fsub","fixu", /* 0x0# */
"flot","flot","flotu","flotu","sflot","sflot","sflotu","sflotu",
"fmul","fcmpe","fune","feqle","fdiv","fsqrt","frem","fint", /* 0x1# */
"mul","mul","mulu","mulu","div","div","divu","divu",
#This program was created by Georg Brandl
#<[email protected]> (!)
#This program was raised into public domain by its owner.
#You can use it everywhere whithout permission, but please
#provide this information.
#
#How to use:
#lhs_highlighter.py file.lhs > file.tex
#
#The program converts Haskell snippets in literate sourcecode