# cuTile Programming

## Abstract

Express your algorithm; cuTile and Tile IR will figure out the threads, data movement, and Tensor cores. In this talk, we'll present cuTile, NVIDIA's new block-based programming abstraction, and Tile IR, the compiler stack that it is built with. We'll explore examples in C++ and Python from a variety of domains, including inference of a mixture-of-experts large language model and a sparse conjugate gradient solver. CUDA tile programming divides inputs into local arrays that are processed concurrently by groups of threads. Users write sequential array-centric code, and the framework handles parallelization, synchronization, and data movement behind the scenes. Architecture-specific details are abstracted away—you express your algorithm once in a high-level way, and the system lowers it to the right implementation for any NVIDIA GPU architecture.

## AI Summary

- cuTile, a new programming model and compiler stack for CUDA, was introduced to simplify GPU kernel writing and improve performance portability across different NVIDIA GPU architectures.
- The model focuses on logical partitioning of work and data, allowing the system to decide the best physical mapping to execution resources and memory, which enhances productivity and code maintainability.
- cuTile supports a variety of programming languages, including Python, C++, Julia, and experimental support for Rust, making it easier to integrate into existing projects and workflows.
- The presentation highlighted the performance benefits of cuTile in sparse matrix vector multiplication and real-time fluid dynamics simulations, demonstrating its effectiveness in both data-parallel and specialized applications.
- cuTile and SIMT can be used together in the same source file, enabling developers to leverage optimized SIMT libraries while benefiting from the high-level abstractions and portability of cuTile.
- The speaker discussed the future plans for cuTile, including support for multi-GPU and multi-node communications, and the potential for further optimizations and integration with auto-tuning frameworks.

## Transcript

**[00:00:09 – 00:00:12]** Hello and welcome everyone.

**[00:00:12 – 00:00:14]** My name is Bryce Adelstein Lelbach.

**[00:00:14 – 00:00:17]** I am a principal engineer at NVIDIA where I founded

**[00:00:17 – 00:00:21]** the CUDA core compute libraries team and I now lead the Vanguard

**[00:00:21 – 00:00:24]** programming group which is responsible for programming

**[00:00:24 – 00:00:26]** language design and evolution.

**[00:00:26 – 00:00:28]** So our job is to make

**[00:00:28 – 00:00:32]** Every major language, a GPU language from Fortran to C++

**[00:00:32 – 00:00:35]** to Python to Rust to JavaScript.

**[00:00:35 – 00:00:38]** I'm involved in the leadership of many programming languages.

**[00:00:38 – 00:00:42]** I chaired the standard C++ library evolution group and

**[00:00:42 – 00:00:45]** the American Programming Languages Standards Committee.

**[00:00:45 – 00:00:49]** And today I'm very excited to share with you some of the

**[00:00:49 – 00:00:53]** details of a new programming model and compiler stack for CUDA, CUDA

**[00:00:53 – 00:00:56]** Tile, which was recently released.

**[00:00:56 – 00:01:00]** But before we get into what CUDA Tile is, let me explain

**[00:01:00 – 00:01:02]** to you why we built it.

**[00:01:02 – 00:01:06]** So let's start by looking at the landscape, starting with the two

**[00:01:06 – 00:01:09]** existing GPU programming models.

**[00:01:10 – 00:01:13]** So the first is grid-wide programming, where you invoke

**[00:01:13 – 00:01:17]** individual parallel operations on the entire input, such

**[00:01:17 – 00:01:19]** as a sort or a scan.

**[00:01:19 – 00:01:22]** The algorithms are launched from the CPU.

**[00:01:22 – 00:01:25]** In this model, you don't explicitly parallelize or

**[00:01:25 – 00:01:27]** partition the work or data.

**[00:01:27 – 00:01:30]** The system does this for you automatically, deciding how to

**[00:01:31 – 00:01:33]** divide up the problem and map it to

**[00:01:33 – 00:01:36]** Execution resources on one or more GPUs.

**[00:01:37 – 00:01:42]** This is the easiest and most common approach to GPU programming.

**[00:01:42 – 00:01:45]** There are many excellent GPU accelerated libraries that

**[00:01:45 – 00:01:49]** embody this grid-level programming model, such as CU-PI, PyTorch,

**[00:01:49 – 00:01:53]** CU-DF, CUBLAS, CUFTI, and CUB.

**[00:01:53 – 00:01:56]** Libraries should be the first thing that you reach for when

**[00:01:56 – 00:01:58]** writing GPU code.

**[00:01:58 – 00:02:00]** They will make your life easier, and they will often give you

**[00:02:00 – 00:02:03]** better performance because they're written and tuned

**[00:02:03 – 00:02:05]** By a team of experts.

**[00:02:05 – 00:02:10]** And you should try libraries before you write your own GPU kernels.

**[00:02:10 – 00:02:13]** For almost every use case that you can imagine, there

**[00:02:13 – 00:02:14]** is an existing library.

**[00:02:14 – 00:02:17]** And if there is, you should try it out and benchmark it.

**[00:02:17 – 00:02:20]** If it delivers the performance that you need, then use it.

**[00:02:20 – 00:02:24]** Don't reinvent the wheel.

**[00:02:26 – 00:02:30]** Sometimes, there is no library that does what you need, or

**[00:02:30 – 00:02:33]** you've tested and found that you don't get the performance

**[00:02:33 – 00:02:38]** that you want with the libraries that do exist, or more commonly,

**[00:02:38 – 00:02:41]** you need to fuse together different algorithms in a unique way.

**[00:02:41 – 00:02:44]** You don't just need to do a matmul or an FFT.

**[00:02:44 – 00:02:47]** You need to do something interesting after that operation,

**[00:02:47 – 00:02:51]** something that's unique to your domain or application.

**[00:02:51 – 00:02:54]** And those are the cases when you should consider writing

**[00:02:54 – 00:02:56]** your own GPU kernels.

**[00:02:56 – 00:02:59]** A GPU kernel is a function that is executed in parallel

**[00:02:59 – 00:03:02]** by a group of threads.

**[00:03:02 – 00:03:07]** All of those accelerated libraries are implemented with GPU kernels.

**[00:03:07 – 00:03:10]** Today, when you write a GPU kernel, you're programming

**[00:03:10 – 00:03:12]** at the thread level.

**[00:03:12 – 00:03:16]** You'll explicitly code every thread that you run on the GPU.

**[00:03:16 – 00:03:19]** You decide how to split the compute work into blocks,

**[00:03:19 – 00:03:22]** how to divide the data into tiles, and how these blocks

**[00:03:22 – 00:03:25]** and tiles get mapped to threads.

**[00:03:25 – 00:03:28]** We call this programming model SIMT, and it's been the only

**[00:03:28 – 00:03:32]** way to write CUDA kernels for the last 20 years.

**[00:03:33 – 00:03:36]** Writing CUDA SIMT kernels gives you complete control,

**[00:03:36 – 00:03:41]** allowing you to program and tune every aspect of the GPU.

**[00:03:41 – 00:03:44]** And in each new generation of NVIDIA GPUs, we expose

**[00:03:44 – 00:03:48]** more tools, giving you even greater control and freedom.

