During development and debugging of DeepSeek Harness (DSH) for AMDGPU (ROCm) model inference pipelines, directly analyzing compiled binary files (HSACO or ELF) usually requires familiarity with low-level assembly syntax. To address this issue, developers need a tool that can convert binary files into structured data.
Below is an introduction to dsh-plugin-amdgpu-inspect, a DeepSeek Harness plugin maintained by yujiaoliang that aims to provide structured AMDGPU code-object and ISA inspection capabilities.
Plugin Overview¶
This plugin converts existing AMDGPU ELF or HSACO files into JSON format for agent queries. It primarily processes compiled artifacts and reports metadata and instruction streams generated by the compiler, without involving code execution or performance prediction.
Core Features¶
The plugin mainly provides the following capabilities:
- Binary Conversion: Convert ELF or HSACO files into JSON.
- Kernel Listing and Metadata: List kernels and report shared code-object metadata along with instruction category counts.
- Instruction Stream Queries: Query the normalized instruction stream of a kernel, with support for fetching instruction fragments via cursor pagination.
- Kernel X-Ray Skill: Provide a skill layer for compilation and hypothesis formation.
Installation and Enablement¶
Using this plugin requires the following environment:
* Linux operating system
* DeepSeek Harness developer preview
* ROCm LLVM tools (must be located in /opt/rocm/llvm/bin or included in the PATH environment variable)
The installation command is as follows:
dsh plugin --profile web add github:yujiaoliang/dsh-plugin-amdgpu-inspect
dsh --profile web
Typical Usage¶
1. List Kernels¶
Retrieve all kernels in the file along with their metadata:
{ "path": "/tmp/vector-add.hsaco" }
2. Query Instruction Stream¶
Query the normalized instruction stream of a specific kernel, with support for limiting the number of instructions and filtering opcodes:
{
"path": "/tmp/vector-add.hsaco",
"kernel": "vector_add",
"opcodes": ["scratch_*", "s_waitcnt"],
"cursor": 0,
"limit": 40
}
The query results include addresses, opcodes, operands, categories, and a nextCursor returned when more matches are available.
Application Scenarios and Notes¶
- Application Scenarios: Suitable for scenarios in a DSH environment where analyzing AMDGPU compilation output, debugging assembly logic, or performing static code review is required.
- Security Boundaries: This version directly invokes LLVM on the DSH host and reads artifacts. It does not inherit the deployed virtual file system or subprocess provider, and should therefore be treated as host-based access. The plugin does not load artifacts into the HSA runtime or execute GPU code.
- Known Limitations:
- Input file size is limited to 256 MiB.
- It only reports static facts; it does not execute GPU code or predict performance.
- It does not support parsing past or future LLVM output spellings.
- The current version does not support parsing kernel arguments, symbols, relocations, control-flow graphs, or binary encodings.
Summary¶
dsh-plugin-amdgpu-inspect is a tool in the DeepSeek Harness ecosystem for analyzing AMDGPU binary files. It transforms complex ELF/HSACO structures into JSON through a standardized interface, helping developers obtain static facts without executing code.
For more details and source code, please visit:
* GitHub Repository
* Community Directory