<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Kernel optimization on AI Tools</title>
    <link>https://ait.bsc.es/handbook/kernel-optimization/</link>
    <description>Recent content in Kernel optimization on AI Tools</description>
    <generator>Hugo</generator>
    <language>en</language>
    <atom:link href="https://ait.bsc.es/handbook/kernel-optimization/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Kernel optimization for LLM inference</title>
      <link>https://ait.bsc.es/handbook/kernel-optimization/kernel-optimization-for-llm-inference/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://ait.bsc.es/handbook/kernel-optimization/kernel-optimization-for-llm-inference/</guid>
      <description>&lt;p&gt;Kernel optimization is the lowest layer at which inference performance can be improved,&#xA;and the one with the worst effort-to-reward ratio if applied before the layers above it&#xA;have been addressed.&lt;/p&gt;&#xA;&lt;p&gt;This page frames when to descend to this level, and what the work actually consists of.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-you-will-learn&#34;&gt;What you will learn&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What a kernel is and why kernel efficiency bounds performance.&lt;/li&gt;&#xA;&lt;li&gt;How to establish that kernels, rather than scheduling or batching, are the bottleneck.&lt;/li&gt;&#xA;&lt;li&gt;Which inference operations are most often worth optimizing.&lt;/li&gt;&#xA;&lt;li&gt;When to write a kernel versus adopting an existing one.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;recommended-outline&#34;&gt;Recommended outline&lt;/h2&gt;&#xA;&lt;p&gt;This page is an outline. The subsections below are the planned structure;&#xA;they are filled in as the handbook is written.&lt;/p&gt;</description>
    </item>
    <item>
      <title>GPU architecture fundamentals</title>
      <link>https://ait.bsc.es/handbook/kernel-optimization/gpu-architecture-fundamentals/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://ait.bsc.es/handbook/kernel-optimization/gpu-architecture-fundamentals/</guid>
      <description>&lt;p&gt;Reasoning about kernel performance requires an accurate model of the hardware: how work&#xA;is scheduled onto execution units, and how the memory hierarchy behaves under different&#xA;access patterns.&lt;/p&gt;&#xA;&lt;p&gt;This page covers the architectural fundamentals that inference performance depends on.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-you-will-learn&#34;&gt;What you will learn&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How GPU work is organised into threads, warps and blocks.&lt;/li&gt;&#xA;&lt;li&gt;The memory hierarchy and the cost of each level.&lt;/li&gt;&#xA;&lt;li&gt;Why coalesced memory access matters so much.&lt;/li&gt;&#xA;&lt;li&gt;How to reason about occupancy and arithmetic intensity.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;recommended-outline&#34;&gt;Recommended outline&lt;/h2&gt;&#xA;&lt;p&gt;This page is an outline. The subsections below are the planned structure;&#xA;they are filled in as the handbook is written.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Choosing the right kernel optimization tool</title>
      <link>https://ait.bsc.es/handbook/kernel-optimization/choosing-the-right-kernel-optimization-tool/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://ait.bsc.es/handbook/kernel-optimization/choosing-the-right-kernel-optimization-tool/</guid>
      <description>&lt;p&gt;Kernels can be written at several levels of abstraction, from vendor assembly through&#xA;domain-specific languages to compiler-generated code. The levels differ in achievable&#xA;performance, portability and how much effort each change costs.&lt;/p&gt;&#xA;&lt;p&gt;This page compares them and suggests how to choose.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-you-will-learn&#34;&gt;What you will learn&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The levels of abstraction available for kernel work.&lt;/li&gt;&#xA;&lt;li&gt;How portability and peak performance trade against each other.&lt;/li&gt;&#xA;&lt;li&gt;Where compiler-based approaches are sufficient.&lt;/li&gt;&#xA;&lt;li&gt;Which profiling tools to use to direct the effort.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;recommended-outline&#34;&gt;Recommended outline&lt;/h2&gt;&#xA;&lt;p&gt;This page is an outline. The subsections below are the planned structure;&#xA;they are filled in as the handbook is written.&lt;/p&gt;</description>
    </item>
    <item>
      <title>FlashAttention</title>
      <link>https://ait.bsc.es/handbook/kernel-optimization/flash-attention/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://ait.bsc.es/handbook/kernel-optimization/flash-attention/</guid>
      <description>&lt;p&gt;A textbook attention implementation materialises the full attention matrix in memory,&#xA;making the operation memory-bound and its footprint quadratic in sequence length. That&#xA;is the dominant cost for long contexts.&lt;/p&gt;&#xA;&lt;p&gt;FlashAttention restructures the computation so the matrix is never fully materialised,&#xA;trading extra arithmetic for far less memory traffic.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-you-will-learn&#34;&gt;What you will learn&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why naive attention is memory-bound rather than compute-bound.&lt;/li&gt;&#xA;&lt;li&gt;How tiling and online softmax avoid materialising the attention matrix.&lt;/li&gt;&#xA;&lt;li&gt;Why trading recomputation for memory traffic is a net win here.&lt;/li&gt;&#xA;&lt;li&gt;How the approach applies differently to prefill and decode.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;recommended-outline&#34;&gt;Recommended outline&lt;/h2&gt;&#xA;&lt;p&gt;This page is an outline. The subsections below are the planned structure;&#xA;they are filled in as the handbook is written.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