**[00:03:48 – 00:03:51]** But all of those choices can be overwhelming.

**[00:03:51 – 00:03:55]** What we really need is a higher-level abstraction

**[00:03:55 – 00:03:59]** that succinctly expresses kernels and allows the system to select

**[00:03:59 – 00:04:03]** which tools to implement them with.

**[00:04:03 – 00:04:04]** SenseVolta.

**[00:04:04 – 00:04:08]** NVIDIA GPUs have had Tensor cores to accelerate

**[00:04:08 – 00:04:12]** operations like matrix multiplication and convolution.

**[00:04:12 – 00:04:16]** And in every GPU generation since they were released, the structure

**[00:04:16 – 00:04:18]** of the Tensor cores has changed.

**[00:04:18 – 00:04:20]** The formats have changed, the precisions have changed,

**[00:04:20 – 00:04:24]** the widths have changed, the mapping to threads, etc.

**[00:04:24 – 00:04:26]** It's all been different across different architectures.

**[00:04:26 – 00:04:30]** And this has forced users in many cases to rewrite their

**[00:04:30 – 00:04:35]** Tensor core code for every new GPU that we release.

**[00:04:35 – 00:04:39]** What we need is a middle ground, a model where users can explicitly

**[00:04:40 – 00:04:44]** partition work and data exposing parallelism that may be application

**[00:04:44 – 00:04:48]** specific, but that partitioning is logical, not physical.

**[00:04:48 – 00:04:51]** The system decides which tools to use.

**[00:04:51 – 00:04:55]** It will map the partitioned work and data to threads and

**[00:04:55 – 00:04:56]** execution resources.

**[00:04:57 – 00:05:01]** And because the mapping is implicit, it's portable.

**[00:05:01 – 00:05:04]** The system can pick different mappings for different NVIDIA

**[00:05:04 – 00:05:06]** GPU architectures.

**[00:05:06 – 00:05:10]** So in this approach, we get much of the control and flexibility

**[00:05:10 – 00:05:15]** of SMPTE programming, but we also have high productivity and

**[00:05:15 – 00:05:21]** portability like grid programming, and we call this tile programming.

**[00:05:21 – 00:05:26]** So in CUDA 13.1, we introduced this model starting with CUTILE-Python,

**[00:05:26 – 00:05:31]** an array-oriented Python DSL for writing high-level GPU

**[00:05:31 – 00:05:35]** kernels that would be portable across CUDA architectures.

**[00:05:36 – 00:05:40]** It's built on top of TILE-IR, a new compiler stack and intermediate

**[00:05:40 – 00:05:43]** representation for TILE programs that automates block-level

**[00:05:43 – 00:05:47]** parallelism and memory movement.

**[00:05:47 – 00:05:51]** The initial 13.1 release only supported Blackwell, but now

**[00:05:51 – 00:05:56]** with 13.2, CUDA Tile supports Ampere and Ada GPUs as well,

**[00:05:56 – 00:05:59]** and we're working on support for more architectures too.

**[00:05:59 – 00:06:05]** And it will support all future NVIDIA GPU architectures as well.

**[00:06:05 – 00:06:09]** So Tile programming is simpler and higher productivity than

**[00:06:09 – 00:06:12]** SMPTE programming, but it does have less control.

**[00:06:12 – 00:06:16]** You should be able to get good performance faster with Tile.

**[00:06:16 – 00:06:20]** And you should be able to express most data parallel problems,

**[00:06:20 – 00:06:24]** but not necessarily all the things that you might want to do on a GPU.

**[00:06:24 – 00:06:27]** This is not a replacement for SIMT programming.

**[00:06:27 – 00:06:31]** Now, if we write the SIMT code shown on the left, we must decide

**[00:06:31 – 00:06:35]** how the data is loaded, mapped to threads, and stored locally.

**[00:06:35 – 00:06:38]** With Tile, the system does that for you.

**[00:06:38 – 00:06:42]** You just express your computation as array operations.

**[00:06:42 – 00:06:46]** Now, this naive SIMT code shown here on the left, it's a matmul,

**[00:06:46 – 00:06:52]** and it's relatively simple to understand, but it is suboptimal.

**[00:06:52 – 00:06:55]** To reach speed of light for a matmul with SIMT before

**[00:06:55 – 00:06:58]** CUDA Tile, you'd have to write something like this CUDA C++ code

**[00:06:58 – 00:07:01]** on the left, which is no easy feat.

**[00:07:01 – 00:07:03]** But it's also not going to be as portable.

**[00:07:03 – 00:07:07]** The code that you'd write would change from GPU architecture

**[00:07:07 – 00:07:10]** to GPU architecture.

**[00:07:11 – 00:07:14]** With Tile, we can write the simple code on the right and

**[00:07:14 – 00:07:17]** get good and portable performance.

**[00:07:17 – 00:07:21]** In fact, this very code from our samples can nearly match

**[00:07:21 – 00:07:26]** the speed of light performance that you'd get with Kublas.

**[00:07:27 – 00:07:30]** And Python is only the beginning.

**[00:07:30 – 00:07:34]** We have designed the Tile IR stack to be easy to target

**[00:07:34 – 00:07:35]** and build on top of.

**[00:07:35 – 00:07:40]** It can be integrated into frameworks like PyTorch and

**[00:07:40 – 00:07:44]** any DSL or programming language can add support for it and become

**[00:07:44 – 00:07:47]** a GPU kernel authoring language.

**[00:07:47 – 00:07:49]** For example,

**[00:07:49 – 00:07:50]** C++.

**[00:07:50 – 00:07:54]** We're very excited to share that CUTILE C++ will be launching

**[00:07:54 – 00:07:58]** in NVCC and CUDA 13.3.

**[00:07:58 – 00:08:02]** So it works alongside the existing CUDA C++ SIMT.

**[00:08:02 – 00:08:05]** You can write TILE and SIMT kernels in the same source file.

**[00:08:05 – 00:08:09]** This means you'll be able to start adopting Tile programming in

**[00:08:09 – 00:08:12]** your existing CUDA C++ codebases.

**[00:08:12 – 00:08:15]** And if you want to learn more about CUDA C++, there's a

**[00:08:15 – 00:08:19]** great demo at the NVIDIA booth on the show floor from the engineers

**[00:08:19 – 00:08:21]** who are working on building it.

**[00:08:21 – 00:08:23]** But that is not all.

**[00:08:24 – 00:08:27]** You can also now use CUDA Tile in Julia thanks to a

**[00:08:27 – 00:08:28]** community-driven project.

**[00:08:28 – 00:08:33]** It's available on GitHub today and I think maybe

**[00:08:33 – 00:08:36]** most exciting for some folks.

**[00:08:37 – 00:08:40]** We've been exploring Tile as a memory-safe way to write

**[00:08:40 – 00:08:45]** CUDA kernels in Rust, and the results are very promising.

**[00:08:45 – 00:08:48]** Now, this is an experimental and a research project.

**[00:08:49 – 00:08:52]** It's not an official product yet, but we have released

**[00:08:52 – 00:08:53]** it on GitHub last Friday.

