fix(gpu): keep the PTX target unknown when braces are unbalanced (#12888)

readPtxTarget clamped an unmatched `}` to depth zero and never checked for
a body still open at end of text, so standalone PTX that kernel inspection
rejects as "Unbalanced PTX body" or "Truncated PTX entry declaration" still
reported complete discovery and an established target. Treat both cases as
malformed text at the target reader so inventory and kernel inspection
agree.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Syed Musa Raza NaqviandClaude Opus 5.5 authored and GitHub committed 2026-11-26 13:34:54 -05:00
1 parent 3624a9c1ab
commit 313e89206d
3 files changed
+51 -2

No files matched your search

+3 -1
View File
@@ -194,7 +194,9 @@ whitespace, after which `.version` must be the first module token. Inventory and
kernel inspection use strict UTF-8 and reuse a complete, valid scan. Invalid
encoding can leave a recognizable PTX object with an unknown target. A file
longer than the scan budget, including one that ends mid-character at the
budget, gives partial discovery.
budget, gives partial discovery. An unmatched `}` or a body still open at the end
of the text also leaves the target unknown, matching the unbalanced body that
kernel inspection rejects.
## Read PTX text