Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Diagnostics & Messages

Addresses apply to ptxas v13.0.88 (CUDA 13.0). VA base 0x400000 (non-PIE).

ptxas emits 506 diagnostic messages from two .data tables. Unlike its opcode, knob, and macro data, the diagnostic strings are stored in cleartext — no string-pool cipher, ROT13, or position-XOR is involved, so they appear verbatim in a strings dump. The symbolic ptxMsg* identifiers are macro-expanded away at build time; only the numeric table index survives as the message id.

Two tables, separate id-spaces

TableBase VMACountContents
main0x29FA4D0465 (id 0–464)PTX front-end / SASS assembler diagnostics; id 0 = "Memory allocation failure", last = "Internal compiler error%s, please report"
link0x29FD59041 (id 0–40)Linker / options-file / DWARF diagnostics

The two tables are separated in .data by a ROT47-obfuscated opcode/pseudo-instruction name pool whose second field carries Adler-32 keys — the same hash scheme documented in Pseudo-Instruction Expansion. That pool is not part of the catalog; it just bounds the two diagnostic tables.

Record format

Each entry is a 16-byte record, indexed directly by id:

struct ptxas_msg {
    uint32_t    severity;     // +0  severity code (see below)
    uint32_t    _pad;         // +4  zero
    const char *format;       // +8  cleartext printf-style format string
};

Severity scheme

The emit path switches on the severity code and prepends a prefix looked up from two small .rodata aux tables — the prefix char*[] at 0x1CE3300 and a per-severity output-channel class byte at 0x1CE32F8. The printed channel tags (@E@ / @I@ / @W@) select the stderr stream and exit behavior.

CodePrefixChannel weightRecords in ptxas
0(internal)40 (special-cased)
1note00
2info013
3warning149
4error* (recoverable)10
5error2341
6fatal4103

Emission path

The emitter is sub_42F590 with formatter sibling sub_42FBA0 (the one carrying the "%s, line %d; " location prefix). Both take a pointer to a message record as the first argument and va_start the call-site varargs. Call sites pass &table[id] — e.g. the allocation-failure path calls sub_42F590(&main_table[0]). The record's severity field selects the prefix and channel from the aux tables; the format field is the printf template applied to the varargs.

Catalog grouping

  • main (465) — lexer/parser errors, .target / .version mismatches, type/operand checks, ABI / register / regcount diagnostics, pragma handling, alias/symbol resolution, and info-level advisories.
  • link (41) — options-file parser, DWARF / debug-line, and link-time resource / data-size limits.

The full id → (severity, message) table for both tables is in the repo at decoded/ptxas-messages/messages.tsv, regenerated by extract_messages.py, which auto-locates the tables in any ptxas build and reproduces the table byte-for-byte.

Cross-References