Parallel Thread Execution
≈ 3 min read
Names in other languages
- EnglishParallel Thread Execution
- 日本語Parallel Thread Execution
- PolskiParallel Thread Execution
- РусскийParallel Thread Execution
- 中文Nvidia并行指令集
- 한국어병렬 스레드 실행
- DeutschNVPTX
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
Parallel Thread Execution (PTX or NVPTX ) is a low-level parallel thread execution virtual machine and instruction set architecture used in Nvidia's Compute Unified Device Architecture (CUDA) programming environment. The LLVM-based Nvidia CUDA Compiler (NVCC) translates code written in OpenCL C and CUDA C/C++ into PTX instructions (an IL), and the graphics driver contains a compiler which translates PTX instructions into executable binary code, which can run on the processing cores of Nvidia graphics processing units (GPUs). Inline PTX assembly can be used in CUDA and OpenCL. LLVM with clang also has the ability to generate PTX given CUDA, OpenCL C/C++, SYCL C++ or OpenACC or OpenMP directives. The GNU Compiler Collection also generates PTX to offload given OpenACC or OpenMP directives.
Parallel Thread Execution (PTX or NVPTX ) is a low-level parallel thread execution virtual machine and instruction set architecture used in Nvidia's Compute Unified Device Architecture (CUDA) programming environment. The LLVM-based Nvidia CUDA Compiler (NVCC) translates code written in OpenCL C and CUDA C/C++ into PTX instructions (an IL), and the graphics driver contains a compiler which translates PTX instructions into executable binary code, which can run on the processing cores of Nvidia graphics processing units (GPUs). Inline PTX assembly can be used in CUDA and OpenCL. LLVM with clang also has the ability to generate PTX given CUDA, OpenCL C/C++, SYCL C++ or OpenACC or OpenMP directives. The GNU Compiler Collection also generates PTX to offload given OpenACC or OpenMP directives. .reg .u32 %r ; // declare 335 registers %r0, %r1, ..., %r334 of type unsigned 32-bit integer It is a three-argument assembly language, and almost all instructions explicitly list the data type (in sign and width) on which they operate. Register names are preceded with a % character and constants are literal, e.g.: shr.u64 %rd14, %rd12, 32; // shift right an unsigned 64-bit integer from %rd12 by 32 positions, result in %rd14 cvt.u64.u32 %rd142, %r112; // convert an unsigned 32-bit integer to 64-bit There are predicate registers, but compiled code in shader model 1.0 uses these only in conjunction with branch commands; the conditional branch is @%p14 bra $label; // branch to $label The setp.cc.type instruction sets a predicate register to the result of comparing two registers of appropriate type, there is also a set instruction, where set.le.u32.u64 %r101, %rd12, %rd28 sets the 32-bit register %r101 to 0xffffffff if the 64-bit register %rd12 is less than or equal to the 64-bit register %rd28 . Otherwise %r101 is set to 0x00000000 . There are a few predefined identifiers that denote pseudoregisters. Among others, %tid, %ntid, %ctaid , and %nctaid contain, respectively, thread indices, block dimensions, block indices, and grid dimensions. .shared .align 8 .b8 pbatch_cache[15744]; // define 15,744 bytes, aligned to an 8-byte boundary Writing kernels in PTX requires explicitly registering PTX modules via the CUDA Driver API, typically more cumbersome than using the CUDA Runtime API and Nvidia's CUDA compiler, nvcc. The GPU Ocelot project provided an API to register PTX modules alongside CUDA Runtime API kernel invocations, though the GPU Ocelot is no longer actively maintained. ==See also== Standard Portable Intermediate Representation (SPIR) CUDA binary (cubin) – a type of fat binary
Text derived from https://en.wikipedia.org/w/index.php?oldid=1317305867 under CC BY-SA 4.0; modifications have been made.