HNHacker News
TopNewBestAskShowJobs

mkristiansen

87 karma · joined August 26, 2022

Software Linkedin: www.linkedin.com/in/martinskristiansen
submissionscomments
mkristiansen··on Optimizing a GPT-2-Class Transformer on a GPU
Notes for whomever might find it interesting :)
mkristiansen··on [dead]
I started wondering what what behind those chatbots that you see on all kinds of websites.
mkristiansen··on Haskell vs. Ada vs. C++ vs. an Experiment in Prototyping Productivity (1994) [pdf]
My favorite part of this is the fact that the Haskell solution is considered "too clever".
mkristiansen··on Ultra fast key value store (in C btw)
I think doing things like this in a language like C can serve as a reminder that it is, very much posible, to do actual work with minimal tools - In my case emacs and a clang.
mkristiansen··on Ultra fast key value store (in C btw)
On the first part, yes there are pleanty of wire-compatable redis clones. And while those are interesting, its your second part that I find interesting as well.

The idea of having a strong templating engine with a fast storage backend able to use dynamic content to deliver efficiently renderes websites with minimal hardware.

mkristiansen··on Ultra fast key value store (in C btw)
I like that idea.
mkristiansen··on Ultra fast key value store (in C btw)
I'm considering open sourcing parts of the system -- at its core this is a hashtable with wrapped in a tcp server. At its core a system like this is fairly simple :)
mkristiansen··on Ultra fast key value store (in C btw)
I went over the guidelines and cannot figure out which rule I broke?

"You write that it would be more useful to re-post something else" -- Is your critique just that you didnt like the quality of what I wrote? or is there something more tangable?

mkristiansen··on Ultra fast key value store (in C btw)
I'm sorry to hear that it read like that to you. I was "slightly" inspired by reading "The Tale of Despereaux" to my kid and was trying to capture the tone of the book. :)
mkristiansen··on A not so fast implementation of cosine similarity in C++ and SIMD
Fast Math basically means "who cares about standards just add in whatever order you want" :)
mkristiansen··on A not so fast implementation of cosine similarity in C++ and SIMD
This is really interesting. I have a couple of questions, mainly from the fact that the code is c++ code is about 2x slower than then Numpy.

I had a look at the assembly generated, both in your repo, and from https://godbolt.org/z/76K1eacsG

if you look at the assembly generated:

        vmovups ymm3, ymmword ptr [rdi + 4*rcx]

        vmovups ymm4, ymmword ptr [rsi + 4*rcx]

        add     rcx, 8

        vfmadd231ps     ymm2, ymm3, ymm4

        vfmadd231ps     ymm1, ymm3, ymm3

        vfmadd231ps     ymm0, ymm4, ymm4

        cmp     rcx, rax

        jb      .LBB0_10

        jmp     .LBB0_2
you are only using 5 of the sse2 registers(ymm0 -- ymm4) before creating a dependency on one of the (ymm0 -- ymm2) being used for the results.

I Wonder if widening your step size to contain more than one 256bit register might get you the speed up. Something like this (https://godbolt.org/z/GKExaoqcf) to get more of the sse2 registers in your CPU doing working.

        vmovups ymm6, ymmword ptr [rdi + 4*rcx]

        vmovups ymm8, ymmword ptr [rsi + 4*rcx]

        vmovups ymm7, ymmword ptr [rdi + 4*rcx + 32]

        vmovups ymm9, ymmword ptr [rsi + 4*rcx + 32]

        add     rcx, 16

        vfmadd231ps     ymm5, ymm6, ymm8

        vfmadd231ps     ymm4, ymm7, ymm9

        vfmadd231ps     ymm3, ymm6, ymm6

        vfmadd231ps     ymm2, ymm7, ymm7

        vfmadd231ps     ymm1, ymm8, ymm8

        vfmadd231ps     ymm0, ymm9, ymm9

        cmp     rcx, rax

        jb      .LBB0_10

        jmp     .LBB0_2

which ends up using 10 of the registers, allowing for 6 fused multiplies, rather than 3, before creating a dependency on a previous result -- you might be able to create a longer list.

Again -- This was a really interesting writeup :)

