6

CUDA compilers have options for producing 32-bit or 64-bit PTX. What is the difference between these? Is it like for x86, NVidia GPUs actually have 32-bit and 64-bit ISAs? Or is it related to host code only?

zlatanski
  • 815
  • 1
  • 8
  • 13

1 Answers1

7

Pointers are certainly the most obvious difference. 64 bit machine model enables 64-bit pointers. 64 bit pointers enable a variety of things, such as address spaces larger than 4GB, and unified virtual addressing. Unified virtual addressing in turn enables other things, such as GPUDirect Peer-to-Peer. The CUDA IPC API also depends on 64 bit machine model.

The x64 ISA is not completely different than the x86 ISA, it's mostly an extension of it. Those familiar with the x86 ISA will find the x64 ISA familiar, with natural extensions for 64-bits where needed. Likewise 64 bit machine model is an extension of the capabilities of the PTX ISA to 64-bits. Most PTX instructions work exactly the same way.

32 bit machine model can handle 64 bit data types (such as double and long long), so frequently there don't need to be any changes to properly written CUDA C/C++ source code to compile for 32 bit machine model or 64 bit machine model. If you program directly in PTX, you may have to account for the pointer size differences, at least.

Community
  • 1
  • 1
Robert Crovella
  • 143,785
  • 11
  • 213
  • 257
  • So are new devices (say Kepler class) all 64-bit? or is there a mix? Given a 64-bit device, why would I want to use it in 32-bit mode? In x86 vs. x64 there's the issue of pointer sizes and hence more memory occupied for some processes. Is this the same issue for Cuda? Or should I just always use 64-bit and forget about it? – zlatanski Dec 17 '13 at 04:38
  • All newer devices support either 32 bit or 64 bit machine model. Some older devices support only 32 bit model. In many respects, 64-bit mode is better, for the reasons I gave in my answer. The only reason I can think of using 32 bit mode is that some codes may run slower in 64 bit mode, e.g. due to 64 bit pointer arithmetic. Personally I would always just use 64-bit mode and forget about 32 bit mode. 32 bit support is already not available [for some OS's](http://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#linux-5-5). And yes, 64-bit code may compile to a larger size. – Robert Crovella Dec 17 '13 at 04:51
  • Thank you - exactly the answer I was hoping for. – zlatanski Dec 17 '13 at 05:01