**[00:08:53 – 00:08:57]** We're very interested to get feedback from the community

**[00:08:57 – 00:09:00]** about the approach.

**[00:09:00 – 00:09:04]** So we're thrilled about this growing CUTILE language ecosystem,

**[00:09:04 – 00:09:07]** and we're excited to see where it will grow next.

**[00:09:07 – 00:09:09]** I've been a little surprised by how easy it is to

**[00:09:09 – 00:09:11]** integrate into languages.

**[00:09:11 – 00:09:17]** Somebody internally built a Hasktile tile for Haskell during a

**[00:09:17 – 00:09:20]** hackathon, and Rob Armstrong, who's one of the CUDA product managers,

**[00:09:20 – 00:09:23]** he implemented CUTILE for BASIC.

**[00:09:23 – 00:09:26]** So it's, you know, these things are not that hard to do.

**[00:09:26 – 00:09:30]** Yeah, don't come asking for us to ship that as a product.

**[00:09:30 – 00:09:34]** So now let's look at the Tile Programming Model itself and

**[00:09:34 – 00:09:39]** see how it contrasts with the traditional SIMT programming model.

**[00:09:39 – 00:09:43]** So in SIMT, the unit of execution is a thread.

**[00:09:43 – 00:09:47]** You write kernel functions that are executed by many threads at once.

**[00:09:47 – 00:09:51]** The set of threads that a kernel runs on is called a thread grid.

**[00:09:51 – 00:09:54]** It's hierarchical, it's organized into different subgroups of

**[00:09:54 – 00:10:00]** threads, warps of threads, blocks of warps, clusters of blocks.

**[00:10:00 – 00:10:02]** Users define the shape of this hierarchy and they

**[00:10:02 – 00:10:06]** explicitly program to it.

**[00:10:06 – 00:10:09]** In CUDA Tile, the unit of execution is a block.

**[00:10:09 – 00:10:14]** A block is a group of threads or execution resources that has

**[00:10:14 – 00:10:17]** a single logical thread of control.

**[00:10:17 – 00:10:21]** So you write tile kernels that are executed by many blocks at once,

**[00:10:21 – 00:10:27]** but each block only executes the kernel once on the control thread.

**[00:10:27 – 00:10:31]** In the SIMT model, the grid and blocks are physical, but

**[00:10:31 – 00:10:37]** in the tile model, the grids and blocks are logical.

**[00:10:37 – 00:10:40]** In SIMT, the unit of data is individual elements.

**[00:10:40 – 00:10:44]** You write scalar operations on elements that each thread performs.

**[00:10:45 – 00:10:47]** If you want each thread to try to apply an operation

**[00:10:48 – 00:10:50]** to multiple elements, then you'd write a for loop.

**[00:10:50 – 00:10:55]** There are no native array operations in SIMT.

**[00:10:55 – 00:10:57]** On the other hand, in tile programming,

**[00:10:57 – 00:10:59]** everything is an array.

**[00:10:59 – 00:11:03]** You express block-wide operations on arrays that are local to

**[00:11:03 – 00:11:07]** the block, and we call these local arrays tiles.

**[00:11:07 – 00:11:12]** In fact, the Tile IR instructions themselves operate on these arrays.

**[00:11:12 – 00:11:16]** As far as Tile IR is concerned, everything is an array.

**[00:11:16 – 00:11:20]** So when running a SMPTE kernel, each thread within a block

**[00:11:20 – 00:11:21]** is going to execute the kernel.

**[00:11:21 – 00:11:26]** But a Tile kernel, again, is run by just a single thread per block.

**[00:11:26 – 00:11:29]** Within a Tile kernel, we create these tiles, which are these

**[00:11:29 – 00:11:34]** special type of local arrays that you perform array operations on.

**[00:11:34 – 00:11:38]** In those array operations, they are sequential with respect

**[00:11:38 – 00:11:42]** to the control thread, but they may be paralyzed under

**[00:11:42 – 00:11:46]** the hood by the system using the block's threads and other execution

**[00:11:46 – 00:11:50]** resources, like tensor cores.

**[00:11:51 – 00:11:54]** So in both SMPTE and Tile programming, the user is

**[00:11:54 – 00:11:58]** responsible for splitting the computational work into blocks

**[00:11:58 – 00:12:01]** and dividing the data into tiles.

**[00:12:01 – 00:12:06]** The key difference between SMPTE and Tile is who is responsible

**[00:12:06 – 00:12:12]** for mapping blocks and tiles onto execution resources and memory.

**[00:12:12 – 00:12:15]** Once you've partitioned your work and data exposing

**[00:12:15 – 00:12:18]** parallelism, there are still a lot of decisions to be made.

**[00:12:18 – 00:12:23]** What elements of data will each thread work with?

**[00:12:23 – 00:12:28]** Where does each thread keep copies of those elements?

**[00:12:28 – 00:12:33]** How should those local copies be laid out in memory?

**[00:12:33 – 00:12:36]** And how does each thread load and store those elements

**[00:12:36 – 00:12:38]** from global memory?

**[00:12:39 – 00:12:43]** And how does each thread perform computations?

**[00:12:44 – 00:12:47]** In SMPTE, the user is responsible for answering all of those

**[00:12:47 – 00:12:54]** questions by picking from the many tools that are available.

**[00:12:54 – 00:12:59]** But in Tile, the system makes those decisions, analyzing the program

**[00:12:59 – 00:13:04]** and selecting the best tools for the target NVIDIA architecture.

**[00:13:04 – 00:13:08]** All that we have to do explicitly is parallelize by dividing the

**[00:13:08 – 00:13:11]** problem up into blocks and tiles.

**[00:13:11 – 00:13:15]** Within each block, everything is logically single-threaded

**[00:13:15 – 00:13:18]** and you just perform array operations on tiles.

**[00:13:19 – 00:13:22]** And this gives us not only performance, but it also gives

**[00:13:22 – 00:13:24]** us performance portability.

**[00:13:24 – 00:13:27]** We ported some of the Flash and FERC kernels, fast multi-headed

**[00:13:27 – 00:13:32]** attention, and batched Matmult to CUDA Tile Python.

**[00:13:32 – 00:13:35]** And we can get competitive performance with the same

**[00:13:35 – 00:13:43]** high-level code on B200, and GB300, and RTX 5090, and DGX

**[00:13:43 – 00:13:47]** Spark, and H100, and A100.

**[00:13:47 – 00:13:52]** And these results are with zero code changes and no hand

**[00:13:52 – 00:13:54]** tuning for each architecture.

**[00:13:54 – 00:13:57]** Only the auto-tuned parameters were changed.

**[00:13:57 – 00:14:00]** So with Tile, you can write portable speed of

**[00:14:00 – 00:14:04]** light code for CUDA.

**[00:14:05 – 00:14:11]** So CUTILE Python kernels are JIT-compiled to Tile IR, using

**[00:14:11 – 00:14:14]** an execution model that allows the code to be executed without

**[00:14:14 – 00:14:19]** the need for a Python interpreter or runtime, similar to NUMBA's

**[00:14:19 – 00:14:23]** no-Python compilation mode, Triton and Pallas.