mkristiansen··on ClassicPress – The CMS for Creators
"Error establishing a database connection" ... Have you considered caching?
mkristiansen··on New scientific fraud cases worry me: Now also in material science [video]
Yes, scientific progress is awesome, when taking a long view -- but it requires that we keep being critical if we want the progress to continue.
mkristiansen··on How to program a drawing machine [video]
This is such a wonderful explanation.
mkristiansen··on The Thirty Million Line Problem(Casey Muratori) [video]
Casey Muratori's talk about how the mess we find ourselves i. And his suggestions for how we get out of it.
mkristiansen··on Freshql - a System for building systems, almost no code
A new project to build out a platform for building simple systems. Enabling building without writing code.
mkristiansen··on WeWork is likely to declare bankrupcy next week
For all the startups relying on wework for office space
mkristiansen··on Is All Programming a Scam?
Thank you, you are right - and I appreciate the rusty pun. I think, as a general thing, there are a few things that I would do differently if I wanted to build a production version of this code. Firstly I would find a better way of parsing the headers. :)
mkristiansen··on Is All Programming a Scam?
I'm not sure the line count is a good measure of productivity.

Is that true on the note of "optimizing for developer time"? Do people actually have an understanding of the tradeoff they are making? Do the teams building applications in Java actually know what it would take to do them in C, and choose that the tradeoff is too big? Does the Typescript backend developer know what it would take to do the same in C++ and decide against it?

Or are they mainly working out of a preconceived bias that their favorite language is best and that everything else is worse?

For the 5 µs, I recall a currency conversion system(tin-cup) with in-memory currency rates whose only job was to convert incoming requests to USD. Ignoring the fact that this should never have been an independent system. This seems like a perfect use case for working in a highly optimized environment. ;)

mkristiansen··on Is All Programming a Scam?
I have started to think that much software development has turned into folklore that no one spends time questioning.

Questions like: "Does using Typescript for your backend make you, the programmer, faster/more efficient?" "Do I need a full-blown ORM framework to interact with my database?" "Do I need a runtime with lightweight threads?"

I also have started developing a headache every time someone claims that they are optimizing for developer productivity but cannot articulate the tradeoff they are making.

If you use technologies that cause you to use 20x the hardware, you will need to run complicated DevOps, or whatever we call it, very early.

I have companies with ten concurrent users using Terraform to spin up their microservices in multiple regions on beefy machines. With mental/developer overhead of dealing with the complexity of large distributed systems, YEARS before their company needs the complexity. You are not optimizing for developer productivity; you are just doing random stuff, and claiming that its best practice.

mkristiansen··on Is All Programming a Scam?
I wrote a VERY simple webserver in C. And thought about it. Why are all webservers not written in C!
mkristiansen··on Boxed types in OCaml, and other thoughts
This is what I get for experimenting with going back into 'non-dark' modes on my laptop ":) thank you for pointing this out.
mkristiansen··on Boxed types in OCaml, and other thoughts
I think this line explains what I was facinated by,

"x * y is translated to CPU instructions (x >> 1) * (y - 1) + 1" namely that it now at least 3 extra highlevel operations to do simple multiplication.

mkristiansen··on Boxed types in OCaml, and other thoughts
And to be honest, this might be the sorta thing that is optimized away when doing inlining. but it does seem interesting that even when the type is species, and very narrow, the boxed types being onwrapped and rewrapped by the called function, rather than the caller.

As a side note it took me a second to realize that the multiplication being done is not actually xx, but rather (x (x<<1))

mkristiansen··on Boxed types in OCaml, and other thoughts
I came across an interesting fact about OCaml and wrote up my thoughts.
mkristiansen··on Oracle Expands Database to Ampere Chips, Dealing a Blow to Intel
... Am I reading this right that Oracle has decided to support Ampere's Awesome Arm chips?

In other news, did you notice that Ampere's CEO, Renee J James is on the board of Oracle?

mkristiansen··on Making Actors in Rust
I wrote up how I created Actors in Rust