[GH-ISSUE #6493] [Bug] PTX kernel entries without an optional parameter list are marked malformed #3893

Closed
opened 2026-10-31 00:45:00 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @coygeek on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/6493

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

The open issue and PR inventories and targeted live searches across open and closed issues found no matching open bug report. The related CUDA feature issue does not describe this trigger.

Area

Native analysis or decompilation

Observed behavior

inspect-gpu-code-objects recognizes a standalone PTX file containing the valid declaration .visible .entry k { ret; }, but kernel analysis marks its object malformed, reports Malformed PTX entry name or parameters, and returns an empty kernel list. The command exits 0 with partial payload coverage. Adding the optional empty parameter list, k(), produces a complete object and kernel k in the control invocation.

Reproduction

Executed once per input during initial discovery using the reported source build. The launcher was Node executing scripts/rea.mjs; REA_CHECKOUT below denotes that checkout. Run from a disposable directory containing the fixtures.

  1. Create entry-no-params.ptx with these exact UTF-8 contents, including the final newline:
.version 7.0
.target sm_80
.address_size 64
.visible .entry k { ret; }
  1. Invoke the source CLI with these arguments:
node "$REA_CHECKOUT/scripts/rea.mjs" inspect-gpu-code-objects entry-no-params.ptx --analysis kernels --detail complete --json
  1. Observe the result excerpt below. For the executed control, create entry-empty-params.ptx with the same contents except k() replaces k, then invoke the same arguments with that filename. That control exits 0, marks the object and payload coverage complete, and returns k with zero parameters.

Expected behavior

The parameterless form should yield kernel k, parameter_count: 0, parameter_bytes: 0, and complete decoding for this otherwise supported entry, as the k() control does. NVIDIA's PTX ISA 7.0 .entry specification explicitly permits an entry name followed directly by its body; the parenthesized parameter list is optional. REA documents standalone PTX and kernel-declaration inspection.

Impact and scope

The observed effect is loss of the sole kernel declaration from this valid 71-byte standalone PTX input and an incorrect malformed-input diagnosis. One failing invocation and one passing control were executed. Changing a disposable copy to use k() is an observed workaround for declaration analysis, but changes the file bytes and digest; analysis of the original artifact still fails. Other PTX producers, embedded payloads, and multi-entry files were not tested.

REA version

6.7.0; source revision c106cf20cbfcec8e1fcd953ad8e52bdfbf8c3f9c. The built source launcher's --version printed 6.7.0.

Runtime and platform

Node.js v24.18.0; Linux x86_64. The static GPU reader was used. No CUDA assembler, GPU runtime, Hopper, or Ghidra was invoked. Home, configuration, cache, and temporary directories were isolated for the fixture probes.

Target and artifact context

Synthetic standalone UTF-8 PTX 7.0, target sm_80, 64-bit address size, one parameterless kernel. Failing fixture size: 71 bytes; SHA-256: 9af5e0e897bedd605b10b89944bc084a31b7d49b99e046172d59244f5b33a2d4.

Interface

CLI

Earliest failure stage

Native analysis or reconstruction

Relevant output or evidence

Observed fields selected from the CLI's normalized_result, with unrelated fields omitted:

{
  "format": "ptx",
  "coverage": { "discovery": "complete", "payloads": "partial" },
  "objects": [{
    "id": "file@0",
    "kind": "ptx",
    "target": "sm_80",
    "inspection": "malformed",
    "limitations": ["Malformed PTX entry name or parameters"]
  }],
  "kernels": []
}

Exit status was 0 and stderr was empty. The control returned objects[0].inspection: "complete", coverage.payloads: "complete", and kernels[0] with name: "k", parameter_count: 0, and parameter_bytes: 0.

  • Expected source: The linked NVIDIA PTX 7.0 entry grammar and REA's standalone PTX inspection documentation above.
  • Failure source: The initial CLI observations above; the entry parser also unconditionally requires ( after the name.
  • Evidence provenance: observed. The parser diagnosis is separately source-derived.
  • Local verification: reproduced.
  • Reproduction completeness: complete.

The supported CLI passes kernel analysis to the GPU service. Standalone PTX reaches the payload reader after target recognition, which iterates entry declarations. The malformed classification is retained on the object rather than thrown as a top-level CLI failure.

Typed outcome or recovery expected

Return the ordinary GPU Evidence with the parameterless kernel retained and the object's inspection complete. Proposed restoration check: the original fixture must return the same zero-parameter declaration as the existing k() control, without requiring source rewriting; both spellings must continue to work.

Analysis or suspected cause

Source-derived: the entry parser treats ( as mandatory, even though the PTX entry grammar permits its omission. The first token after k is {, so the same mandatory-parenthesis guard rejects this supported spelling before any kernel row is yielded. This failure is independent of target recognition: the observed object already has target sm_80 and complete discovery coverage.

Additional context

The fixture's validity is grounded in NVIDIA's grammar, not a CUDA compilation or execution test. NOT_ENOUGH_INFO: the last known good release and first affected release were not investigated. This report concerns optional entry parameters, not resource-declaration size limits.

Triage assessment

  • Impact level: P2
  • Assessment status: supported
  • Impact basis: A valid bounded standalone PTX input loses its kernel declaration and receives an incorrect malformed-object result; the matching empty-parentheses control succeeds.
  • Workaround status: available
  • Workaround basis: Adding () in a disposable copy produced a complete kernel result in the executed control. This supports declaration analysis when a copy is acceptable; it changes artifact identity and does not repair inspection of the original bytes.
Originally created by @coygeek on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/6493 ### Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. The open issue and PR inventories and targeted live searches across open and closed issues found no matching open bug report. The related CUDA feature issue does not describe this trigger. ### Area Native analysis or decompilation ### Observed behavior `inspect-gpu-code-objects` recognizes a standalone PTX file containing the valid declaration `.visible .entry k { ret; }`, but kernel analysis marks its object `malformed`, reports `Malformed PTX entry name or parameters`, and returns an empty kernel list. The command exits 0 with partial payload coverage. Adding the optional empty parameter list, `k()`, produces a complete object and kernel `k` in the control invocation. ### Reproduction Executed once per input during initial discovery using the reported source build. The launcher was Node executing `scripts/rea.mjs`; `REA_CHECKOUT` below denotes that checkout. Run from a disposable directory containing the fixtures. 1. Create `entry-no-params.ptx` with these exact UTF-8 contents, including the final newline: ```ptx .version 7.0 .target sm_80 .address_size 64 .visible .entry k { ret; } ``` 2. Invoke the source CLI with these arguments: ```sh node "$REA_CHECKOUT/scripts/rea.mjs" inspect-gpu-code-objects entry-no-params.ptx --analysis kernels --detail complete --json ``` 3. Observe the result excerpt below. For the executed control, create `entry-empty-params.ptx` with the same contents except `k()` replaces `k`, then invoke the same arguments with that filename. That control exits 0, marks the object and payload coverage complete, and returns `k` with zero parameters. ### Expected behavior The parameterless form should yield kernel `k`, `parameter_count: 0`, `parameter_bytes: 0`, and complete decoding for this otherwise supported entry, as the `k()` control does. NVIDIA's [PTX ISA 7.0 `.entry` specification](https://docs.nvidia.com/cuda/archive/11.0/parallel-thread-execution/index.html#kernel-and-function-directives-entry) explicitly permits an entry name followed directly by its body; the parenthesized parameter list is optional. REA documents [standalone PTX and kernel-declaration inspection](https://github.com/morluto/rea/blob/c106cf20cbfcec8e1fcd953ad8e52bdfbf8c3f9c/docs/gpu-code-objects.md#L3-L7). ### Impact and scope The observed effect is loss of the sole kernel declaration from this valid 71-byte standalone PTX input and an incorrect malformed-input diagnosis. One failing invocation and one passing control were executed. Changing a disposable copy to use `k()` is an observed workaround for declaration analysis, but changes the file bytes and digest; analysis of the original artifact still fails. Other PTX producers, embedded payloads, and multi-entry files were not tested. ### REA version 6.7.0; source revision `c106cf20cbfcec8e1fcd953ad8e52bdfbf8c3f9c`. The built source launcher's `--version` printed `6.7.0`. ### Runtime and platform Node.js v24.18.0; Linux x86_64. The static GPU reader was used. No CUDA assembler, GPU runtime, Hopper, or Ghidra was invoked. Home, configuration, cache, and temporary directories were isolated for the fixture probes. ### Target and artifact context Synthetic standalone UTF-8 PTX 7.0, target `sm_80`, 64-bit address size, one parameterless kernel. Failing fixture size: 71 bytes; SHA-256: `9af5e0e897bedd605b10b89944bc084a31b7d49b99e046172d59244f5b33a2d4`. ### Interface CLI ### Earliest failure stage Native analysis or reconstruction ### Relevant output or evidence Observed fields selected from the CLI's `normalized_result`, with unrelated fields omitted: ```json { "format": "ptx", "coverage": { "discovery": "complete", "payloads": "partial" }, "objects": [{ "id": "file@0", "kind": "ptx", "target": "sm_80", "inspection": "malformed", "limitations": ["Malformed PTX entry name or parameters"] }], "kernels": [] } ``` Exit status was 0 and stderr was empty. The control returned `objects[0].inspection: "complete"`, `coverage.payloads: "complete"`, and `kernels[0]` with `name: "k"`, `parameter_count: 0`, and `parameter_bytes: 0`. - Expected source: The linked NVIDIA PTX 7.0 entry grammar and REA's standalone PTX inspection documentation above. - Failure source: The initial CLI observations above; [the entry parser](https://github.com/morluto/rea/blob/c106cf20cbfcec8e1fcd953ad8e52bdfbf8c3f9c/src/gpu/PtxKernels.ts#L191-L194) also unconditionally requires `(` after the name. - Evidence provenance: observed. The parser diagnosis is separately source-derived. - Local verification: reproduced. - Reproduction completeness: complete. The supported CLI [passes kernel analysis to the GPU service](https://github.com/morluto/rea/blob/c106cf20cbfcec8e1fcd953ad8e52bdfbf8c3f9c/src/cli/gpuCommands.ts#L98-L117). Standalone PTX [reaches the payload reader after target recognition](https://github.com/morluto/rea/blob/c106cf20cbfcec8e1fcd953ad8e52bdfbf8c3f9c/src/gpu/GpuInventory.ts#L228-L252), which [iterates entry declarations](https://github.com/morluto/rea/blob/c106cf20cbfcec8e1fcd953ad8e52bdfbf8c3f9c/src/gpu/GpuInventory.ts#L351-L375). The malformed classification is retained on the object rather than thrown as a top-level CLI failure. ### Typed outcome or recovery expected Return the ordinary GPU Evidence with the parameterless kernel retained and the object's inspection complete. Proposed restoration check: the original fixture must return the same zero-parameter declaration as the existing `k()` control, without requiring source rewriting; both spellings must continue to work. ### Analysis or suspected cause Source-derived: the entry parser treats `(` as mandatory, even though the PTX entry grammar permits its omission. The first token after `k` is `{`, so the same mandatory-parenthesis guard rejects this supported spelling before any kernel row is yielded. This failure is independent of target recognition: the observed object already has target `sm_80` and complete discovery coverage. ### Additional context The fixture's validity is grounded in NVIDIA's grammar, not a CUDA compilation or execution test. NOT_ENOUGH_INFO: the last known good release and first affected release were not investigated. This report concerns optional entry parameters, not resource-declaration size limits. ## Triage assessment - Impact level: P2 - Assessment status: supported - Impact basis: A valid bounded standalone PTX input loses its kernel declaration and receives an incorrect malformed-object result; the matching empty-parentheses control succeeds. - Workaround status: available - Workaround basis: Adding `()` in a disposable copy produced a complete kernel result in the executed control. This supports declaration analysis when a copy is acceptable; it changes artifact identity and does not repair inspection of the original bytes.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#3893
No description provided.