**[00:14:24 – 00:14:27]** Now, this model has some semantic compromises, because

**[00:14:27 – 00:14:30]** essentially you're writing Python code, but with a

**[00:14:30 – 00:14:32]** C object model and semantics.

**[00:14:32 – 00:14:36]** So all objects have either value or pointer semantics, and

**[00:14:36 – 00:14:40]** you can't do some Pythonic things like dynamically modify types,

**[00:14:40 – 00:14:43]** and there's no reference counting, so you must manually manage

**[00:14:43 – 00:14:46]** the lifetimes of your arrays.

**[00:14:47 – 00:14:50]** Tile is an array-oriented programming model, just like

**[00:14:50 – 00:14:52]** NumPy or PyTorch.

**[00:14:52 – 00:14:55]** So if you know how to use NumPy, if you know how to use PyTorch, then

**[00:14:55 – 00:14:57]** you know how to use CUTILE Python.

**[00:14:57 – 00:15:00]** Here's an example of softmax written in the left in straight

**[00:15:00 – 00:15:04]** NumPy and in the right in CUTILE.

**[00:15:05 – 00:15:08]** So as I said, this is an array-oriented programming

**[00:15:08 – 00:15:12]** language, and there's two kinds of arrays in Tile programming.

**[00:15:12 – 00:15:16]** Global arrays are typical NumPy-like arrays that are

**[00:15:16 – 00:15:20]** accessible by all Tile blocks, and they are mutable.

**[00:15:20 – 00:15:24]** If you modify their contents, any other references to the underlying

**[00:15:24 – 00:15:26]** data will see those changes.

**[00:15:26 – 00:15:30]** They are passed in as kernel parameters or globals.

**[00:15:30 – 00:15:35]** You can only perform a limited set of operations on global arrays in

**[00:15:35 – 00:15:41]** Tile code, most importantly loading from them to create Tile arrays

**[00:15:41 – 00:15:45]** or storing Tile arrays to them.

**[00:15:45 – 00:15:50]** Now, Tile arrays are immutable NumPy-like arrays that are

**[00:15:50 – 00:15:52]** local to a block.

**[00:15:52 – 00:15:57]** Operations on Tiles always return a copy, not a view, and

**[00:15:57 – 00:16:01]** are parallelized across the block.

**[00:16:02 – 00:16:06]** Most of the common operations that you can perform on NumPy or PyTorch

**[00:16:06 – 00:16:09]** arrays will be supported on Tiles.

**[00:16:09 – 00:16:12]** And those array operations are going to be parallelized using

**[00:16:12 – 00:16:14]** the block's execution resources.

**[00:16:15 – 00:16:17]** But again, from the perspective of the block's single thread

**[00:16:17 – 00:16:23]** of control, these operations are performed sequentially.

**[00:16:24 – 00:16:27]** All of CUDA's underlying launch APIs support both

**[00:16:27 – 00:16:29]** SMPTE and Tile kernels.

**[00:16:29 – 00:16:32]** There's no distinction between the two kernel kinds.

**[00:16:32 – 00:16:34]** Users don't have to care how a kernel was written, be it

**[00:16:34 – 00:16:37]** SMPTE or Tile, to use it.

**[00:16:37 – 00:16:39]** And this means that you can use and integrate Tile kernels

**[00:16:39 – 00:16:43]** anywhere that you can use SMPTE kernels, in CUPEI, in CUDAF,

**[00:16:43 – 00:16:47]** in PyTorch, in JAX, et cetera.

**[00:16:48 – 00:16:51]** Array parameters to kernel launches can be anything that

**[00:16:51 – 00:16:58]** satisfies DLPack, so CUPEI arrays, PyTorch tensors, JAX arrays, etc.

**[00:16:59 – 00:17:02]** Now, we said earlier that tile arrays are immutable and that

**[00:17:02 – 00:17:08]** all tile operations return copies, that tiles have value semantics.

**[00:17:08 – 00:17:12]** This enables optimizations like fusion, fission, and

**[00:17:12 – 00:17:16]** pipelining, and it simplifies compiler analysis by eliminating

**[00:17:16 – 00:17:19]** problems such as aliasing.

**[00:17:19 – 00:17:23]** Now, some NumPy and PyTorch array operations, such as indexing,

**[00:17:23 – 00:17:25]** reshaping, and transposing,

**[00:17:26 – 00:17:30]** We'll typically return references to the same underlying data,

**[00:17:30 – 00:17:34]** not copies when possible as an optimization.

**[00:17:34 – 00:17:37]** The tile equivalents are always going to return

**[00:17:37 – 00:17:40]** copies, not references.

**[00:17:40 – 00:17:44]** And this means that we have to change our thinking a little bit.

**[00:17:44 – 00:17:48]** So, for example, one implication of this is that assignment to the

**[00:17:48 – 00:17:51]** elements of a tile is ill-formed.

**[00:17:51 – 00:17:55]** If you need to change the value of some of the elements,

**[00:17:55 – 00:17:58]** you'll need to make a new tile.

**[00:17:59 – 00:18:02]** You can do this with the WHERE operation, which takes a boolean

**[00:18:02 – 00:18:06]** tile and two source tiles and returns a blended tile that has

**[00:18:06 – 00:18:10]** the element from the first source when the corresponding boolean tile

**[00:18:10 – 00:18:15]** element is true and the element from the second source otherwise.

**[00:18:16 – 00:18:20]** It's a little bit unnerving to think of tile arrays as values

**[00:18:20 – 00:18:25]** because typically our intuition is that it's fine to make copies and

**[00:18:25 – 00:18:29]** temporaries of scalars like ints because they are cheap to copy and

**[00:18:29 – 00:18:32]** they won't always be materialized.

**[00:18:32 – 00:18:38]** But we think array copies should be avoided because they're expensive

**[00:18:38 – 00:18:44]** and they'll always lead to an allocation and materialization.

**[00:18:44 – 00:18:47]** But tile arrays are different.

**[00:18:47 – 00:18:50]** You need to treat tile arrays as you would ints.

**[00:18:50 – 00:18:54]** They are cheap to copy, and more importantly, they won't

**[00:18:54 – 00:18:56]** be materialized necessarily.

**[00:18:56 – 00:19:00]** Just because you've created one in code doesn't mean that

**[00:19:00 – 00:19:03]** one has been allocated anywhere.

**[00:19:03 – 00:19:06]** Imagine an architecture where all instructions are array

**[00:19:06 – 00:19:10]** operations and all the operands and registers are arrays.

**[00:19:10 – 00:19:14]** That is essentially the tile programming model.

**[00:19:14 – 00:19:18]** So let's look at the load and store operations in greater detail.

**[00:19:18 – 00:19:22]** Each has three required parameters.

**[00:19:22 – 00:19:28]** Both take an array to load from and store to.

**[00:19:28 – 00:19:33]** And loads take the shape of the tile that should be loaded.

**[00:19:33 – 00:19:39]** The shape must have the same number of dimensions as the array.

**[00:19:39 – 00:19:43]** Stores take a tile to store into the array.

**[00:19:43 – 00:19:49]** And that tile must have the same number of dimensions as the array.

