Skip to content

Instantly share code, notes, and snippets.

View tonybaloney's full-sized avatar

Anthony Shaw tonybaloney

View GitHub Profile
@tonybaloney
tonybaloney / overview.md
Last active January 30, 2025 00:07
Vectorization analysis with Deepseek-R1

In this test, I want to see whether the R1 model can read some C code and explain why the Clang autovectorizer algorithm decided not to compile SIMD instructions for the loop.

I have provided some simplified rules based on the Clang docs and the normal rules of autovectorizing algorithms.

The code is from the CPython code base.

from itertools import combinations
from collections import namedtuple
Card = namedtuple("Card", ["color", "shape", "shade", "number"])
cards = [
Card("red", "diamond", "hollow", 1),
Card("green", "squiggle", "solid", 3),
Card("red", "oval", "striped", 3),
Card("red", "oval", "hollow", 2),
@tonybaloney
tonybaloney / pycon2024.md
Last active September 27, 2024 06:53
PyCon US 2024 Talk Notes

PyCon US 2024 Talk Notes - Unlocking the Parallel Universe: Sub Interpreters and Free-Threading in Python 3.13

Prerequisites

  1. PyCon 2023 – Eric Snow talk on sub interpreters
  2. EuroPython 2022 – Sam Gross talk on free-threading
  3. PyCon 2024 - “Sync vs Async in Python” happening right now
  4. PyCon 2024 - Building a JIT compiler for Cpython
  5. PyCon 2024 – Overcoming GIL with sub interpreters and immutability
  6. “Parallelism and Concurrency” chapter from CPython Internals
import _testinternalcapi
def get_executors(func):
code = func.__code__
co_code = code.co_code
executors = {}
for i in range(0, len(co_code), 2):
try:
executors[i] = co_code[i], _testinternalcapi.get_executor(code, i)
"""
Testing on CPython3.13a1+
Requires some recent patches from main.
pip install hypercorn
Have successfully run the following apps:
- fastapi==0.99.0
- Flask
"""
(1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111*())
@tonybaloney
tonybaloney / tidy.sh
Last active April 22, 2023 20:17
tidy script
# Delete all forks that haven't been updated since 2020
gh auth refresh -h github.com -s delete_repo
gh search repos \
--owner tonybaloney \
--updated="<2020-01-01" \
--include-forks=only \
--limit 100 \
--json url \
--jq ".[] .url" \ | xargs -I {} gh repo delete {} --confirm
@tonybaloney
tonybaloney / install.sh
Created November 11, 2022 02:53
Install perf on WSL2
git clone --depth=1 https://github.com/microsoft/WSL2-Linux-kernel.git
sudo apt install -y build-essential flex bison libssl-dev libelf-dev libbabeltrace-dev libunwind-dev libdw-dev binutils-dev libiberty-dev
cd WSL2-Linux-kernel/tools/perf/
make -j2 -s && make install