Skip to content

Instantly share code, notes, and snippets.

View VictorTaelin's full-sized avatar

Victor Taelin VictorTaelin

View GitHub Profile
@VictorTaelin
VictorTaelin / hvm3_atomic_linker.md
Last active March 22, 2025 00:56
HVM3's Optimal Polarized Atomic Linker

HVM3's Optimal Atomic Linker (with Polarization)

Atomic linking is at the heart of HVM's implementation: it is what allows threads to collaborate towards massive parallelism. All major HVM versions started with a better atomic linker. From slow, buggy locks (HVM1), to AtomicCAS (HVM1.5), to AtomicSwap (HVM2), the algorithm became simpler and faster over the years.

On the initial HVM3 implementation, I noticed that one of the cases on the atomic linker never happened. After some reasoning, I now understand why, and

@VictorTaelin
VictorTaelin / optimal_atomic_linker.kind.js
Created November 1, 2024 22:16
Optimal Polarized Atomic Linker - complete implementation snapshot
// ./../HVM_old.kind//
// NOTE: we're refactoring HVM to replace RTerm by a U64.
// Your goal is to help us with this refactor.
// Higher-order Virtual Machine
// ============================
// Core Types
// ----------
@VictorTaelin
VictorTaelin / gist:0e37a787472c1d67281738cff3a3b31e
Created November 1, 2024 20:01
HVM3 on Kind: initial Atomic Linker attempt
// Higher-order Virtual Machine
// ============================
// Core Types
// ----------
data HVM/Pol {
#Pos
#Neg
}
@VictorTaelin
VictorTaelin / materials.md
Last active February 15, 2025 18:15
materials

Company:

Theory:

@VictorTaelin
VictorTaelin / solving_the_mystery.md
Last active November 17, 2024 14:32
Solving the mystery behind Abstract Algorithm’s magical optimizations

Note: This is an old post from back when I was trying to make sense of why inets are so fast for evaluating some λ-terms. It has some silly bits, I learned a lot since and could probably write a better article today, but I think this can still be insightful for these getting started, so I'll leave it here.

Yesterday, I reported the bizarre observation that certain functions can behave as if they had negative complexity. If you haven’t checked that article yet, it isn’t necessary, but you should, as it may blow your mind. In short, the λ-term f(bits) = copy(comp(inc,n,bits)), when given to optimal λ-calculus evaluator, is asymptotically faster than g(bits) = comp(inc,n,bits); i.e.,copy (a O(1) operation for a fixed size) behaves as if it had a O(1/n) complexity, causing the program to run faster by doing more things (!?).

That’s not the only bizarre complexity result I had when

You're a code completion assistant.
###
-- Checker:
--
module Kind.Type where
import qualified Data.IntMap.Strict as IM
import qualified Data.Map.Strict as M
import Debug.Trace
@VictorTaelin
VictorTaelin / wtf_new_sonnet.txt
Created October 23, 2024 14:41
wtf new sonnet
You're a code completion assistant.
###
-- Type.hs:
--
module Kind.Type where
import qualified Data.IntMap.Strict as IM
import qualified Data.Map.Strict as M
@VictorTaelin
VictorTaelin / new_sonnet_bad.txt.hs
Last active October 22, 2024 21:33
new sonnet bad?
You're a code completion assistant.
###
--
module Kind.Type where
import qualified Data.IntMap.Strict as IM
import qualified Data.Map.Strict as M
import Debug.Trace
import Data.Word (Word32)
@VictorTaelin
VictorTaelin / getters_setters_kind_lang.md
Created October 19, 2024 17:37
Getters and Setters in Kind-Lang

Getters and Setters in Kind

The verbosity of nested fields

One of the most annoying aspects of pure functional programming is getting, setting and mutating deeply nested fields. In impure languages like JavaScript, this was never a problem. For example, consider the following object:

@VictorTaelin
VictorTaelin / aff.txt
Last active October 17, 2024 23:19
aff
from: https://discord.com/channels/767397347218423858/767397347218423861/1296580936292499540
Taelin — Today at 5:41 PM
@AndrasKovacs i see you often treat lambda-case and case-of with different constructors. why? is there any obvious cons to just treating (λ{ ... } arg) as a case-of?
Taelin — Today at 6:09 PM
actually, also, consider this:
Main
: ∀(P: ∀(x: B/Bool) *) →