**[00:19:49 – 00:19:53]** Finally, they take a multi-dimensional index, and

**[00:19:53 – 00:19:59]** this is an index in the tile space.

**[00:19:59 – 00:20:03]** The tile space of a global array is the multi-dimensional

**[00:20:03 – 00:20:10]** space of tiles into that global array of a certain tile shape.

**[00:20:10 – 00:20:15]** So a tile index i, j, with shape s, refers to the elements

**[00:20:15 – 00:20:22]** of the global array belonging to the i-th, j-th tile of that shape.

**[00:20:22 – 00:20:26]** Typically, we need each block to handle a unique subset of

**[00:20:26 – 00:20:31]** the input data, or at least write to a unique subset of the output.

**[00:20:31 – 00:20:36]** ct.bid returns the multidimensional coordinates

**[00:20:36 – 00:20:38]** of this block in the grid.

**[00:20:38 – 00:20:41]** Each block has a unique set of coordinates, so they can

**[00:20:41 – 00:20:47]** be used to find a unique chunk of data for this block.

**[00:20:48 – 00:20:54]** Now, if we change our tile shape but use the same index, we'll

**[00:20:54 – 00:20:59]** be in a new tile space, so we will load a different tile, even though

**[00:20:59 – 00:21:02]** we've provided the same index.

**[00:21:02 – 00:21:06]** Remember, the distinction between blocks, which are

**[00:21:06 – 00:21:12]** a subgroup of threads, a unit of execution, and tiles, a subset

**[00:21:12 – 00:21:15]** of global arrays, a unit of data.

**[00:21:15 – 00:21:20]** A block may work with multiple different tiles with differing

**[00:21:20 – 00:21:24]** shapes originating from differing arrays.

**[00:21:24 – 00:21:28]** A great example of this is tiled matrix multiplication.

**[00:21:28 – 00:21:35]** We have two input matrices, x of shape m by k, and y of

**[00:21:35 – 00:21:41]** shape k by n, and one output matrix, z of shape m by n.

**[00:21:41 – 00:21:44]** We partition in both dimensions.

**[00:21:44 – 00:21:50]** Each block will compute the result for an mt by nt tile

**[00:21:50 – 00:21:55]** of z. But to do that, each block has to load multiple tiles from

**[00:21:55 – 00:22:03]** x of size mt by kt and multiple tiles from y of size kt by nt.

**[00:22:04 – 00:22:07]** We can optimize this kernel further by changing how block

**[00:22:07 – 00:22:12]** IDs are mapped to the data using a space-filling curve

**[00:22:12 – 00:22:14]** with the swizzle2D function.

**[00:22:14 – 00:22:17]** Before, adjacent blocks would access a row of tiles,

**[00:22:17 – 00:22:20]** and now they'll access a rectangle, which leads to

**[00:22:20 – 00:22:25]** better locality and L2 caching.

**[00:22:26 – 00:22:29]** Another way to perform this load is with Views.

**[00:22:29 – 00:22:33]** View objects are multidimensional tile spaces.

**[00:22:33 – 00:22:37]** The underlying tiles can come from an array, another tile,

**[00:22:37 – 00:22:39]** or by generating them.

**[00:22:39 – 00:22:44]** For example, Array.Partition returns the non-overlapping

**[00:22:44 – 00:22:46]** tiles of an array

**[00:22:46 – 00:22:48]** of a particular tile shape.

**[00:22:48 – 00:22:52]** You can index a view with a tile index, which loads the

**[00:22:53 – 00:22:56]** tile at that index from the array.

**[00:22:56 – 00:23:02]** You can also store through some types of views, including this one.

**[00:23:03 – 00:23:08]** Here's what that same kernel would look like in CUTILE C++.

**[00:23:08 – 00:23:11]** Now, in a kernel like MATML, where you are loading multiple

**[00:23:11 – 00:23:14]** tiles of the same shape from an array, this can be more

**[00:23:14 – 00:23:19]** concise and cleaner than using the high-level load and store API.

**[00:23:19 – 00:23:23]** You pass the shape in just once when you're using views

**[00:23:23 – 00:23:28]** to that view instead of passing it in on every call to load.

**[00:23:29 – 00:23:33]** Now, load and store operations are a portable abstraction

**[00:23:33 – 00:23:38]** over the many different strategies for memory movement that are

**[00:23:38 – 00:23:41]** available in CUDA.

**[00:23:42 – 00:23:46]** For example, load could lower to a traditional

**[00:23:46 – 00:23:50]** synchronous instructions, potentially vectorized.

**[00:23:50 – 00:23:54]** Or it could use the asynchronous thread copy instructions available

**[00:23:54 – 00:23:58]** in newer GPUs, allowing memory movement to be overlapped

**[00:23:58 – 00:24:01]** and pipelined with compute.

**[00:24:01 – 00:24:04]** We could also use the Tensor memory accelerator, available

**[00:24:04 – 00:24:08]** on newer hardware, to perform asynchronous block-wide loads

**[00:24:08 – 00:24:13]** in stores, allowing for even more overlap of compute and IO.

**[00:24:13 – 00:24:16]** The system will pick the best option available given the

**[00:24:16 – 00:24:19]** constraints of the memory access pattern that you've

**[00:24:19 – 00:24:24]** specified and the hardware that you are running on.

**[00:24:25 – 00:24:29]** Certain compute operations, like Matrix Multiply Accumulate,

**[00:24:29 – 00:24:32]** are also portable abstractions over hardware, this time

**[00:24:32 – 00:24:35]** for Tensor cores.

**[00:24:35 – 00:24:38]** As we said before, NVIDIA GPUs have had Tensor cores

**[00:24:38 – 00:24:42]** to accelerate operations like Matmul and Convolution for a while,

**[00:24:43 – 00:24:46]** but in every GPU generation since they were released, the structure

**[00:24:46 – 00:24:48]** of the Tensor cores has changed.

**[00:24:48 – 00:24:50]** The formats, the precisions, the widths...

**[00:24:50 – 00:24:53]** The mapping to threads, et cetera, have all been different

**[00:24:53 – 00:24:54]** across architectures.

**[00:24:54 – 00:24:57]** And that's forced a lot of users to have to rewrite Tensor

**[00:24:57 – 00:25:00]** core code for every new GPU that we've released.

**[00:25:00 – 00:25:03]** With CUDA Tile, though, you don't have to worry about

**[00:25:03 – 00:25:04]** all of these changes.

**[00:25:04 – 00:25:08]** You can write Tile code once, and the system will take care

**[00:25:08 – 00:25:14]** of mapping it to current and future Tensor core hardware.

**[00:25:14 – 00:25:17]** So now let's talk about tile shapes.

**[00:25:17 – 00:25:21]** The shape of a tile must be a constant expression, something

**[00:25:21 – 00:25:24]** that is either a constant or that the compiler can see

**[00:25:24 – 00:25:25]** comes from a constant.

**[00:25:25 – 00:25:29]** In C++, this means that you must pass them by template

**[00:25:29 – 00:25:34]** parameter or that they have to be a constexpr value.

**[00:25:34 – 00:25:38]** In Python, we express this by annotating a parameter

