▲ 10 r/CUDA+1 crossposts

comparison of ptx/sass code from nvcc vs clang

  • nvcc code 15–18% faster
  • nvcc code is bigger and more amenable to stall counts reducing
  • all mlir based compilers use vanilla llvm nvptx backend :-(
redplait.blogspot.com
u/c-cul — 8 days ago
▲ 9 r/CUDA+1 crossposts

cuda ptx instructions generated by clang nvptx backend

nvptx uses 58.9% of all ptx instructions

cicc 57.8%

missed in clang:

  • _ldsm
  • _mma
  • discard
  • dp2a hi/lo
  • madc hi/lo
  • p2r
  • trap
redplait.blogspot.com
u/c-cul — 13 days ago
▲ 9 r/CUDA+1 crossposts

cuda ptx asm in llvm ir

  • llvm doc lies about operand constraint codes
  • you can swap operand and this makes parsing/comparison of instructions non-trivial
  • nvidia's llvm backend cicc uses ~5-7% of instructions with undocumented attributes and they not available in NVPTX backend from clang
redplait.blogspot.com
u/c-cul — 26 days ago
▲ 1 r/LLVM

WaW & WaR hazards in llvm scheduler

Can those 2 be expressed in SchedMachineModel?

For example I must track that consequent write after read to the same register must be delayed to ensure that read operation was completed

reddit.com
u/c-cul — 2 months ago
▲ 11 r/CUDA+1 crossposts

parser of PTX instructions

  • The compiler front end does not parse the asm() statement template string and does not know what it means or even whether it is valid PTX input
  • order of instruction's attributes (except types of operand) is not important

The combination of these facts leads to stark conclusion - CUDA compiler front-ends totally ignore PTX inline asm and only PTXAS known how to parse them. So I made little and fast parser: https://redplait.blogspot.com/2026/08/parser-of-ptx-instructions.html

Note: this is not full featured replacement of PTX parser. it is designed specifically to extract instruction attributes and determine the correct instruction form based on argument types and counts

reddit.com
u/c-cul — 2 months ago
▲ 5 r/CUDA

optimization of SASS stall counts, part 2

by relaxing delays for some small set of instructions we can get speed-up 0.2-0.3% for integer-heavy kernels

redplait.blogspot.com
u/c-cul — 2 months ago
▲ 8 r/CUDA+1 crossposts

optimization of SASS stall counts

- ptxas has enough good heuristic

- in average you can reduce ~3% of stall counts

- overall speed up is not equivalent to the number of optimized stall counts

redplait.blogspot.com
u/c-cul — 3 months ago

memory ssa for numa/gpu

sorry if this is wrong sub-reddit for such questions

Are there some papers/experiments about subj to automatically derive things like indices swizzling/caching in shared memory/pinned memory etc?

reddit.com
u/c-cul — 3 months ago