# takashiidobe/rocky architecture

> Architecture diagram of the GitHub repository takashiidobe/rocky, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/takashiidobe/rocky
- Repository: https://github.com/takashiidobe/rocky

## Overview

Rocky is a Rust tool that compiles HIP source for gfx1031, extracts its GPU code object, disassembles it, lifts a supported comparison instruction, and emits verified LLVM IR to a sibling .ll file. The main path is orchestrated by src/main.rs; compilation and disassembly use external ROCm/LLVM tools. Parsing currently recognizes only v_cmp_eq_u32_e32, rather than implementing the README’s broader CFG-and-fuzz testing flow. The graph reflects sampled source; broader README workflow items are not treated as implemented subsystems.

Main entry points: [`src/main.rs`](https://github.com/takashiidobe/rocky/blob/main/src/main.rs) (Pipeline Runner), [`src/compile/mod.rs`](https://github.com/takashiidobe/rocky/blob/main/src/compile/mod.rs) (HIP Compiler), [`src/asm/mod.rs`](https://github.com/takashiidobe/rocky/blob/main/src/asm/mod.rs) (Disassembly Service), [`src/llvm/instruction.rs`](https://github.com/takashiidobe/rocky/blob/main/src/llvm/instruction.rs) (Compare Decoder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Pipeline"]
  node_main["Pipeline Runner<br/>[main.rs]"]
  node_tool_runner["Process Runner<br/>[tool.rs]"]
end

subgraph group_compile["HIP Compilation"]
  node_compile_flow["HIP Compiler<br/>[mod.rs]"]
end

subgraph group_disasm["Disassembly"]
  node_objdump["Disassembly Service<br/>[mod.rs]"]
  node_disasm_parser["Disassembly Parser<br/>[disassembly.rs]"]
  node_lexer["Assembly Lexer<br/>[lexer.rs]"]
end

subgraph group_lift["LLVM Lifting"]
  node_instruction_lifter["Compare Decoder<br/>[instruction.rs]"]
  node_registers["Register Types<br/>[register.rs]"]
  node_ir_emitter["LLVM IR Emitter<br/>[ir.rs]"]
end

node_user(("Engineer"))
node_hip_source["HIP Source"]
node_hipcc["hipcc"]
node_bundler["Offload Bundler"]
node_code_object["GPU Code Object"]
node_llvm_objdump["llvm-objdump"]
node_ir_output["LLVM IR File"]

node_user -->|"provides source"| node_main
node_main -->|"compiles source"| node_compile_flow
node_compile_flow -->|"invokes"| node_hipcc
node_compile_flow -->|"unbundles image"| node_bundler
node_compile_flow -->|"runs commands"| node_tool_runner
node_hip_source -->|"supplies input"| node_compile_flow
node_compile_flow -->|"produces"| node_code_object
node_main -->|"disassembles object"| node_objdump
node_objdump -->|"invokes"| node_llvm_objdump
node_objdump -->|"runs command"| node_tool_runner
node_objdump -->|"parses output"| node_disasm_parser
node_disasm_parser -->|"tokenizes lines"| node_lexer
node_main -->|"decodes disassembly"| node_instruction_lifter
node_instruction_lifter -->|"reads operand tokens"| node_lexer
node_instruction_lifter -->|"parses registers"| node_registers
node_main -->|"emits IR"| node_ir_emitter
node_ir_emitter -->|"consumes decoded instructions"| node_instruction_lifter
node_ir_emitter -->|"uses register indices"| node_registers
node_main -->|"writes IR"| node_ir_output

click node_main "https://github.com/takashiidobe/rocky/blob/main/src/main.rs"
click node_compile_flow "https://github.com/takashiidobe/rocky/blob/main/src/compile/mod.rs"
click node_tool_runner "https://github.com/takashiidobe/rocky/blob/main/src/tool.rs"
click node_objdump "https://github.com/takashiidobe/rocky/blob/main/src/asm/mod.rs"
click node_disasm_parser "https://github.com/takashiidobe/rocky/blob/main/src/asm/disassembly.rs"
click node_lexer "https://github.com/takashiidobe/rocky/blob/main/src/asm/lexer.rs"
click node_instruction_lifter "https://github.com/takashiidobe/rocky/blob/main/src/llvm/instruction.rs"
click node_registers "https://github.com/takashiidobe/rocky/blob/main/src/llvm/register.rs"
click node_ir_emitter "https://github.com/takashiidobe/rocky/blob/main/src/llvm/ir.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_tool_runner toneBlue
class node_compile_flow toneAmber
class node_objdump,node_disasm_parser,node_lexer toneMint
class node_instruction_lifter,node_registers,node_ir_emitter toneRose
class node_user,node_hip_source,node_hipcc,node_bundler,node_code_object,node_llvm_objdump,node_ir_output toneIndigo
```

## Components

### Pipeline

- [Pipeline Runner](https://github.com/takashiidobe/rocky/blob/main/src/main.rs): `src/main.rs`
- [Process Runner](https://github.com/takashiidobe/rocky/blob/main/src/tool.rs): `src/tool.rs`

### HIP Compilation

- [HIP Compiler](https://github.com/takashiidobe/rocky/blob/main/src/compile/mod.rs): `src/compile/mod.rs`

### Disassembly

- [Disassembly Service](https://github.com/takashiidobe/rocky/blob/main/src/asm/mod.rs): `src/asm/mod.rs`
- [Disassembly Parser](https://github.com/takashiidobe/rocky/blob/main/src/asm/disassembly.rs): `src/asm/disassembly.rs`
- [Assembly Lexer](https://github.com/takashiidobe/rocky/blob/main/src/asm/lexer.rs): `src/asm/lexer.rs`

### LLVM Lifting

- [Compare Decoder](https://github.com/takashiidobe/rocky/blob/main/src/llvm/instruction.rs): `src/llvm/instruction.rs`
- [Register Types](https://github.com/takashiidobe/rocky/blob/main/src/llvm/register.rs): `src/llvm/register.rs`
- [LLVM IR Emitter](https://github.com/takashiidobe/rocky/blob/main/src/llvm/ir.rs): `src/llvm/ir.rs`

### Other components

- **Engineer**
- **HIP Source**
- **hipcc**
- **Offload Bundler**
- **GPU Code Object**
- **llvm-objdump**
- **LLVM IR File**

## Connections

- Engineer → Pipeline Runner: provides source (evidence: `README.md`)
- Pipeline Runner → HIP Compiler: compiles source (evidence: `src/main.rs`)
- HIP Compiler → hipcc: invokes (evidence: `src/compile/mod.rs`)
- HIP Compiler → Offload Bundler: unbundles image (evidence: `src/compile/mod.rs`)
- HIP Compiler → Process Runner: runs commands (evidence: `src/compile/mod.rs`)
- HIP Source → HIP Compiler: supplies input (evidence: `src/compile/mod.rs`)
- HIP Compiler → GPU Code Object: produces (evidence: `src/compile/mod.rs`)
- Pipeline Runner → Disassembly Service: disassembles object (evidence: `src/main.rs`)
- Disassembly Service → llvm-objdump: invokes (evidence: `src/asm/mod.rs`)
- Disassembly Service → Process Runner: runs command (evidence: `src/asm/mod.rs`)
- Disassembly Service → Disassembly Parser: parses output (evidence: `src/asm/mod.rs`)
- Disassembly Parser → Assembly Lexer: tokenizes lines (evidence: `src/asm/disassembly.rs`)
- Pipeline Runner → Compare Decoder: decodes disassembly (evidence: `src/main.rs`)
- Compare Decoder → Assembly Lexer: reads operand tokens (evidence: `src/llvm/instruction.rs`)
- Compare Decoder → Register Types: parses registers (evidence: `src/llvm/instruction.rs`)
- Pipeline Runner → LLVM IR Emitter: emits IR (evidence: `src/main.rs`)
- LLVM IR Emitter → Compare Decoder: consumes decoded instructions (evidence: `src/llvm/ir.rs`)
- LLVM IR Emitter → Register Types: uses register indices (evidence: `src/llvm/ir.rs`)
- Pipeline Runner → LLVM IR File: writes IR (evidence: `src/main.rs`)