**[00:25:38 – 00:25:43]** with CUDA.tile.constant, which makes it usable as a tile shape.

**[00:25:43 – 00:25:47]** Such a parameter will be constant embedded in the kernel.

**[00:25:47 – 00:25:49]** That means that you should think of it as if all uses

**[00:25:49 – 00:25:53]** of that parameter will behave as if they were replaced by

**[00:25:53 – 00:25:55]** the value of the parameter.

**[00:25:55 – 00:25:59]** Now at JIT compilation time, we always know all the values

**[00:25:59 – 00:26:04]** of all the parameters, but we don't necessarily want to embed

**[00:26:04 – 00:26:09]** all of them because this has an impact on JIT compilation caching.

**[00:26:09 – 00:26:13]** Kernels must be JIT compiled for each different value of

**[00:26:13 – 00:26:16]** a constant embedded parameter.

**[00:26:16 – 00:26:19]** So if you change a constant parameter, JIT compilation

**[00:26:19 – 00:26:24]** may occur even if you've already called that kernel.

**[00:26:24 – 00:26:27]** But if you instead use a dynamic parameter, if you call the

**[00:26:27 – 00:26:31]** function again with the same type but with a different value, it will

**[00:26:31 – 00:26:33]** use the cached compiled kernel.

**[00:26:33 – 00:26:38]** You only have to recompile for different parameter types.

**[00:26:39 – 00:26:43]** Today, each dimension of a tile must be a power of two,

**[00:26:43 – 00:26:49]** but this is a restriction that we plan to relax as soon as possible.

**[00:26:49 – 00:26:52]** There's a few reasons for these constraints on the value

**[00:26:52 – 00:26:55]** and constaness of tile shapes.

**[00:26:55 – 00:26:58]** First, it creates compiler optimization opportunities.

**[00:26:58 – 00:27:01]** We can unroll loops, we can check divisibility, which

**[00:27:01 – 00:27:04]** helps enable vectorization, and we can perform better

**[00:27:04 – 00:27:07]** affine analysis and subtiling.

**[00:27:07 – 00:27:08]** Additionally,

**[00:27:08 – 00:27:13]** Tiles may end up being placed in shared memory or local

**[00:27:13 – 00:27:18]** memory or some other resource that needs to be statically allocated.

**[00:27:18 – 00:27:22]** Remember, in tile programming, the system decides where the

**[00:27:22 – 00:27:24]** tile will be stored.

**[00:27:24 – 00:27:27]** In register memory, in shared memory, in tensor memory,

**[00:27:27 – 00:27:32]** in global memory, or whatever other type of memory we invent.

**[00:27:32 – 00:27:36]** Or a tile could even be spread across a combination

**[00:27:36 – 00:27:38]** of different memory kinds.

**[00:27:38 – 00:27:42]** The system will also decide what layout the tile will have.

**[00:27:42 – 00:27:45]** And this is often tied to what elements each thread

**[00:27:45 – 00:27:49]** will be responsible for when array operations are performed.

**[00:27:49 – 00:27:52]** For example, during loading, we want a specific memory

**[00:27:52 – 00:27:56]** layout such that each thread is loading elements nearby

**[00:27:56 – 00:28:00]** to the elements that their neighbor threads are loading to ensure that

**[00:28:00 – 00:28:04]** loads can be coalesced together and issued once for a group of threads.

**[00:28:04 – 00:28:08]** But for another operation, like reduction, we might want

**[00:28:08 – 00:28:10]** consecutive elements to be adjacent to each other for

**[00:28:10 – 00:28:13]** better numerical stability.

**[00:28:13 – 00:28:17]** So now we've looked at and talked about a lot of DL kernels

**[00:28:17 – 00:28:22]** so far, but that's not all that Tile is good for.

**[00:28:22 – 00:28:25]** Two of my colleagues, Thibault and Mark, have written an excellent

**[00:28:25 – 00:28:30]** little Tile library for sparse matrix vector multiplication.

**[00:28:30 – 00:28:34]** Sparse linear algebra is memory bandwidth bound and can't actually

**[00:28:34 – 00:28:38]** utilize the tensor cores, but it still benefits from tile compiler

**[00:28:38 – 00:28:42]** optimizations like vectorization, fusion, fission, pipelining,

**[00:28:42 – 00:28:46]** unrolling, and TMA utilization.

**[00:28:46 – 00:28:50]** So here's the performance of their sliced ELPAC SPMV implementation

**[00:28:50 – 00:28:53]** on B200 comparing against CUSPARSE.

**[00:28:53 – 00:28:59]** The inputs here are various matrices from Matrix Market.

**[00:28:59 – 00:29:04]** The Tile implementation is just one kernel, that's 78 lines of

**[00:29:04 – 00:29:08]** code, and the SIMT implementation is 12 separate kernels totaling

**[00:29:08 – 00:29:11]** over 1,000 lines of code.

**[00:29:11 – 00:29:15]** The performance of sparse linear algebra is very sensitive to the

**[00:29:15 – 00:29:18]** structure of the input matrices, which is why you need those

**[00:29:18 – 00:29:21]** 12 kernels for SIMT because you're going to pick a different kernel

**[00:29:21 – 00:29:23]** for a different type of matrix.

**[00:29:24 – 00:29:27]** With the SIMT implementation, you have to hand optimize

**[00:29:27 – 00:29:29]** for different input matrices.

**[00:29:29 – 00:29:33]** With Tile, it's easy to write one generic kernel and then

**[00:29:33 – 00:29:39]** just auto-tune the Tile size for your input matrix.

**[00:29:40 – 00:29:43]** We implemented a real-time fluid dynamics simulation

**[00:29:43 – 00:29:47]** in a sparse volume with smooth particle hydrodynamics using

**[00:29:47 – 00:29:50]** this Tile SPMV code.

**[00:29:50 – 00:29:54]** SPH models fluid dynamics as discrete particles using

**[00:29:54 – 00:29:56]** nearest neighbor interactions.

**[00:29:56 – 00:29:58]** So in this problem, you have a domain that is mostly

**[00:29:59 – 00:30:02]** empty, but there are particles present in part of it.

**[00:30:02 – 00:30:06]** The simulation shown here models a dam breaking.

**[00:30:06 – 00:30:10]** The kernel is essentially a sparse matrix vector multiply

**[00:30:10 – 00:30:14]** fused with a normalization, and that's not something that you could

**[00:30:14 – 00:30:15]** use CUSPARSE out of the box for.

**[00:30:16 – 00:30:20]** You would need to use CUSPARSE for the SPMV and then write

**[00:30:20 – 00:30:23]** your own normalization kernel.

**[00:30:23 – 00:30:27]** In this codebase, we combine together Tile code and SIMT

**[00:30:27 – 00:30:30]** code, leveraging existing optimized SIMT algorithms

**[00:30:30 – 00:30:33]** such as CUB scans and sorts.

**[00:30:33 – 00:30:37]** To perform sparse operations that are hard to express in Tile.

**[00:30:37 – 00:30:40]** Not everything is best expressed in Tile.

**[00:30:40 – 00:30:43]** For some algorithms, you'll be better off with SMPTE.

