среда, 4 ноября 2026 г.

ebnf & parser of PTX from sdk 13.4

Observing raw data from previous part we can conclude that many (17) new attributes were inserted in middle of indices table thereby shifting the indices. And even worse - they were inserted in many arbitrary places. So instead of patching long-suffering script iptx.pl I made its clone iptx3.pl (DRY, yeah)

After some brute-forcing & RE I was able to identify 130 attributes masks - so still unknown 8. Given that at least 6 of them describe semantics of instruction - actually only 2 indices currently unknown:
  • 13:5 for spdecompress
  • 17:0 for tensormap.replace

EBNF

5246 lines vs 4460 from old version

Intrinsics

I wrote script to compare them. No new instrinsics but 3 were removed:
  • __cuda_sm20_div_rn_ftz_f32
  • __cuda_sm20_div_rn_f32
  • __cuda_sm20_div_rn_noftz_f32_slowpath
See raw data in files ptx_intr.txt & ptx134_intr.txt

Expanded macros

Seems that all newly added PTX instructions actually implemented as macros and expanding to calls of __nv_ptx_builtin_ocg_XXX. Unfortunately I was unable to find those functions inside ptxas, and in RT kernels too. Some (like fabricXXX) described here
 
However we always can generate ptx and examine what it actually compiles into:
__HIR0X1C0.8.U2.2TO4.X4 R0, R8, R8, UR4 ;

It's funny that sample for spdecompress from official doc doesn't even compile. And for trace.marks too. I wonder — has even one of the many morons on Twitter, who keep posting this document as if it were the official nvidia assembler manual, actually tried verifying anything in it?

Parser

New data from iptx3.pl -C

Комментариев нет:

Отправить комментарий