[PR #5813] [MERGED] feat(gpu): inspect static CUDA and HIP code objects #7079

Closed
opened 2026-11-01 21:45:13 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5813
Author: @gensokyo-dev
Created: 10/21/2026
Status: ✅ Merged
Merged: 10/21/2026
Merged by: @gensokyo-dev

Base: main ← Head: feat/5345-gpu-code-objects


📝 Commits (10+)

  • ce2fb86 feat(gpu): inspect static CUDA and HIP code objects
  • 828cdaa fix(gpu): bound metadata expansion and preserve partial observations
  • 8f9f70c fix(gpu): validate retained text and complete codec input
  • cbd455d fix(gpu): register catalog metadata and package notices
  • 282e109 docs(gpu): record producer verification and MCP task costs
  • 9bf50ef fix(gpu): discover standalone AMD targets before selection
  • 64bc001 docs(gpu): retain review reproductions and AMD selection evidence
  • 5e2992d fix(gpu): bound metadata work and preserve partial coverage
  • a4292d5 fix(gpu): preserve register declaration semantics and document bounds
  • 3e2677f docs(gpu): retain bounded parser and independent PTX verification

📊 Changes

81 files changed (+8598 additions, -251 deletions)

View changed files

📝 .agents/skills/reverse-engineer-anything/SKILL.md (+2 -0)
📝 README.md (+1 -0)
➕ docs/gpu-code-objects.md (+166 -0)
📝 docs/readme/README_ar.md (+1 -0)
📝 docs/readme/README_de.md (+1 -0)
📝 docs/readme/README_el.md (+1 -0)
📝 docs/readme/README_es.md (+1 -0)
📝 docs/readme/README_fa.md (+1 -0)
📝 docs/readme/README_fr.md (+1 -0)
📝 docs/readme/README_id.md (+1 -0)
📝 docs/readme/README_it.md (+1 -0)
📝 docs/readme/README_ja.md (+1 -0)
📝 docs/readme/README_ko.md (+1 -0)
📝 docs/readme/README_ml.md (+1 -0)
📝 docs/readme/README_pl.md (+1 -0)
📝 docs/readme/README_pt-BR.md (+1 -0)
📝 docs/readme/README_ru.md (+1 -0)
📝 docs/readme/README_th.md (+1 -0)
📝 docs/readme/README_tr.md (+1 -0)
📝 docs/readme/README_uk.md (+1 -0)

...and 61 more files

📄 Description

Summary

Fixes #5345. Inventory local CUDA/HIP targets, decode selected objects, and query kernel parameters/resources or retained PTX without sending the whole report to an agent.

Change and contract boundaries

  • Shared static readers/application service serve inspect-gpu-code-objects, inspect_gpu_code_objects and historical inspect_analysis_view kind gpu-code-objects.
  • ELF/PE hosts, CUDA fatbins/CUBIN/PTX and Clang HIP/CCOB bundles; CUDA raw LZ4/Zstd and CCOB zlib/Zstd. Parameter layouts, CUBIN physical registers, PTX virtual declarations and AMDGPU resources keep distinct meanings.
  • Exact target/object selection, field selection, batch IDs, paging and target aggregates. Positional IDs require the inventory SHA-256. Compact pages preserve identity, source coordinates and partial/unknown coverage; complete Evidence and PTX remain exportable after source removal.
  • One parsed owner for shared native directories and format facts. AMD target discovery reuses bounded parsed notes; tagged failures retain earlier facts. CUDA indexes coalesce scoped aliases/equal facts and share preallocation/work/read budgets. Historical indexes follow immutable Evidence lifetime; live files are freshly hashed and checked.
  • One active inspection; 128 MiB/input or output buffer, 512 MiB of payload input/decoded output/AMD note work, 16 MiB retained facts. Work is reserved before payload reads or allocation. CUDA metadata also bounds aggregate visits, reads and accounted index facts; the guide distinguishes serialized accounting from actual heap size.
  • Adds locked @msgpack/msgpack 3.1.3 with integrity-verified upstream license. Updates catalog ownership, authored skill and README links; generated outputs are excluded.

Contribution scope decision: not applicable to execution/injection/mutation/protection recovery. This capability reads caller-selected files and invokes no GPU tools or target code. Caller-directed Evidence exports use the existing local export workflow. No GPU execution, SASS disassembly or host launch correlation is claimed.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change target memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.

Evidence and validation

Verification record and linked receipts pin source trees, publisher hashes, commands, independent oracles, failed attempts and performance scope.

  • 251/251 post-header GPU/native cases passed across nine files, including shared Go/Rust/IL2CPP consumers, public CLI/MCP, lifecycle and provenance forgery. The final unknown-target summary/public-boundary run passed 46/46, and the current-base SDK-converted canonical schema suite passed 15/15.
  • npm run check and npm run docs:check passed, including five README cases. Latest static checks: 135.345 s / 266.563 CPU s / 5,371,879,424 sampled family RSS bytes; no resource guard stop.
  • Latest review qualification: 67/67 focused parser/boundary/lifecycle/public CLI/MCP cases, plus 3/3 source admission cases. NVIDIA ptxas accepts the pointer-parameter control; unknown PTX parameter/shared layouts now carry typed partial coverage from their parser. A sparse 128 MiB HIP payload with 12 aliases causes exactly 4 payload reads, then 8 capacity refusals without payload reads; compressed CUDA/CCOB controls refuse oversized output before reading input.
  • NVIDIA nvcc/cuobjdump and Clang/LLVM oracles cover nine real producer artifacts. Released Linux/Windows nvJPEG preserve 165 CUBIN hashes, 10 PTX byte identities and 3,720 native resource tuples; all 248 PTX register totals are independently checked, correcting 20 prior undercounts.
  • The latest released-DLL CLI comparison preserves all object/kernel factual fields and PTX bytes. Eight PTX objects/59 kernels now correctly disclose existing unknown pointer-parameter layouts as partial with explicit limitations; earlier complete-coverage claims for those objects are superseded. Nine real producer artifacts remain complete.
  • All 165 Windows CUBIN inner targets and raw headers match independent extraction: 110 OS ABI 0x33, 55 0x41, zero false conflicts. Unknown layouts retain their headers and partial coverage. Original envelope and payload targets stay separate; base-only agreement does not establish feature-profile compatibility.
  • Revised MCP tasks preserve the selected Linux sm_100 answer. Real public CLI controls also prove inventory-to-target selection through both HIP separator forms and an opaque-ID wrapper around the same real Clang ELF.

Windows artifacts were inspected on Linux: LLVM supplied PE coordinates and cuobjdump consumed the extracted fatbin. No Windows runtime claim. CCOB v2 Zstd has a real LLVM producer oracle; v1/v3/zlib have boundary fixtures. Legacy AMDGPU YAML remains unsupported.

Equivalent complete-report → selected-page MCP tasks: used declarations + primary calls 418,967 → 26,653 estimated tokens; full catalog + all six calls 1,493,041 → 1,100,727. Elapsed 21.307 → 24.604 s, CPU 23.538 → 26.454 s, sampled family RSS 1.147 → 1.341 GB. Tokenx estimates are not billing; initialization/JSON-RPC envelopes are excluded. Same-code workflow variants, fresh servers, uncontrolled OS caches/load: no general speed/CPU/memory improvement is claimed. All task receipts use two CPU affinities and an 8 GiB family guard.

Earlier main-baseline browser/optional-input assertion failures are linked in PR comments; upstream main has since fixed them. All required CI passed at predecessor 9767391; this review follow-up reruns CI. The GPU help-description CI bug and actionable review findings were fixed. The intermediate low-byte CUDA-header interpretation and its timings are explicitly invalidated in the record; qualified measurements use the corrected ABI-aware version. Earlier schema timeouts and the incomplete all-target transport-guard attempt remain recorded rather than counted as successful coverage.

  • Observed, derived and inferred claims remain distinguishable.
  • Artifact identity, provenance and failed attempts remain preserved.
  • Unsupported, incomplete and uncertain outcomes remain visible.

Author readiness

Human owner: @gensokyo-dev

The operator explicitly instructed ready review and authorized merge after verification. Automation does not assert the two unchecked personal-review declarations.

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • Concrete enhancement linked above; static contribution scope resolved.
  • One focused outcome and Conventional Commit title; additive API, no migration.
  • Changed behavior/failure paths tested; relevant docs/contracts/catalog ownership updated.
  • Representative CLI/MCP output and real-provider limitations recorded.
  • Final diff checked for secrets, unrelated cleanup and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/5813 **Author:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/21/2026 **Merged by:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Base:** `main` ← **Head:** `feat/5345-gpu-code-objects` --- ### 📝 Commits (10+) - [`ce2fb86`](https://github.com/morluto/rea/commit/ce2fb86f9cf2d8da8055b9a10b74592be905f48b) feat(gpu): inspect static CUDA and HIP code objects - [`828cdaa`](https://github.com/morluto/rea/commit/828cdaaf4d9f339e125f58be362cc38d1d6a99f5) fix(gpu): bound metadata expansion and preserve partial observations - [`8f9f70c`](https://github.com/morluto/rea/commit/8f9f70c3f213673450dfed07698e212ac97ff967) fix(gpu): validate retained text and complete codec input - [`cbd455d`](https://github.com/morluto/rea/commit/cbd455d1d1d149dd2533b54f9959b9f18dac004a) fix(gpu): register catalog metadata and package notices - [`282e109`](https://github.com/morluto/rea/commit/282e109a6c67d5ad60bd2a82064d8a097ccb6e16) docs(gpu): record producer verification and MCP task costs - [`9bf50ef`](https://github.com/morluto/rea/commit/9bf50efa87fd14e975b07c07aa27a327450df0d5) fix(gpu): discover standalone AMD targets before selection - [`64bc001`](https://github.com/morluto/rea/commit/64bc0018714a840bf7777731e5e4c01888d40f06) docs(gpu): retain review reproductions and AMD selection evidence - [`5e2992d`](https://github.com/morluto/rea/commit/5e2992d85656e72e848e8858dbb95c60620084d1) fix(gpu): bound metadata work and preserve partial coverage - [`a4292d5`](https://github.com/morluto/rea/commit/a4292d5169cc312abc6b52ffc63c3ec3f66ebc84) fix(gpu): preserve register declaration semantics and document bounds - [`3e2677f`](https://github.com/morluto/rea/commit/3e2677fafb59281e1e0baab82b584c4d8b9a007b) docs(gpu): retain bounded parser and independent PTX verification ### 📊 Changes **81 files changed** (+8598 additions, -251 deletions) <details> <summary>View changed files</summary> 📝 `.agents/skills/reverse-engineer-anything/SKILL.md` (+2 -0) 📝 `README.md` (+1 -0) ➕ `docs/gpu-code-objects.md` (+166 -0) 📝 `docs/readme/README_ar.md` (+1 -0) 📝 `docs/readme/README_de.md` (+1 -0) 📝 `docs/readme/README_el.md` (+1 -0) 📝 `docs/readme/README_es.md` (+1 -0) 📝 `docs/readme/README_fa.md` (+1 -0) 📝 `docs/readme/README_fr.md` (+1 -0) 📝 `docs/readme/README_id.md` (+1 -0) 📝 `docs/readme/README_it.md` (+1 -0) 📝 `docs/readme/README_ja.md` (+1 -0) 📝 `docs/readme/README_ko.md` (+1 -0) 📝 `docs/readme/README_ml.md` (+1 -0) 📝 `docs/readme/README_pl.md` (+1 -0) 📝 `docs/readme/README_pt-BR.md` (+1 -0) 📝 `docs/readme/README_ru.md` (+1 -0) 📝 `docs/readme/README_th.md` (+1 -0) 📝 `docs/readme/README_tr.md` (+1 -0) 📝 `docs/readme/README_uk.md` (+1 -0) _...and 61 more files_ </details> ### 📄 Description ## Summary Fixes #5345. Inventory local CUDA/HIP targets, decode selected objects, and query kernel parameters/resources or retained PTX without sending the whole report to an agent. ## Change and contract boundaries - Shared static readers/application service serve `inspect-gpu-code-objects`, `inspect_gpu_code_objects` and historical `inspect_analysis_view` kind `gpu-code-objects`. - ELF/PE hosts, CUDA fatbins/CUBIN/PTX and Clang HIP/CCOB bundles; CUDA raw LZ4/Zstd and CCOB zlib/Zstd. Parameter layouts, CUBIN physical registers, PTX virtual declarations and AMDGPU resources keep distinct meanings. - Exact target/object selection, field selection, batch IDs, paging and target aggregates. Positional IDs require the inventory SHA-256. Compact pages preserve identity, source coordinates and partial/unknown coverage; complete Evidence and PTX remain exportable after source removal. - One parsed owner for shared native directories and format facts. AMD target discovery reuses bounded parsed notes; tagged failures retain earlier facts. CUDA indexes coalesce scoped aliases/equal facts and share preallocation/work/read budgets. Historical indexes follow immutable Evidence lifetime; live files are freshly hashed and checked. - One active inspection; 128 MiB/input or output buffer, 512 MiB of payload input/decoded output/AMD note work, 16 MiB retained facts. Work is reserved before payload reads or allocation. CUDA metadata also bounds aggregate visits, reads and accounted index facts; the guide distinguishes serialized accounting from actual heap size. - Adds locked `@msgpack/msgpack` 3.1.3 with integrity-verified upstream license. Updates catalog ownership, authored skill and README links; generated outputs are excluded. Contribution scope decision: not applicable to execution/injection/mutation/protection recovery. This capability reads caller-selected files and invokes no GPU tools or target code. Caller-directed Evidence exports use the existing local export workflow. No GPU execution, SASS disassembly or host launch correlation is claimed. Expected effects: - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change target memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. ## Evidence and validation [Verification record and linked receipts](https://github.com/morluto/rea/blob/4f537f9e44a8b4344bece096b455b7121d30253b/docs/verification/gpu-code-objects-2026-10-21.md) pin source trees, publisher hashes, commands, independent oracles, failed attempts and performance scope. - **251/251 post-header GPU/native cases** passed across nine files, including shared Go/Rust/IL2CPP consumers, public CLI/MCP, lifecycle and provenance forgery. The final unknown-target summary/public-boundary run passed **46/46**, and the current-base SDK-converted canonical schema suite passed **15/15**. - `npm run check` and `npm run docs:check` passed, including five README cases. Latest static checks: **135.345 s / 266.563 CPU s / 5,371,879,424 sampled family RSS bytes**; no resource guard stop. - Latest review qualification: **67/67 focused** parser/boundary/lifecycle/public CLI/MCP cases, plus **3/3 source admission** cases. NVIDIA ptxas accepts the pointer-parameter control; unknown PTX parameter/shared layouts now carry typed partial coverage from their parser. A sparse 128 MiB HIP payload with 12 aliases causes exactly 4 payload reads, then 8 capacity refusals without payload reads; compressed CUDA/CCOB controls refuse oversized output before reading input. - NVIDIA nvcc/cuobjdump and Clang/LLVM oracles cover nine real producer artifacts. Released Linux/Windows nvJPEG preserve 165 CUBIN hashes, 10 PTX byte identities and 3,720 native resource tuples; all 248 PTX register totals are independently checked, correcting 20 prior undercounts. - The latest released-DLL CLI comparison preserves all object/kernel factual fields and PTX bytes. Eight PTX objects/59 kernels now correctly disclose existing unknown pointer-parameter layouts as partial with explicit limitations; earlier complete-coverage claims for those objects are superseded. Nine real producer artifacts remain complete. - All 165 Windows CUBIN inner targets and raw headers match independent extraction: 110 OS ABI `0x33`, 55 `0x41`, zero false conflicts. Unknown layouts retain their headers and partial coverage. Original envelope and payload targets stay separate; base-only agreement does not establish feature-profile compatibility. - Revised MCP tasks preserve the selected Linux sm_100 answer. Real public CLI controls also prove inventory-to-target selection through both HIP separator forms and an opaque-ID wrapper around the same real Clang ELF. Windows artifacts were inspected on Linux: LLVM supplied PE coordinates and cuobjdump consumed the extracted fatbin. No Windows runtime claim. CCOB v2 Zstd has a real LLVM producer oracle; v1/v3/zlib have boundary fixtures. Legacy AMDGPU YAML remains unsupported. Equivalent complete-report → selected-page MCP tasks: used declarations + primary calls **418,967 → 26,653** estimated tokens; full catalog + all six calls **1,493,041 → 1,100,727**. Elapsed **21.307 → 24.604 s**, CPU **23.538 → 26.454 s**, sampled family RSS **1.147 → 1.341 GB**. Tokenx estimates are not billing; initialization/JSON-RPC envelopes are excluded. Same-code workflow variants, fresh servers, uncontrolled OS caches/load: no general speed/CPU/memory improvement is claimed. All task receipts use two CPU affinities and an 8 GiB family guard. Earlier main-baseline browser/optional-input assertion failures are linked in PR comments; upstream main has since fixed them. All required CI passed at predecessor `9767391`; this review follow-up reruns CI. The GPU help-description CI bug and actionable review findings were fixed. The intermediate low-byte CUDA-header interpretation and its timings are explicitly invalidated in the record; qualified measurements use the corrected ABI-aware version. Earlier schema timeouts and the incomplete all-target transport-guard attempt remain recorded rather than counted as successful coverage. - [x] Observed, derived and inferred claims remain distinguishable. - [x] Artifact identity, provenance and failed attempts remain preserved. - [x] Unsupported, incomplete and uncertain outcomes remain visible. ## Author readiness Human owner: @gensokyo-dev The operator explicitly instructed ready review and authorized merge after verification. Automation does not assert the two unchecked personal-review declarations. - [ ] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [ ] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] Concrete enhancement linked above; static contribution scope resolved. - [x] One focused outcome and Conventional Commit title; additive API, no migration. - [x] Changed behavior/failure paths tested; relevant docs/contracts/catalog ownership updated. - [x] Representative CLI/MCP output and real-provider limitations recorded. - [x] Final diff checked for secrets, unrelated cleanup and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:45:13 +00:00
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#7079
No description provided.