**[00:30:43 – 00:30:46]** Some things may not even be expressible in Tile.

**[00:30:47 – 00:30:50]** If we wrote everything in SMPTE, we could still use CUB

**[00:30:50 – 00:30:56]** for sort and scan, but you'd still have to hand optimize the rest.

**[00:30:57 – 00:31:00]** Now, if you rethink your algorithms a bit, if you figure out how

**[00:31:00 – 00:31:03]** to map it to Tile, what portions you should map to Tile, then

**[00:31:03 – 00:31:07]** you can mix optimized device-side SMPTE libraries with your

**[00:31:07 – 00:31:11]** own performance-portable Tile code.

**[00:31:12 – 00:31:17]** You can use Tile and SMPTE together in any workflow.

**[00:31:17 – 00:31:21]** Today, you can write and use Tile and SMPTE kernels in

**[00:31:21 – 00:31:23]** the same source file.

**[00:31:24 – 00:31:27]** But in the future, you'll be able to write hybrid kernels that

**[00:31:27 – 00:31:31]** use both Tile and SMPTE functions, and I'm very excited to share

**[00:31:31 – 00:31:35]** with you a preview of that today.

**[00:31:35 – 00:31:39]** This CUTILE kernel loads one matrix per batch element,

**[00:31:39 – 00:31:44]** then it computes its FFT, converts the result into a log-scaled

**[00:31:44 – 00:31:49]** power spectrum, and then quantizes that spectrum into histogram bins.

**[00:31:49 – 00:31:53]** It then builds a histogram of spectral energy, sorts the bins

**[00:31:53 – 00:31:57]** by count, and computes an exclusive prefix sum over the histogram.

**[00:31:57 – 00:32:01]** The output is a compact per batch summary of how much

**[00:32:01 – 00:32:06]** spectral energy is distributed across frequency ranges.

**[00:32:06 – 00:32:12]** It uses CUFFT-DX to perform the FFT within the block.

**[00:32:12 – 00:32:17]** And it uses CUB for the histogram, sort, and scan.

**[00:32:17 – 00:32:21]** And the overhead of calls between SIMT and Tile is very low.

**[00:32:21 – 00:32:25]** The worst case we've seen thus far has only been about 4%.

**[00:32:26 – 00:32:29]** In many cases, it's a lot cheaper than that.

**[00:32:29 – 00:32:31]** But that's not all.

**[00:32:31 – 00:32:33]** What about when you need to scale out?

**[00:32:33 – 00:32:38]** Here's a Tile implementation of a 3D fast Fourier transform.

**[00:32:38 – 00:32:48]** It performs an FFT with CUFFT-DX in XZ, XY, and YZ, and it exchanges

**[00:32:48 – 00:32:52]** data between GPUs with NVShmem.

**[00:32:52 – 00:32:57]** Tile will have support for NVIDIA's multi-GPU and multi-node comms

**[00:32:57 – 00:33:01]** libraries like NVShmem and Nickel.

**[00:33:01 – 00:33:05]** And this distributed FFT code implemented with Tile plus

**[00:33:05 – 00:33:12]** CUFFT-DX plus NVShMEM performs as good or better than CUFFT-MP and

**[00:33:12 – 00:33:15]** is significantly smaller code size.

**[00:33:15 – 00:33:19]** And it's easy to customize and fuse this FFT code with

**[00:33:19 – 00:33:23]** other operations that you might need to perform.

**[00:33:24 – 00:33:27]** CUTILE is a major new addition to CUDA.

**[00:33:27 – 00:33:31]** It's the first time we've extended to a new programming paradigm.

**[00:33:31 – 00:33:33]** But SIMT isn't going anywhere.

**[00:33:33 – 00:33:36]** There are still some things that you simply can't express

**[00:33:36 – 00:33:40]** in TILE, such as implementing synchronization algorithms

**[00:33:40 – 00:33:43]** where threads within a block must explicitly communicate.

**[00:33:43 – 00:33:46]** TILE is an addition, not a replacement.

**[00:33:46 – 00:33:50]** And we're very excited about the possibilities that CUTILE unlocks.

**[00:33:51 – 00:33:55]** Now it will be much easier to write speed of light

**[00:33:56 – 00:33:58]** If you want to learn more about GPU programming, there

**[00:33:58 – 00:34:01]** are many other great talks to see at GTC this year.

**[00:34:01 – 00:34:06]** If you're interested in learning more about cuTile C++ or about

**[00:34:06 – 00:34:12]** that SPH demo, that's what will be at the NVIDIA booth.

**[00:34:13 – 00:34:16]** And we've also released a new open source CUDA curriculum

**[00:34:16 – 00:34:18]** with tutorials, notebooks, and other learning materials that

**[00:34:18 – 00:34:21]** you can find on our accelerated computing hub on GitHub.

**[00:34:21 – 00:34:23]** There is some CUDA Tile content there.

**[00:34:23 – 00:34:27]** That's something I will be working on in the next few months.

**[00:34:27 – 00:34:30]** And we hope to eventually have a full CUDA Tile tutorial.

**[00:34:30 – 00:34:34]** There's a lot of great samples in both the cuTile Python GitHub

**[00:34:34 – 00:34:38]** repository and also in Tile Gym.

**[00:34:38 – 00:34:40]** So thank you all for your attention.

**[00:34:40 – 00:34:44]** I think we now have a little bit of time for questions.

**[00:34:51 – 00:34:54]** Yes, in the back.

**[00:34:57 – 00:34:58]** Thank you, Bryce.

**[00:34:58 – 00:35:01]** I'm Arjun from KLA.

**[00:35:01 – 00:35:04]** So the overhead that you talked about when you've

**[00:35:04 – 00:35:09]** got interop between Tile and SIMT functions, is this

**[00:35:09 – 00:35:13]** on top of the overhead that you would typically see when you have

**[00:35:13 – 00:35:15]** a function call in your kernel?

**[00:35:15 – 00:35:21]** So the overhead comes from

**[00:35:21 – 00:35:26]** You know, we said the tiles are in a layout and in storage decided

**[00:35:26 – 00:35:28]** by the Tile compiler, right?

**[00:35:28 – 00:35:32]** You know, maybe a Tile, like, maybe part of the Tile is

**[00:35:32 – 00:35:35]** in registers and the rest of it's in shared memory, right?

**[00:35:35 – 00:35:36]** Like, maybe it's split off there.

**[00:35:36 – 00:35:41]** And then, like, you call cub sort on that thing.

**[00:35:41 – 00:35:45]** And, like, for the Tile compiler to pass the Tile to SMPTE

**[00:35:45 – 00:35:50]** code, it has to put it into, you know, one place.

**[00:35:50 – 00:35:54]** in place. So it may have to materialize it, or it may

**[00:35:54 – 00:35:58]** be that it's in a place already or it's spread across multiple places

**[00:35:58 – 00:36:01]** and that the Tile compiler has to normalize it into some format

**[00:36:01 – 00:36:06]** that it can pass to SMPTE code that then SMPTE code can understand.

**[00:36:06 – 00:36:11]** So that's really where the cost comes from, is that within Tile

**[00:36:11 – 00:36:14]** code, everything's very high level.

**[00:36:14 – 00:36:17]** The compiler knows about the layout of all this stuff.

**[00:36:18 – 00:36:22]** But when you pass it to SMPTE code, you have a lot greater

**[00:36:22 – 00:36:25]** control, but that means that we have to give you the thing.

**[00:36:25 – 00:36:28]** And so there can be a materialization cost.

**[00:36:28 – 00:36:34]** So a quick follow-up, suppose you wrote native C++ SIMT

**[00:36:34 – 00:36:39]** functions, can that be taken into the context by Tile IREs,

**[00:36:39 – 00:36:44]** or maybe... Yeah, so the way that the interop works, I don't

**[00:36:44 – 00:36:46]** want to get into too much details because we've not shipped it

**[00:36:46 – 00:36:52]** yet, but the way that the interop works is that there has to be some

**[00:36:52 – 00:36:54]** scaffolding around your SMPTE code.

**[00:36:54 – 00:37:00]** Where you have to express things about what block size

**[00:37:00 – 00:37:05]** this expects and how many registers it may use, things like that.

**[00:37:05 – 00:37:08]** So there's some scaffolding that may be needed to express to

**[00:37:08 – 00:37:10]** the Tile so that the Tile compiler has enough information to reason

**[00:37:11 – 00:37:12]** about what your code is doing.

**[00:37:12 – 00:37:16]** Because today when you write SMPTE code, there's often

**[00:37:16 – 00:37:17]** an implicit contract.

**[00:37:17 – 00:37:19]** Like you write a SMPTE function and this SMPTE function is

**[00:37:19 – 00:37:21]** really designed to operate.

**[00:37:21 – 00:37:25]** with this particular thread block size.

**[00:37:25 – 00:37:28]** And you writing the code may know that, your code base may

**[00:37:28 – 00:37:32]** know that, but the compiler doesn't have a way to understand that.

**[00:37:32 – 00:37:36]** And so we need to somehow express that information out.

**[00:37:38 – 00:37:42]** Bryce, I have a question here related to, let's say, let's make

**[00:37:42 – 00:37:46]** it C++ specific, related to cuTile.

**[00:37:46 – 00:37:51]** When it is selecting which

**[00:37:51 – 00:37:54]** shared memory, register, global, whatever, right?

**[00:37:54 – 00:38:00]** So like that abstraction, is that done at compile time or at runtime?

**[00:38:00 – 00:38:01]** It's done at compile time.

**[00:38:01 – 00:38:06]** Okay, so it's similar to a tactic, so to speak.

**[00:38:06 – 00:38:10]** Yeah, it's not making like a runtime decision on this.

**[00:38:10 – 00:38:15]** Okay, is there any support for whole program optimization

**[00:38:15 – 00:38:18]** then if you're running multiple streams in parallel and

**[00:38:18 – 00:38:21]** you're trying to balance the resources of the system?

**[00:38:21 – 00:38:26]** So we certainly, we are working on auto tuning support for

**[00:38:26 – 00:38:28]** cuTile, Python, there will probably be something like

**[00:38:28 – 00:38:31]** that in for cuTile C++.

**[00:38:31 – 00:38:34]** One thing we didn't cover here today is the way that performance

**[00:38:34 – 00:38:37]** hints and like tuning knobs work.

**[00:38:37 – 00:38:40]** But there are these tuning knobs, and they're exposed

**[00:38:40 – 00:38:41]** up in all the languages.

**[00:38:41 – 00:38:46]** You might want to tune over those.

**[00:38:46 – 00:38:50]** I would imagine that I don't think we have any plans to hook

**[00:38:50 – 00:38:54]** into whole program optimization frameworks, but I imagine

**[00:38:54 – 00:38:59]** that the tools will be there for someone to do that.

**[00:38:59 – 00:39:02]** Because I think that the work that will need to be done

**[00:39:02 – 00:39:05]** to expose autotuning in particular

**[00:39:05 – 00:39:10]** People don't want you to give them some opinionated

**[00:39:10 – 00:39:11]** auto-tuning framework.

**[00:39:11 – 00:39:14]** What people have expressed to us is that they want hooks to be able

**[00:39:14 – 00:39:19]** to hook, to be able to use their opinionated auto-tuning framework

**[00:39:19 – 00:39:21]** to auto-tune cuTile kernels.

**[00:39:21 – 00:39:28]** And so building those hooks would probably also unlock a lot of

**[00:39:28 – 00:39:33]** profiling tools and a whole program optimization and things like that.

**[00:39:33 – 00:39:37]** Profile Guided Optimization, maybe.

**[00:39:37 – 00:39:38]** Thanks Bryce.

**[00:39:39 – 00:39:42]** I got a question about previously Stephen in another session

**[00:39:42 – 00:39:47]** mentioned that Kotel could be used to improve the performance

**[00:39:47 – 00:39:52]** not only for Kodian but also some plenty of different libraries.

**[00:39:52 – 00:39:55]** Does that because of the data locality improvement in the

**[00:39:55 – 00:39:58]** tail programming model?

**[00:39:59 – 00:40:06]** I think it is it is hard to make a general statement on like

**[00:40:06 – 00:40:10]** There's no one thing that would lead to the compiler

**[00:40:10 – 00:40:12]** generating better code.

**[00:40:12 – 00:40:17]** The compiler does a number of clever optimizations.

**[00:40:17 – 00:40:19]** It really depends on what your application is doing.

**[00:40:20 – 00:40:23]** So I can't give you data locality.

**[00:40:23 – 00:40:28]** Sure, that's a part of it, but pipelining is another part.

**[00:40:28 – 00:40:31]** Automating warp specialization is another part.

**[00:40:31 – 00:40:34]** It's also hard to say because

**[00:40:34 – 00:40:39]** There's the current state of the compiler today, which it's been

**[00:40:39 – 00:40:41]** in development for three years.

**[00:40:41 – 00:40:44]** It's been released for a couple weeks.

**[00:40:44 – 00:40:47]** It's been in beta for longer than that.

**[00:40:47 – 00:40:53]** I think that we will see a lot of growth in what the compiler can

**[00:40:53 – 00:40:56]** do in the sorts of optimizations that are in the framework.

**[00:40:56 – 00:41:01]** The programming model that we've picked here,

**[00:41:02 – 00:41:06]** is very amenable to a wide range of optimizations.

**[00:41:06 – 00:41:10]** So I have a long laundry list of things that we could do

**[00:41:10 – 00:41:12]** but are not doing today.

**[00:41:12 – 00:41:17]** And over time, we will do more and more of those things.

**[00:41:18 – 00:41:22]** A lot of the optimizations we have, we gotta start wrapping on time.

**[00:41:22 – 00:41:23]** We'll maybe take one more question.

**[00:41:23 – 00:41:24]** No, I'm sorry. Okay, we're done.

**[00:41:24 – 00:41:26]** There's not enough time for any more questions, but thank

**[00:41:26 – 00:41:27]** you everybody for coming.

**[00:41:27 – 00:41:29]** Hope you've enjoyed the session.

**[00:41:29 – 00:41:29]** We do hope...

