Skip to content

Instantly share code, notes, and snippets.

@shawwn
shawwn / demangle.cpp
Created May 29, 2022
Code for printing out C++ stack traces
View demangle.cpp
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
View clangd_2022-05-10-110622_Shawns-MacBook-Pro.crash
Process: clangd [61497]
Path: /Applications/CLion.app/Contents/bin/clang/mac/clangd
Identifier: clangd
Version: 0
Code Type: ARM-64 (Native)
Parent Process: clion [21849]
Responsible: clion [21849]
User ID: 501
Date/Time: 2022-05-10 11:06:21.935 +0500
@shawwn
shawwn / _var_folders_8f_5fdgh9l120lfbrs2t8plgr7r0000gn_T_main-5e2147.sh
Created May 10, 2022
/var/folders/8f/5fdgh9l120lfbrs2t8plgr7r0000gn/T/main-5e2147.sh
View _var_folders_8f_5fdgh9l120lfbrs2t8plgr7r0000gn_T_main-5e2147.sh
# Crash reproducer for clang version 15.0.0 (https://github.com/llvm/llvm-project 53069de6aa4ce1e130aa58fc36b4be08a53d3aba)
# Driver args: "--driver-mode=g++" "-g" "-arch" "arm64" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk" "-mmacosx-version-min=11.6" "-std=gnu++20" "-o" "CMakeFiles/sg20crash.dir/main.cpp.o" "-c" "/Users/spresser/ml/sg20crash/main.cpp"
# Original command: "/Users/spresser/ml/llvm-project/build/bin/clang-15" "-cc1" "-triple" "arm64-apple-macosx11.6.0" "-Wundef-prefix=TARGET_OS_" "-Werror=undef-prefix" "-Wdeprecated-objc-isa-usage" "-Werror=deprecated-objc-isa-usage" "-emit-obj" "-mrelax-all" "--mrelax-relocations" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "main.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=non-leaf" "-ffp-contract=on" "-fno-rounding-math" "-funwind-tables=2" "-target-sdk-version=12.0" "-fcompatibility-qualified-id-block-type-checking" "-fvisibility-inlines-hidden-stati
@shawwn
shawwn / _var_folders_8f_5fdgh9l120lfbrs2t8plgr7r0000gn_T_main-5e2147.cpp
Created May 10, 2022
/var/folders/8f/5fdgh9l120lfbrs2t8plgr7r0000gn/T/main-5e2147.cpp
View _var_folders_8f_5fdgh9l120lfbrs2t8plgr7r0000gn_T_main-5e2147.cpp
This file has been truncated, but you can view the full file.
# 1 "<built-in>"
# 1 "/Users/spresser/ml/sg20crash/main.cpp"
#if 0 /* expanded by -frewrite-includes */
#include <iostream>
#endif /* expanded by -frewrite-includes */
# 1 "/Users/spresser/ml/sg20crash/main.cpp"
# 1 "/Users/spresser/ml/llvm-project/build/bin/../include/c++/v1/iostream" 1 3
// -*- C++ -*-
//===----------------------------------------------------------------------===//
View gpt-neox-random-irc.txt
what's the best number?
<vibhav> <zequence> the one you want
<holstein> i just try and use whatever is easy
<holstein> and i usually just use the internal mic for everything
<holstein> but, i think i'll poke around in audacity
<holstein> just to see what it can do
<vibhav> <holstein> the audacity thing is for sound recording
<holstein> its got a sound playback thing too
<holstein> with a few effects
<vibhav> <holstein> I know
View install_emacs_python.sh
# Some cliff's notes on installing empy on a new machine. Haven't tested it yet.
pip3 install userpath
# install y
git clone https://github.com/shawwn/y ~/ml/y
# add y to PATH
userpath append ~/ml/y/bin
exec $SHELL
View autodidax.py
from typing import NamedTuple, Callable
class Primitive(NamedTuple):
name: str
add_p = Primitive('add')
mul_p = Primitive('mul')
neg_p = Primitive("neg")
sin_p = Primitive("sin")
cos_p = Primitive("cos")
@shawwn
shawwn / gist:d97b6b948d58111b51226f2012cbee30
Created Nov 11, 2021
How to dump XLA HLO pipelines in tensorflow
View gist:d97b6b948d58111b51226f2012cbee30
`XLA_FLAGS=--xla_dump_to=/tmp/xladump --xla_dump_hlo_pass_re=.*`
@shawwn
shawwn / What happens when you allocate a JAX tensor on a TPU.md
Last active Nov 7, 2021
JAX C++ stack trace walkthrough for TpuExecutor_Allocate
View What happens when you allocate a JAX tensor on a TPU.md
@shawwn
shawwn / libtpujesus.c
Created Nov 2, 2021
An example of building a custom "stub" libtpu.so library, with the ultimate goal of implementing your own "TPU" device for JAX.
View libtpujesus.c
/* libtpujesus.c
Copyright 2021 Shawn Presser
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions: