
PTX
PTX is a low-level intermediate language from Nvidia into which programs for graphics cards are translated before they run on the chip. Those who write PTX directly bypass the usual programming tools and can push the hardware to its absolute limits.
Graphics cards are specialized chips that carry out huge numbers of simple computing steps simultaneously. For a program to run on such a chip, it must be translated into instructions the chip understands. On Nvidia cards, this translation happens in two steps. First, PTX is generated, a kind of intermediate language: already very close to the machine, but not yet tied to a specific card model. Only afterward is PTX converted into the actual bits that the respective chip executes. The abbreviation stands for Parallel Thread Execution, i.e., roughly “parallel execution of many threads of computation.”
Why Nvidia built in an intermediate stage
Nvidia releases new chip generations every few years. Their actual instruction sets keep changing and are not publicly documented. A program written directly for a 2018 chip would no longer run on a 2024 chip. PTX solves this problem: it remains largely stable across generations.
The comparison to translation fits well. Instead of translating every book directly from the original into every target language, one translates once into a well-defined intermediate language. From there, it’s a quick step into any final language. At Nvidia, the last step is handled by a translator within the graphics driver, and only at the moment the program starts. This is why PTX code, once shipped, also works on cards that didn’t even exist yet at compile time.
For Nvidia, this is also an economic advantage. PTX belongs to the company’s own software platform, CUDA, and runs only on Nvidia hardware. Anyone who builds their software deeply on PTX cannot easily switch to a different chip manufacturer. This lock-in is considered one of the reasons why Nvidia dominates the AI chip market so decisively.
From C code to the finished machine instruction
Normally, developers write their code in CUDA C++, an extended version of the C++ programming language. The Nvidia compiler translates this text into PTX. PTX looks like a very simple instruction list: load a value, multiply it, store the result. Unlike real machine instructions, however, PTX may use an arbitrary number of intermediate registers. The allocation of the actually available memory locations is only handled by the second translation step.
This second step produces SASS, the real instruction set of the respective chip. This is exactly where a common misunderstanding lies: PTX is not the last thing the chip sees. Between PTX and the hardware sits yet another translator, which makes its own decisions and reorders the code.
Advanced developers sometimes write PTX by hand and embed it directly into their C++ code. The reason is control. Some capabilities of new chips are not yet accessible through the normal programming language, but are already accessible via PTX. This is laborious, error-prone, and only worthwhile for portions of code that are executed millions of times.
PTX in the headlines around DeepSeek
In everyday life, no one encounters PTX visibly. It sits unnoticed in drivers, in libraries like PyTorch, and in every piece of software that uses graphics cards for computation. The term became known to a wider audience in early 2025. At that time, the Chinese AI company DeepSeek reported that it had written parts of the code directly in PTX to train its model.
The background: due to US export restrictions, DeepSeek only had access to weakened Nvidia chips. To compensate for their disadvantages, the team optimized, among other things, data transfer between the chips at the PTX level. The news caused a stir on the stock market because it suggested that with enough manual effort, a great deal could still be squeezed out of weaker hardware.
Anyone reading tech news therefore usually encounters PTX in one of two contexts. Either it concerns extreme optimization, as in the DeepSeek case. Or it concerns the question of how difficult it is for competitors like AMD to catch up. Because porting software to a different chip also means reinventing every hand-written line of PTX.