Source: NVIDIA PTX ISA 9.4 documentation.
This document describes PTX, a low-level parallel thread execution virtual machine and instruction set architecture (ISA). PTX exposes the GPU as a data-parallel computing device.
1.1. Scalable Data-Parallel Computing using GPUs#
Driven by the insatiable market demand for real-time, high-definition 3D graphics, the programmable GPU has evolved into a highly parallel, multithreaded, many-core processor with tremendous computational horsepower and very high memory bandwidth. The GPU is especially well-suited to address problems that can be expressed as data-parallel computations - the same program is executed on many data elements in parallel - with high arithmetic intensity - the ratio of arithmetic operations to memory operations. Because the same program is executed for each data element, there is a lower requirement for sophisticated flow control; and because it is executed on many data elements and has high arithmetic intensity, the memory access latency can be hidden with calculations instead of big data caches.
Data-parallel processing maps data elements to parallel processing threads. Many applications that process large data sets can use a data-parallel programming model to speed up the computations. In 3D rendering large sets of pixels and vertices are mapped to parallel threads. Similarly, image and media processing applications such as post-processing of rendered images, video encoding and decoding, image scaling, stereo vision, and pattern recognition can map image blocks and pixels to parallel processing threads. In fact, many algorithms outside the field of image rendering and processing are accelerated by data-parallel processing, from general signal processing or physics simulation to computational finance or computational biology.
PTX defines a virtual machine and ISA for general purpose parallel thread execution. PTX programs are translated at install time to the target hardware instruction set. The PTX-to-GPU translator and driver enable NVIDIA GPUs to be used as programmable parallel computers.
1.2. Goals of PTX#
PTX provides a stable programming model and instruction set for general purpose parallel programming. It is designed to be efficient on NVIDIA GPUs supporting the computation features defined by the NVIDIA Tesla architecture. High level language compilers for languages such as CUDA and C/C++ generate PTX instructions, which are optimized for and translated to native target-architecture instructions.
The goals for PTX include the following:
Provide a stable ISA that spans multiple GPU generations.
Achieve performance in compiled applications comparable to native GPU performance.
Provide a machine-independent ISA for C/C++ and other compilers to target.
Provide a code distribution ISA for application and middleware developers.
Provide a common source-level ISA for optimizing code generators and translators, which map PTX to specific target machines.
Facilitate hand-coding of libraries, performance kernels, and architecture tests.
Provide a scalable programming model that spans GPU sizes from a single unit to many parallel units.
1.3. PTX ISA Version 9.4#
PTX ISA version 9.4 introduces the following new features:
Adds support for
sm_107target architecture.Adds support for target
sm_107fthat supports family-specific features.Adds support for target
sm_107athat supports architecture-specific features.Adds support for instruction types
.u8x4,.s8x4,.u16x2,.s16x2forsetinstruction.Adds support for
.pzoqualifier forcvtinstruction.Adds support for
.rzrounding mode forcvtinstruction with.e4m3x2,.e5m2x2,.e2m3x2,.e3m2x2,.e2m1x2destination types.Adds support for
.multicast::cluster::32bqualifier formbarrier.expect_tx,mbarrier.complete_tx,mbarrier.arrive,mbarrier.arrive_drop,cp.async.bulk,cp.async.bulk.tensorandtcgen05.commitinstructions.Adds support for
.sync_restrict::shared::read::mma::aqualifier fortcgen05.commitinstruction.Adds support for
.level::eviction_priorityqualifier forcp.async.bulk.prefetchandcp.async.bulk.prefetch.tensorinstructions.Adds support for
applypriority.async.bulkandapplypriority.async.bulk.tensorinstructions.Adds support for
.override::global_addressand.override_attributequalifiers forcp.async.bulk.tensor,cp.reduce.async.bulk.tensor,cp.async.bulk.prefetch.tensorinstructions.Adds support for
.im2col_no_offs::wqualifier forcp.async.bulk.tensorandcp.reduce.async.bulk.tensorinstructions.Adds support for
.spcompressqualifier fortcgen05.ldandtcgen05.ld.redinstructions.Adds support for
spcompressandspdecompressinstructions.Adds support for
.ue5m3x2instruction type forcvtinstruction.Adds support for
.scaled::n1::ue8m0qualifier forcvtinstruction.Adds
UE5M3as scale type fortcgen05.mmaandtcgen05.mma.spinstructions.Adds support for
.kind::ti16qualifier fortcgen05.mma,tcgen05.mma.sp,tcgen05.mma.ws,tcgen05.mma.ws.spinstructions.Adds support for
add,sub,mulandfmainstructions with.f16x2/.bf16x2/.f32x2types.Adds support for
add,sub,mulandfmainstructions with FP8/FP6/FP4 x4 packed types.Adds support for
.exclusivequalifier fortcgen05.allocandtcgen05.deallocinstructions.Adds support for
.phase_type::*qualifier formbarrier.test_waitandmbarrier.try_waitinstructions.Adds support for
reportPredicateandreportValueoperands formbarrier.test_waitandmbarrier.try_waitinstructions.Adds support for
.layoutqualifier for mbarrier instructions and support formbarrier.check_layoutinstruction.Adds support for
.report_mechanismqualifier forcp.async.bulkandcp.async.bulk.tensorinstructions.Adds support for
.decompress::lut::bqualifier fortcgen05.mmainstruction.Adds support for
.collector::b::*qualifier fortcgen05.mmainstruction.Adds support for
.loc_intermediatedirective and.nv_intermediate_source_sectionconstruct for intermediate IR source location mapping.Adds support for
.valid_addrand.L1::32Bqualifiers forprefetchinstruction.Adds support for
.noftzqualifier with.f32type foratom,red,cp.reduce.async.bulk, andmultimem.cp.reduce.async.bulkinstructions.Adds support for
.proxy::readonlyqualifier forldinstruction.Adds support for
.minperctamemorydirective and%perctamemoryoffset,%perctamemorysizespecial registers for per-CTA global memory.Adds support for
.s8.s4types forldmatrixinstruction for.m8n16shape.Adds support for
.sync_restrict::shared::cluster::readqualifier forfence.proxy.async::genericinstruction.Adds support for
.acquireand.releasequalifiers with.aliasqualifier forfence.proxyinstruction.Adds support for
fabric.try_get.async.tensor,fabric.try_put.async.tensor, andfabric.try_red.async.tensorinstructions.Adds support for
fabric.try_atominstruction.Adds support for
createpolicy.range.fabricinstruction.Adds support for
.level::cache_hintqualifier forfabric.try_get,fabric.try_put, andfabric.try_redinstructions.
1.4. Document Structure#
The information in this document is organized into the following Chapters:
Programming Model outlines the programming model.
PTX Machine Model gives an overview of the PTX virtual machine model.
Syntax describes the basic syntax of the PTX language.
State Spaces, Types, and Variables describes state spaces, types, and variable declarations.
Instruction Operands describes instruction operands.
Abstracting the ABI describes the function and call syntax, calling convention, and PTX support for abstracting the Application Binary Interface (ABI).
Instruction Set describes the instruction set.
Special Registers lists special registers.
Directives lists the assembly directives supported in PTX.
Release Notes provides release notes for PTX ISA versions 2.x and beyond.
References
-
754-2008 IEEE Standard for Floating-Point Arithmetic. ISBN 978-0-7381-5752-8, 2008.
-
The OpenCL Specification, Version: 1.1, Document Revision: 44, June 1, 2011.
-
CUDA Programming Guide.
https://docs.nvidia.com/cuda/cuda-programming-guide/index.html
-
CUDA Dynamic Parallelism Programming Guide.
https://docs.nvidia.com/cuda/cuda-programming-guide/04-special-topics/dynamic-parallelism.html
-
CUDA Atomicity Requirements.
https://nvidia.github.io/cccl/libcudacxx/extended_api/memory_model.html#atomicity
-
PTX Writers Guide to Interoperability.
https://docs.nvidia.com/cuda/ptx-writers-guide-to-interoperability/index.html