AMD ROCm GPU inference for Linux. llama.cpp + HIP backend for RDNA 3.
Find a file
Claude 41b34b6779
feat(ax): apply RFC-025 AX compliance review
Principle 1 — Predictable Names:
- rocmModel.srv → rocmModel.server (struct field)
- recordMetrics: met → metrics (local var)
- backend.go/model.go: cfg → config (local vars)
- gguf.go: tc/kc → tensorCount32/kvCount32 (v2 count reads)

Principle 2 — Comments as Usage Examples:
- Added concrete usage examples to all exported functions:
  VRAMInfo, ModelInfo, DiscoverModels, GetVRAMInfo,
  ROCmAvailable, LoadModel, Available, NewClient, Health,
  ChatComplete, Complete, ReadMetadata, FileTypeName

Principle 5 — Test naming (_Good/_Bad/_Ugly):
- All test functions renamed to AX-7 convention across:
  discover_test.go, vram_test.go, server_test.go,
  internal/gguf/gguf_test.go, internal/llamacpp/client_test.go,
  internal/llamacpp/health_test.go

Also: fix go.sum missing entry for dappco.re/go/core transitive dep
(pulled in by go-inference replace directive).

All tests pass: go test ./... -short -count=1

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 07:33:47 +01:00
.forgejo/workflows ci: add Forgejo Actions test and security scan workflows 2026-02-23 03:28:08 +00:00
docs docs: archive completed phase 1-4 plans 2026-02-24 19:42:07 +00:00
internal feat(ax): apply RFC-025 AX compliance review 2026-03-31 07:33:47 +01:00
backend.go feat(ax): apply RFC-025 AX compliance review 2026-03-31 07:33:47 +01:00
CLAUDE.md fix(dx): audit coding standards and add tests for untested paths 2026-03-17 08:50:17 +00:00
discover.go feat(ax): apply RFC-025 AX compliance review 2026-03-31 07:33:47 +01:00
discover_test.go feat(ax): apply RFC-025 AX compliance review 2026-03-31 07:33:47 +01:00
go.mod feat(ax): apply RFC-025 AX compliance review 2026-03-31 07:33:47 +01:00
go.sum feat(ax): apply RFC-025 AX compliance review 2026-03-31 07:33:47 +01:00
model.go feat(ax): apply RFC-025 AX compliance review 2026-03-31 07:33:47 +01:00
README.md docs: add README with quick start and docs links 2026-02-20 15:11:26 +00:00
register_rocm.go feat(ax): apply RFC-025 AX compliance review 2026-03-31 07:33:47 +01:00
rocm.go feat(ax): apply RFC-025 AX compliance review 2026-03-31 07:33:47 +01:00
rocm_benchmark_test.go feat: benchmark suite for decode speed, TTFT, and concurrent throughput 2026-02-19 23:16:40 +00:00
rocm_integration_test.go test: add integration tests for Classify, BatchGenerate, Info, Metrics 2026-02-24 18:52:10 +00:00
rocm_stub.go feat(ax): apply RFC-025 AX compliance review 2026-03-31 07:33:47 +01:00
server.go refactor: replace fmt.Errorf/errors.New with coreerr.E() 2026-03-16 21:08:52 +00:00
server_test.go feat(ax): apply RFC-025 AX compliance review 2026-03-31 07:33:47 +01:00
vram.go feat(ax): apply RFC-025 AX compliance review 2026-03-31 07:33:47 +01:00
vram_test.go feat(ax): apply RFC-025 AX compliance review 2026-03-31 07:33:47 +01:00

go-rocm

AMD ROCm GPU inference for Linux via a managed llama-server subprocess. Implements the inference.Backend and inference.TextModel interfaces from go-inference for AMD RDNA 3+ GPUs (validated on RX 7800 XT with ROCm 7.2). Uses llama-server's OpenAI-compatible streaming API rather than direct HIP CGO bindings, giving access to 50+ GGUF model architectures with GPU crash isolation. Includes a GGUF v2/v3 binary metadata parser, sysfs VRAM monitoring, and model discovery. Platform-restricted: linux/amd64 only; a safe stub compiles everywhere else.

Module: forge.lthn.ai/core/go-rocm Licence: EUPL-1.2 Language: Go 1.25

Quick Start

import (
    "forge.lthn.ai/core/go-inference"
    _ "forge.lthn.ai/core/go-rocm"  // registers "rocm" backend via init()
)

// Requires llama-server compiled with HIP/ROCm on PATH
model, err := inference.LoadModel("/path/to/model.gguf")
defer model.Close()

for tok := range model.Generate(ctx, "Hello", inference.WithMaxTokens(256)) {
    fmt.Print(tok.Text)
}

Documentation

  • Architecture — subprocess design rationale, inference flow, server lifecycle, GGUF parser, VRAM monitoring
  • Development Guide — prerequisites (ROCm, llama-server build), test commands, benchmarks
  • Project History — completed phases, commit hashes, known limitations

Build & Test

go test ./...                             # unit tests, no GPU required
go test -tags rocm ./...                  # integration tests and benchmarks (GPU required)
go build ./...

Licence

European Union Public Licence 1.2 — see LICENCE for details.