cache appreciator
505 posts

cache appreciator
@highperfcache
nus, quant swe
Singapore Katılım Eylül 2024
164 Takip Edilen157 Takipçiler

@highperfcache @skydotcs @pangram are your dms open, (@highperfcache)?
would love to probe ur brain on what you know about high performance cache (not a joke)
English

Day 6/90 of Inference Engineering
I wrote a CUDA kernel for 1D Convolution, just getting the reps in for writing unoptimized boring but correct CUDA! I also read PagedAttention (2312.07104), watched 1 short lecture on GPU Memory, and hack squatted 455lb x6 and 495lb x3 as a top set!
Heres what I've learned about PagedAttention:
PagedAttention reduces internal fragmentation and solves external fragmentation.
During the decode phase, the KV cache manager actually hands out one cache block at a time to store output tokens. If the output tokens overflows the cache block, the KV cache manager assigns a new cache block to hold the remaining tokens that didn't fit into the previous cache block. What ends up happening is that the VRAM is used effectively such that each cache block is filled before new cache block is allocated on the VRAM.
In a naive KV cache implementation, memory is reserved up front for the maximum sequence length, which might not ever be used, meaning there is just a massive chunk of VRAM that's not touched.
PagedAttention reduces internal fragmentation by ensuring memory is never wasted between each decode sequence.
To make usage of memory even more efficient, any unique prompts that share the same prefix tokens, the KV cache manager allows them to share the same cache block, however, it writes to a new cache block starting from where the new tokens differ within the two prompts.
While each decode phase effectively writes to random parts of the VRAM, the Block table is able to provide an abstraction that makes KV cache seem like a contiguous memory to the model. Making the allocation process as simple as checking if a cache block is full or not.
This continuous practice of using cache blocks to allocate just enough memory and using a block table to allocate non-contiguous free scattered memory on the VRAM reduces internal fragmentation and solves external fragmentation.
---
Watched a video on GPU Memory: youtube.com/watch?v=Zrbw0z…
I read this blog that made absolutely cemented everything, written by (@hamzaelshafie): hamzaelshafie.bearblog.dev/paged-attentio…

YouTube


English

our work on git will go to upstream, in the C programming language, so long as they are useful generally. so, a public fork.
grim@grimcodes
holy shit openai just forked git
English

@LFauexProd does this not still happen? cameras just got better at processing it
English

@FangYi11101 @Andrew_Semenza considering the exact minute of the text it’s probably Switzerland’s red card vs Argentina
English

@codybrown @FangYi11101 @RokoMijic No they’re quite accurate, Tuas is quite literally a vast industrial area. You could even add another 30min-1hr if they choose to go through immigration on a busy day.
English

@FangYi11101 @RokoMijic you are really reaching and also now just making up random stuff about "marshlands/industrial areas."
No one who goes to NS thinks its in Singapore but its nice that its close. If Waterloo was an hour from NYC, they'd make reference to that as well... but it's ~13hrs by bus.
English

@brianchew Haha we were at the airport around the same time!
English

@FangYi11101 Their interview tool definitely supports drawing lol
English

@ItsCuthulhu @unusual_whales Are you not a grad student? It can definitely cost more under certain high volume use cases
English

@injaneity schedule this year is very ai-skewed, apart from the cpython talk which i would find the most interesting
English

@dedene @weswinder their subsidies will eventually run out too
English

anthropic just downgraded claude code subs
programmatic usage previously used your full rate limits
which was something like a 5-10X discount vs api costs
now ALL programmatic usage is capped at $20/$100/$200 in api costs (a single opus session can easily burn $20)
not good
ClaudeDevs@ClaudeDevs
Starting June 15, paid Claude plans can claim a dedicated monthly credit for programmatic usage. The credit covers usage of: - Claude Agent SDK - claude -p - Claude Code GitHub Actions - Third-party apps built on the Agent SDK
English

@Sketchapotamus @FangYi11101 if i was going to use some boring shizo language id just use brainfuck. the point is for me to spend 1.5 hours talking about lambda calculii
English

@RJPJR @bryanrbeal just checked, USD 600 back then for a one way journey, good times
English

@RJPJR @bryanrbeal i’ve done this on premium economy for <1k back in 2024
English

@bryancsk just dropped to my knees in a heartland mall parking lot
English

An astonishing artefact of many contradictions. How should a Singaporean think of this object, both so foreign and so familiar?
forward deployed ccp gf@FangYi11101
Durian drink came with a stick of gum
English

@FangYi11101 the difference between them is maybe a few dedicated weekends
English















