<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Thread-Hierarchy on Sanketh's Blog</title><link>https://sankethbk.github.io/blog/tags/thread-hierarchy/</link><description>Recent content in Thread-Hierarchy on Sanketh's Blog</description><generator>Hugo -- 0.166.0</generator><language>en-us</language><lastBuildDate>Sun, 30 Aug 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://sankethbk.github.io/blog/tags/thread-hierarchy/index.xml" rel="self" type="application/rss+xml"/><item><title>CUDA Thread Hierarchy: Grids, Blocks, Warps, and Threads</title><link>https://sankethbk.github.io/blog/posts/gpu/2026-08-30-1-cuda-thread-hierarchy/</link><pubDate>Sun, 30 Aug 2026 00:00:00 +0000</pubDate><guid>https://sankethbk.github.io/blog/posts/gpu/2026-08-30-1-cuda-thread-hierarchy/</guid><description>&lt;h1 id="cuda-thread-hierarchy-grids-blocks-warps-and-threads"&gt;CUDA Thread Hierarchy: Grids, Blocks, Warps, and Threads&lt;/h1&gt;
&lt;p&gt;The &lt;a href="https://sankethbk.github.io/blog/gpu/2026-08-29-anatomy-of-a-gpu"&gt;previous note&lt;/a&gt; mapped the hardware: SM, warp scheduler, register file, shared memory, L2, device memory. This note maps the &lt;em&gt;software abstraction&lt;/em&gt; CUDA exposes on top of that hardware. The two maps fit together almost one-to-one, and once you see how, most of CUDA stops being arbitrary syntax and becomes named hardware concepts.&lt;/p&gt;
&lt;p&gt;CUDA organizes parallel work into four nested levels:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Grid
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; └── Block (threads in a block can share fast on-chip memory, and sync)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; └── Warp (32 threads, executed in lockstep on the hardware)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; └── Thread (your kernel code, from one thread&amp;#39;s point of view)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This note works from the bottom up: start with the thread (the thing you actually program), then warp, then block, then grid, then show how the whole tower maps onto the GPU die.&lt;/p&gt;</description></item></channel></rss>