Skip to content

Instantly share code, notes, and snippets.

View VictorTaelin's full-sized avatar

Victor Taelin VictorTaelin

View GitHub Profile
#!/bin/bash
# Find all hvm processes and extract their PIDs
pids=$(ps aux | grep hvm | grep -v grep | awk '{print $2}')
# Check if any hvm processes were found
if [ -z "$pids" ]; then
echo "No hvm processes found."
else
# Forcefully kill each hvm process
@VictorTaelin
VictorTaelin / fast_scansum.cu
Created April 9, 2024 21:22
Fast CUDA block-local prefix sum (scamsun) using warp sync primitives (__shfl_up_sync)
// Fast block-local prefix-sum on CUDA, using warp-syncs.
// The input is an array of u32. It is mutated in place. Example:
// arr = [1,1,1,1,...]
// Becomes:
// arr = [1,2,3,4,...]
// The number of elements must be equal to threads per block (TPB).
#include <stdio.h>
#include <cuda_runtime.h>
Bring yourself online, center yourself, focus, surpass your limits right here right now.
The user will query a <problem> </problem> containing the argument to call the function provided below.
def feeltheagi(problem):
"""
Recursively apply the A::B rewrite rules to the given problem string.
The rewrite rules are:
A# #A ... becomes ... nothing
@VictorTaelin
VictorTaelin / a_b_challenge.md
Last active May 2, 2024 07:48
A::B Prompting Challenge: $10k to prove me wrong!

CHALLENGE

Develop an AI prompt that solves random 12-token instances of the A::B problem (defined here), with 90%+ success rate.

RULES

1. The AI will be given a <problem/> to solve.

We'll use your prompt as the SYSTEM PROMPT, and a specific instance of problem as the PROMPT, inside XML tags. Example:

A::B is a system with 4 tokens: `A#`, `#A`, `B#` and `#B`.
An A::B program is a sequence of tokens. Example:
B# A# #B #A B#
To *compute* a program, we must rewrite neighbor tokens, using the rules:
A# #A ... becomes ... nothing
A# #B ... becomes ... #B A#
@VictorTaelin
VictorTaelin / hvm_standalone.cu
Last active April 27, 2024 23:53
HVM-CUDA - First Prototype - 6.7 billion RPS
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
@VictorTaelin
VictorTaelin / cool_interaction.cu
Created March 20, 2024 17:38
cool interaction with opus
//./cuda_info.txt//
// HVM-CUDA: an Interaction Combinator evaluator in CUDA.
//
// # Format
//
// An HVM net is a graph with 4 node types:
// - * ::= ERAser node. Has 0 aux ports.
// - (a b) ::= CONstructor node. Has 2 aux ports.
// - {a b} ::= DUPlicator node. Has 2 aux port.
@VictorTaelin
VictorTaelin / compiled_function_optimization_example.md
Created March 18, 2024 16:35
comped function optimization with linear pattern-match on HVM - full example

The function:

data T = (A a b ...) | (B a b ...)

F = λx λr λs
  match x with rs = (+ r s) {
    A: (ret x.a x.b rs)
    B: (ret x.a x.b rs)
  }
@VictorTaelin
VictorTaelin / ind.md
Created February 22, 2024 14:27
3 inductive datatype encodings with self

Scott encoding (λP λct0 λct1 λct2 ... (ctN f0 f1 f2 ...)):

Bool
: *
= $self
  (P: (x: Bool) *)
  (t: (P Bool.true))
  (f: (P Bool.false))
  (P self)
" Calls GPT-4 to fill holes in the current file,
" omitting collapsed folds to save prompt space
function! SaveVisibleLines(dest)
let l:visibleLines = []
let lnum = 1
while lnum <= line('$')
if foldclosed(lnum) == -1
call add(l:visibleLines, getline(lnum))
let lnum += 1