<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>pgmesa&apos;s blog</title><description>Hi, I&apos;m Pablo, a computer vision and machine learning engineer. I write about how the tools we use every day work inside, usually by rebuilding them.</description><link>https://blog.pgmesa.com/</link><item><title>Why I rebuilt PyTorch&apos;s core from scratch</title><link>https://blog.pgmesa.com/posts/why-rebuild-pytorch/</link><guid isPermaLink="true">https://blog.pgmesa.com/posts/why-rebuild-pytorch/</guid><description>Three projects, one question I could not answer, and how this series is organized.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>What a PyTorch tensor really is</title><link>https://blog.pgmesa.com/posts/what-a-tensor-is/</link><guid isPermaLink="true">https://blog.pgmesa.com/posts/what-a-tensor-is/</guid><description>What is really in memory when you hold a tensor, why x[1:3] costs the same at any size, and what contiguous means.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>What the CPU does when your code reads memory</title><link>https://blog.pgmesa.com/posts/memory-and-the-cpu/</link><guid isPermaLink="true">https://blog.pgmesa.com/posts/memory-and-the-cpu/</guid><description>Caches, cache lines, the prefetcher, pages and the TLB, cache sets, SIMD registers, branch prediction, cores and threads, measured with tensors. The hardware background the rest of the series refers to.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>How PyTorch walks a tensor of any shape</title><link>https://blog.pgmesa.com/posts/n-dimensional-loops/</link><guid isPermaLink="true">https://blog.pgmesa.com/posts/n-dimensional-loops/</guid><description>An odometer for the indices, an inner loop the compiler can vectorize, and a single division per thread.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>How PyTorch prepares the loop of every operation</title><link>https://blog.pgmesa.com/posts/tensoriterator/</link><guid isPermaLink="true">https://blog.pgmesa.com/posts/tensoriterator/</guid><description>Broadcasting, type promotion, an output that already exists, the order of the dimensions, merging them, and the memory a tensor shares with itself.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>How a PyTorch kernel uses the vector registers of every CPU</title><link>https://blog.pgmesa.com/posts/cpu-kernels/</link><guid isPermaLink="true">https://blog.pgmesa.com/posts/cpu-kernels/</guid><description>The two lambdas of a kernel, Vectorized&lt;T&gt; as one register, how exp is computed eight numbers at a time, and one binary that picks SSE, AVX2 or AVX-512 when it starts.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>How PyTorch sums a tensor, and splits the work between threads</title><link>https://blog.pgmesa.com/posts/reductions-and-threads/</link><guid isPermaLink="true">https://blog.pgmesa.com/posts/reductions-and-threads/</guid><description>A reduction as a TensorIterator whose output does not move, why the obvious sum loop is slow and wrong, the cascade sum, how parallel_for splits a range, and why sum() can change with the number of threads while sum(dim) cannot.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>How PyTorch computes gradients</title><link>https://blog.pgmesa.com/posts/autograd/</link><guid isPermaLink="true">https://blog.pgmesa.com/posts/autograd/</guid><description>From micrograd to PyTorch&apos;s engine, with nodes and edges, saved tensors, a dependency count instead of a recursive sort, gradients freed as the backward advances, and the reference cycle that leaks a whole graph.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>How PyTorch runs the same operations on a GPU</title><link>https://blog.pgmesa.com/posts/cuda/</link><guid isPermaLink="true">https://blog.pgmesa.com/posts/cuda/</guid><description>How an operation reaches its CUDA kernel, why launches return before the work is done, a caching allocator instead of cudaMalloc, a thread per element with a division made a multiplication, and why pinned memory and the DataLoader keep the GPU busy.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item></channel></rss>