feat(rocm): Vendor SDK recipe and update to 10.1
Maintain the gfx1151 SDK locally using the official AMD archive. Use the TheRock patchelf pin and adapt LLVM auxiliary tools for pure Nix builds. Verify SDK installation, HIP and rocBLAS GPU operations, and rebuild its consumers. Document the internal rc3 stamp and upstream migration findings.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
{"_type":"issue","id":"nix-overlay-2fk","title":"marmel: bump d6627d7 (1.0.0) -\u003e 3f238ff (main)","description":"Update packages/marmel to the latest upstream main commit 3f238ff217ee2e1033c937c840bd2d33ec57abc4 (feat: add per-role reasoning_effort configuration, #12). Verify src/hash, cargoHash, and whether the Landlock ro_paths fix landed (see nix-overlay-5ml) so the cargoTestFlags skips can be dropped or kept.","status":"closed","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-10-16T09:30:54Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-10-16T10:25:09Z","started_at":"2026-10-16T09:30:59Z","closed_at":"2026-10-16T10:25:09Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"nix-overlay-2gf","title":"Update all packages to latest versions","description":"## Why\\nUser request: update every package in the overlay to its latest upstream version.\\n\\n## What\\nBump version + src hash (and cargoHash for Rust) in each packages/\u003cname\u003e/package.nix, update README table if needed, verify builds.\\n\\n## Acceptance\\n- Every package builds with nix build .#\u003cname\u003e\\n- README reflects new versions\\n- Changes committed and pushed","notes":"All packages updated and built successfully. Commit 1f3f0f468bdd on local main. PUSH BLOCKED: git.millerson.name:22002 and DoltHub unreachable from this network (SSH connect timeout). Re-run git push + bd dolt push when network is back, then close.","status":"closed","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-08-07T07:22:50Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-08-07T13:17:34Z","started_at":"2026-08-07T07:22:55Z","closed_at":"2026-08-07T13:17:34Z","close_reason":"All packages updated to latest versions, verified building, pushed to origin","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"id":"nix-overlay-3sa","title":"pdfcraft: add PdfCraft 0.18.0 (build from source)","description":"Add packages/pdfcraft building the storytold/pdfcraft Rust workspace from source (no pre-compiled binaries): desktop app + pdfcraft-cli, desktop entry, icons, metainfo, OCR models. Plus a Home Manager module.","status":"closed","priority":2,"issue_type":"feature","assignee":"minder","created_at":"2026-11-03T08:31:41.141131190Z","created_by":"minder","updated_at":"2026-11-03T10:48:31.465220459Z","closed_at":"2026-11-03T10:48:31.464736388Z","close_reason":"nix build .#packages.x86_64-linux.pdfcraft succeeds; pdfcraft/pdfcraft-cli 0.18.0 run, pdfcraft-cli render+info+extract work on a test PDF, mcp initialize answers, ocr_status reports available:true, desktop-file-validate clean, home-manager eval picks the package up from programs.pdfcraft.enable","source_repo":"nix-overlay","compaction_level":0,"original_size":0}
|
||||
{"id":"nix-overlay-4ou","title":"Vendor TheRock ROCm SDK recipe and update to 10.1","description":"Own the gfx1151 TheRock SDK recipe locally, update official SDK to 10.1.0, review nixpkgs PR 579527 and issue 563157, verify dependent builds and hardware checks, document and merge main.","notes":"Local SDK recipe implemented. Official archive hash sha256-UN65kwNbwvalq6Xj3o1HbYxRKi7sLL/VqladceC4szc=. Manifest rocm_version is 10.1.0 and internal rocm_package_version is 10.1.0rc3. The private patchelf matches TheRock commit d0f70eea5397606c486857e0a105e53ec123904a, includes PHDR fix #544, and passed 56 tests with 2 skipped. Stock patchelf 0.19.2 fails when extending librocsparse RPATH. LLVM 24 requires patching auxiliary ELF tools including llvm-offload-binary. SDK builds; HIP vector add and rocBLAS GPU matmul pass on gfx1151. Eight core libraries dlopen successfully. Crucible build passed, and the Strixite GPU check passed all 9 CPU-reference comparisons. Follow-up nix-overlay-9i8 tracks removal of the private patchelf. Source and migration context are documented in docs/therock-rocm.md.\nStrata rebuild completed successfully. Upstream follow-up reviewed TheRock issues/PRs #6712, #4568, #2787, #7049 and #9515, plus current TheRock Dockerfile. Current upstream still pins patchelf d0f70ee. Fresh patchelf 0.19.3 passed 69 upstream tests with 6 skipped, but reproduces the same librocsparse RPATH alignment failure as 0.19.2; the TheRock pin passes the identical rewrite. Maintenance notes updated with this evidence.\nStrixite, hipfire-kernels (349 gfx1151 modules), and hipfire rebuilds completed successfully. Packaged hipfire CLI help runs successfully with a clean runtime environment. No model inference was tested; model weights are supplied separately.\nFinal x86_64-linux flake evaluation passed with allowUnfree, and nixfmt plus git diff --check passed. Reviewed local recipe, SDK wrappers, test coverage and consumer wiring before merge.","status":"closed","priority":2,"issue_type":"feature","assignee":"minder","created_at":"2026-11-12T19:03:42.805500168Z","created_by":"minder","updated_at":"2026-11-12T20:40:38.904418019Z","closed_at":"2026-11-12T20:40:38.903746036Z","close_reason":"Local ROCm 10.1 SDK recipe, upstream investigation, consumer rebuilds and gfx1151 GPU checks completed; maintenance follow-up tracked separately.","source_repo":"nix-overlay","compaction_level":0,"original_size":0}
|
||||
{"_type":"issue","id":"nix-overlay-51o","title":"marmel: bump 3f238ff -\u003e 981b35b (main)","description":"Update packages/marmel to latest upstream main commit 981b35b0d356e56de429ab4198e427ccfbe7d85f. Verify src hash, cargoHash, whether patches (landlock-nix-store.patch #14, session-boot-trust-store.patch) still apply / whether follow-ups nix-overlay-pnb / nix-overlay-nn2 can close, and whether the sandbox test skip is still needed.","status":"closed","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-10-18T11:25:08Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-10-18T11:53:11Z","started_at":"2026-10-18T11:25:13Z","closed_at":"2026-10-18T11:53:11Z","close_reason":"Bumped packages/marmel to 981b35b (main), hash regenerated, full build+tests green (1030+ tests).","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"nix-overlay-570","title":"radar: ensure package builds without error","description":"Verify nix build .#radar succeeds; fix any build failures.","status":"closed","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-10-06T16:51:35Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-10-06T17:02:59Z","started_at":"2026-10-06T16:51:40Z","closed_at":"2026-10-06T17:02:59Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"nix-overlay-5gg","title":"freetoken: optional accel extras and kernel-cache wheel","description":"Follow-ups for the freetoken package: (1) package flashinfer[cu12] and sglang-kernel 0.4.5 (accel extra) so the native fast path is available instead of the Triton fallback; (2) package the freetoken-kernel-cache companion wheel (prebuilt TVM FFI kernels, built via scripts/build-release-wheels.sh) so TVM JIT kernel compilation (nvcc at runtime) can be avoided. Both blocked on suitable PyPI/CUDA packaging work in nixpkgs (flashinfer exists in nixpkgs but needs cu12 variant). Priority: backlog.","status":"open","priority":3,"issue_type":"task","owner":"alex@millerson.name","created_at":"2026-08-30T17:58:57Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-08-30T17:58:57Z","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
@@ -12,6 +13,7 @@
|
||||
{"id":"nix-overlay-6pp","title":"Migrate issue tracking from bd (beads) to br (beads_rust)","status":"closed","priority":2,"issue_type":"task","assignee":"minder","created_at":"2026-10-21T15:46:41.935573511Z","created_by":"minder","updated_at":"2026-10-21T15:46:47.717419622Z","closed_at":"2026-10-21T15:46:47.716915059Z","close_reason":"Migrated AGENTS.md, docs/agents/*, .serena memories, .claude hooks, and .beads config/ignore from bd to br; removed bd git hooks; br verified in sync with .beads/issues.jsonl","source_repo":".","compaction_level":0,"original_size":0}
|
||||
{"_type":"issue","id":"nix-overlay-8wl","title":"marmel: bump to 1.0.0 (pin d6627d7c)","description":"Update packages/marmel to version 1.0.0, pinning upstream commit d6627d7cf3bf509d1e6db0d9d78736116e92e82a (the 1.0.0 release commit). Update src hash and cargoHash, verify build.","status":"closed","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-10-06T15:44:55Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-10-16T13:34:44Z","started_at":"2026-10-06T15:45:40Z","closed_at":"2026-10-16T13:34:44Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"nix-overlay-8y9","title":"Package opencode plugin as open-code-review passthru","description":"Expose plugins/open-code-review/opencode from the open-code-review source as passthru.opencode-plugin: single TS plugin file + node_modules built from the repo lockfile, installed under share/open-code-review/opencode","status":"closed","priority":2,"issue_type":"feature","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-09-26T07:41:49Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-09-26T08:35:15Z","started_at":"2026-09-26T07:43:56Z","closed_at":"2026-09-26T08:35:15Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"id":"nix-overlay-9i8","title":"therock-rocm: drop private patchelf after SDK RPATH alignment fix","description":"TheRock 10.1.0 gfx1151 SDK (internal stamp 10.1.0rc3) librocsparse.so.1.0 fails both stock patchelf 0.19.2 and freshly tested 0.19.3 when its RPATH is extended: section content is not naturally aligned. The SDK recipe uses TheRock-pinned patchelf d0f70eea5397606c486857e0a105e53ec123904a, which includes PHDR fix #544 and passes the exact same rewrite. TheRock main still pins this commit. Revisit the private override once stock patchelf passes this real SDK input without ELF corruption. Require SDK install checks, dlopen of librocsparse/HSA/HIP and therock-rocm.tests.hip GPU tests before dropping it. See docs/therock-rocm.md.","status":"open","priority":3,"issue_type":"task","created_at":"2026-11-12T19:33:13.832941867Z","created_by":"minder","updated_at":"2026-11-12T20:12:38.441357445Z","source_repo":"nix-overlay","compaction_level":0,"original_size":0}
|
||||
{"_type":"issue","id":"nix-overlay-9xs","title":"Update all packages to latest versions","description":"Update every package in packages/ to its latest upstream version, refresh source hashes and cargoHashes, verify builds, update README.","status":"in_progress","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-08-07T05:45:16Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-08-07T05:45:22Z","started_at":"2026-08-07T05:45:22Z","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"nix-overlay-a9m","title":"Fix haivemind startup after MainScreen mount","description":"Restore deferred engine startup while preserving MainScreen widget lookup fix.","status":"closed","priority":1,"issue_type":"bug","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-08-20T11:20:36Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-08-20T11:21:43Z","started_at":"2026-08-20T11:20:43Z","closed_at":"2026-08-20T11:21:43Z","close_reason":"Restored engine startup after MainScreen mount and verified package build.","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
{"_type":"issue","id":"nix-overlay-bjd","title":"Add nftables-analyzer CLI package","description":"Add python3Packages.buildPythonApplication derivation for reinaldosaraiva/nftables-analyzer (CLI only). Pin to main commit 5fc78d0c9ce173e3baa80a5655bcadb1b2f78493 (no tags upstream). sourceRoot=source/backend, hatchling build system. Category: Networking. Frontend excluded - upstream repo missing frontend/src/lib modules.","status":"closed","priority":2,"issue_type":"task","assignee":"Alexander Miroshnichenko","owner":"alex@millerson.name","created_at":"2026-08-07T04:48:07Z","created_by":"Alexander Miroshnichenko","updated_at":"2026-08-07T04:50:25Z","started_at":"2026-08-07T04:48:10Z","closed_at":"2026-08-07T04:50:25Z","close_reason":"Package added, built, smoke-tested, committed","dependency_count":0,"dependent_count":0,"comment_count":0}
|
||||
|
||||
@@ -42,7 +42,7 @@ A custom Nix overlay and flake providing additional packages not found in upstre
|
||||
| `hipfire-kernels` | Precompiled hipfire kernels for gfx1151 | AI Inference |
|
||||
| `gufo` | Gufo with XDNA2 NPU support and the Unsloth UD 3.1 compatibility patch | AI Inference |
|
||||
| `xrt-amdxdna` | XRT with the amdxdna plugin, built against gufo's nixpkgs | AI Inference |
|
||||
| `therock-rocm` | TheRock 10.0 SDK for gfx1151 | AI Inference |
|
||||
| `therock-rocm` | Locally maintained TheRock 10.1 SDK for gfx1151 | AI Inference |
|
||||
| `strata` | Strata inference engine, API server and CPU vision encoder with ROCm 10 HIP support for gfx1151 | AI Inference |
|
||||
| `crucible-strix-halo` | Crucible EXL3 inference engine and OpenAI-compatible server for gfx1151 with the ROCm 10 runtime | AI Inference |
|
||||
| `strixite` | Source-built HIP inference engine and OpenAI-compatible server for gfx1151 / Zen 5 with ROCm 10 | AI Inference |
|
||||
@@ -133,12 +133,16 @@ ROCm overlay as `overlays.hipfire`. Neither is enabled by the default module.
|
||||
|
||||
Gufo exports its matching `xrt`, `npuDir` and `fabricClock` as package attributes.
|
||||
The consumer must configure NPU power and fabric clocks before using the NPU.
|
||||
TheRock and XRT use individual recipes from the pinned `nix-strix-halo` source
|
||||
tree. Its flake and Thunderbolt dependencies are not loaded.
|
||||
TheRock uses this repository's own SDK recipe and a pinned official AMD tarball.
|
||||
The 10.1.0 archive's internal package stamp is `10.1.0rc3`.
|
||||
See [TheRock maintenance notes](docs/therock-rocm.md) for the source, update
|
||||
procedure and nixpkgs migration context. XRT still uses an individual recipe from
|
||||
the pinned `nix-strix-halo` source tree; its flake and Thunderbolt dependencies
|
||||
are not loaded.
|
||||
|
||||
Strata ships `strata` (the HIP engine), `strata-server` (the OpenAI/Anthropic HTTP
|
||||
server, also the default for `nix run .#strata`) and `strata-vision` (CPU image
|
||||
encoder). It uses the shared TheRock ROCm 10.0 SDK, compiles GPU kernels only for
|
||||
encoder). It uses the shared TheRock ROCm 10.1 SDK, compiles GPU kernels only for
|
||||
`gfx1151`, and uses upstream's portable AVX2 CPU baseline. Model weights and vision
|
||||
projectors are supplied separately.
|
||||
|
||||
@@ -153,7 +157,7 @@ with ROCm 10; the engine falls back to hipBLAS when no matching table is supplie
|
||||
|
||||
Crucible ships `crucible-server` (also `nix run .#crucible-strix-halo`) and
|
||||
`crucible-engine`. It uses upstream's release engine compiled with ROCm 7.2.4,
|
||||
patched to use this overlay's TheRock ROCm 10.0 runtime. Upstream requires the
|
||||
patched to use this overlay's TheRock ROCm 10.1 runtime. Upstream requires the
|
||||
7.2.4 compiler for source builds. The Python server comes from the matching tag.
|
||||
The package targets the Ryzen AI Max+ 395 / Radeon 8060S (`gfx1151`) with 128 GB
|
||||
RAM. Supply a compatible Qwen3.8-Flash-Next EXL3 pack separately:
|
||||
@@ -169,7 +173,7 @@ is not included. Model downloads and conversation state belong outside the Nix
|
||||
store. See the upstream [setup guide](https://github.com/jaedync/crucible-strix-halo/blob/v0.37.0/docs/QUICKSTART.md)
|
||||
for GPU memory configuration and model requirements.
|
||||
|
||||
Strixite builds from source with the shared TheRock ROCm 10.0 SDK for `gfx1151`
|
||||
Strixite builds from source with the shared TheRock ROCm 10.1 SDK for `gfx1151`
|
||||
and the Zen 5 host CPU. It ships `strix_server` (the default entry point),
|
||||
`convert_qwen4exp`, `convert_ngram_table`, `transcode_ngram_table`, `inspect_strixw`
|
||||
and `check_stream_calls`. Supply the upstream `.strixw` weights, tokenizer and
|
||||
|
||||
@@ -5,9 +5,7 @@ let
|
||||
config.allowUnfree = true;
|
||||
overlays = [ inputs.hipfire.overlays.default ];
|
||||
};
|
||||
therock-rocm = pkgs.callPackage ../packages/therock-rocm/package.nix {
|
||||
inherit (inputs) nix-strix-halo;
|
||||
};
|
||||
therock-rocm = pkgs.callPackage ../packages/therock-rocm/package.nix { };
|
||||
hipfire = pkgs.callPackage ../packages/hipfire/package.nix {
|
||||
hipfireSource = inputs.hipfire;
|
||||
therockRocm = therock-rocm;
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
# TheRock ROCm SDK
|
||||
|
||||
The `therock-rocm` package is maintained in this repository. `packages/therock-rocm/package.nix`
|
||||
pins the version, GPU target and archive hash; `sdk.nix` installs and adapts the
|
||||
official AMD binary SDK to Nix. It was adapted from
|
||||
[`hellas-ai/nix-strix-halo` at b2969bd](https://github.com/hellas-ai/nix-strix-halo/blob/b2969bd90fedc4a1f9d91648bfdf8f21479b8178/pkgs/therock/rocm-sdk/default.nix).
|
||||
It no longer imports that project's ROCm recipe or source metadata. The flake
|
||||
input remains necessary for Gufo's XRT package.
|
||||
|
||||
The SDK archive is
|
||||
[`therock-dist-linux-gfx1151-10.1.0.tar.gz`](https://stable.repo.amd.com/rocm/core/tarball/therock-dist-linux-gfx1151-10.1.0.tar.gz).
|
||||
Its manifest declares `rocm_version = 10.1.0` and an internal
|
||||
`rocm_package_version = 10.1.0rc3`. Both are checked during installation;
|
||||
the internal build stamp is also exposed as `therock-rocm.packageVersion`.
|
||||
Hipfire (including its kernels), Strata, Crucible and Strixite share this package.
|
||||
Crucible retains its official engine binary compiled with ROCm 7.2.4; its runtime
|
||||
comes from this SDK. Kyojin, Gufo and the llama.cpp forks retain their own upstream
|
||||
toolchain choices.
|
||||
|
||||
As reviewed on 2026-11-12, nixpkgs [PR #579527](https://github.com/NixOS/nixpkgs/pull/579527)
|
||||
is open and targets `staging`. It is the final part of a series replacing the
|
||||
7.2.4 scope with ROCm 10.1, including LLVM 24. The author reports hardware checks
|
||||
on gfx1102 and gfx906; this does not validate gfx1151. The PR also adds `hipfile`
|
||||
for torch/vLLM and libdrm for torch. Those source-package changes are not needed
|
||||
for our standalone inference engines' bundled SDK.
|
||||
|
||||
[Issue #563157](https://github.com/NixOS/nixpkgs/issues/563157) discusses the
|
||||
TheRock/ROCm naming transition, LLVM 24 prerequisites, composable-kernel changes,
|
||||
OpenMP/profiler integration and build resource requirements. It remains open.
|
||||
We keep the SDK tarball approach while the source-package migration is under
|
||||
review, without changing the repository's nixpkgs pins to an unmerged PR.
|
||||
|
||||
The [TheRock environment guide](https://github.com/ROCm/TheRock/blob/main/docs/environment_setup_guide.md#patchelf)
|
||||
requires the PHDR fix from [patchelf #544](https://github.com/NixOS/patchelf/pull/544)
|
||||
when rewriting kpack split ELF libraries. Nixpkgs' patchelf 0.19.2 includes
|
||||
that fix, but both 0.19.2 and the newer release 0.19.3 reject this SDK's `librocsparse.so.1.0` with
|
||||
`section content is not naturally aligned` when extending its RPATH. The recipe
|
||||
therefore uses TheRock's pinned patchelf commit
|
||||
`d0f70eea5397606c486857e0a105e53ec123904a`, built locally with its test suite.
|
||||
It includes the PHDR fix. This override is confined to the SDK and exposed as
|
||||
`therock-rocm.patchelf`. The global patchelf package is unchanged. The recipe
|
||||
patches split libraries instead of retaining the old workaround that skipped
|
||||
late PHDR tables. SDK install checks inspect the HSA runtime's program headers
|
||||
and execute the compiler and HIP configuration tools.
|
||||
All top-level ELF tools in the SDK's compiler/bin directories are patched,
|
||||
including LLVM 24's `llvm-offload-binary`, which clang invokes as a subprocess.
|
||||
Its stock `/lib64/ld-linux-x86-64.so.2` interpreter cannot run in a pure Nix build.
|
||||
|
||||
The upstream review also checked [TheRock #6712](https://github.com/ROCm/TheRock/issues/6712)
|
||||
and the pin in the current manylinux Dockerfile: both select the same `d0f70ee`
|
||||
patchelf. A local build of release 0.19.3 passed 69 tests with 6 skipped, but still
|
||||
failed the exact same `librocsparse` RPATH rewrite that the TheRock pin passes.
|
||||
[TheRock #2787](https://github.com/ROCm/TheRock/pull/2787) already added
|
||||
`llvm-offload-binary` to the compiler tool list; our archive contains it and only
|
||||
needs its interpreter adapted to Nix. The recent
|
||||
[PyTorch wheel RPATH change #9515](https://github.com/ROCm/TheRock/pull/9515) addresses
|
||||
the wheel layout rather than this standalone SDK tarball.
|
||||
|
||||
To update, change the SDK version and obtain the flat archive hash with
|
||||
`nix store prefetch-file URL --json`. Keep the official target-specific tarball
|
||||
URL and pin the returned hash. Inspect `share/therock/therock_manifest.json` in
|
||||
the result as well as the archive name: the old 10.0.0 archive reported an rc4
|
||||
package version internally, and the official stable 10.1.0 archive reports rc3.
|
||||
|
||||
Build `nix build .#therock-rocm .#therock-rocm.tests.hip`, then run
|
||||
`nix run .#therock-rocm.tests.hip` on a host with GPU access. The HIP test compiles
|
||||
through the SDK's Nix-aware compiler wrapper and checks vector addition and
|
||||
rocBLAS matrix multiplication on the device. Rebuild the four direct consumers and `hipfire-kernels`; also run
|
||||
`nix run .#strixite.tests.gpu` and the flake evaluation checks. Kernel checks
|
||||
do not replace model inference testing.
|
||||
@@ -52,11 +52,16 @@ let
|
||||
(old: {
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [ hipccFixed ];
|
||||
env.HIPFIRE_HIPCC = "${hipccFixed}/bin/hipcc";
|
||||
preBuild = (old.preBuild or "") + ''
|
||||
export CARGO_BUILD_JOBS="$NIX_BUILD_CORES"
|
||||
export HIPFIRE_PACK_JOBS="$NIX_BUILD_CORES"
|
||||
'';
|
||||
});
|
||||
|
||||
hipfireWithQuantize = pkgs.hipfire.overrideAttrs (_: {
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
export CARGO_BUILD_JOBS="$NIX_BUILD_CORES"
|
||||
cargo build --release -p hipfire-daemon
|
||||
cargo build --release -p hipfire-cli
|
||||
cargo build --release -p hipfire-quantize \
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
#include <hip/hip_runtime.h>
|
||||
#include <rocblas/rocblas.h>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#define HIP_CHECK(call) do { \
|
||||
hipError_t error = (call); \
|
||||
if (error != hipSuccess) { \
|
||||
std::fprintf(stderr, "%s: %s\n", #call, hipGetErrorString(error)); \
|
||||
std::exit(1); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define BLAS_CHECK(call) do { \
|
||||
rocblas_status status = (call); \
|
||||
if (status != rocblas_status_success) { \
|
||||
std::fprintf(stderr, "%s: rocBLAS status %d\n", #call, int(status)); \
|
||||
std::exit(1); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
__global__ void vector_add(const float* a, const float* b, float* result) {
|
||||
int i = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
result[i] = a[i] + b[i];
|
||||
}
|
||||
|
||||
int main() {
|
||||
constexpr int count = 1024;
|
||||
float a[count], b[count], result[count];
|
||||
for (int i = 0; i < count; ++i) {
|
||||
a[i] = float(i);
|
||||
b[i] = float(count - i);
|
||||
}
|
||||
hipDeviceProp_t properties{};
|
||||
HIP_CHECK(hipGetDeviceProperties(&properties, 0));
|
||||
float *device_a, *device_b, *device_result;
|
||||
HIP_CHECK(hipMalloc(&device_a, sizeof(a)));
|
||||
HIP_CHECK(hipMalloc(&device_b, sizeof(b)));
|
||||
HIP_CHECK(hipMalloc(&device_result, sizeof(result)));
|
||||
HIP_CHECK(hipMemcpy(device_a, a, sizeof(a), hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipMemcpy(device_b, b, sizeof(b), hipMemcpyHostToDevice));
|
||||
vector_add<<<count / 256, 256>>>(device_a, device_b, device_result);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipMemcpy(result, device_result, sizeof(result), hipMemcpyDeviceToHost));
|
||||
for (int i = 0; i < count; ++i) {
|
||||
if (result[i] != float(count)) {
|
||||
std::fprintf(stderr, "vector add mismatch at %d: %f\n", i, result[i]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
const float matrix_a[] = {1, 3, 2, 4};
|
||||
const float matrix_b[] = {5, 7, 6, 8};
|
||||
const float expected[] = {19, 43, 22, 50};
|
||||
float matrix_result[4];
|
||||
HIP_CHECK(hipMemcpy(device_a, matrix_a, sizeof(matrix_a), hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipMemcpy(device_b, matrix_b, sizeof(matrix_b), hipMemcpyHostToDevice));
|
||||
rocblas_handle handle;
|
||||
BLAS_CHECK(rocblas_create_handle(&handle));
|
||||
const float alpha = 1, beta = 0;
|
||||
BLAS_CHECK(rocblas_sgemm(handle, rocblas_operation_none, rocblas_operation_none,
|
||||
2, 2, 2, &alpha, device_a, 2, device_b, 2, &beta, device_result, 2));
|
||||
HIP_CHECK(hipMemcpy(matrix_result, device_result, sizeof(matrix_result), hipMemcpyDeviceToHost));
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (matrix_result[i] != expected[i]) {
|
||||
std::fprintf(stderr, "rocBLAS matrix multiply mismatch at %d: %f\n", i, matrix_result[i]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
BLAS_CHECK(rocblas_destroy_handle(handle));
|
||||
HIP_CHECK(hipFree(device_a));
|
||||
HIP_CHECK(hipFree(device_b));
|
||||
HIP_CHECK(hipFree(device_result));
|
||||
std::printf("HIP vector add and rocBLAS matmul OK: %s (%s), %d elements\n",
|
||||
properties.name, properties.gcnArchName, count);
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
{ pkgs, nix-strix-halo }:
|
||||
let
|
||||
source =
|
||||
(builtins.fromJSON (builtins.readFile (nix-strix-halo + "/pkgs/therock/sources/rocm.json")))
|
||||
.linux.gfx1151;
|
||||
in
|
||||
pkgs.callPackage (nix-strix-halo + "/pkgs/therock/rocm-sdk") {
|
||||
{ callPackage }:
|
||||
callPackage ./sdk.nix {
|
||||
patchelf = callPackage ./patchelf.nix { };
|
||||
target = "gfx1151";
|
||||
inherit (source) version url hash;
|
||||
version = "10.1.0";
|
||||
packageVersion = "10.1.0rc3";
|
||||
hash = "sha256-UN65kwNbwvalq6Xj3o1HbYxRKi7sLL/VqladceC4szc=";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
patchelf,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
autoreconfHook,
|
||||
}:
|
||||
# Match TheRock's dockerfiles/build_manylinux_x86_64.Dockerfile. This includes
|
||||
# NixOS/patchelf#544 and accepts the SDK's librocsparse ELF when extending RPATH.
|
||||
(patchelf.override { inherit stdenv; }).overrideAttrs (old: {
|
||||
pname = "patchelf-therock";
|
||||
version = "0.18.0-therock-d0f70ee";
|
||||
src = fetchFromGitHub {
|
||||
owner = "NixOS";
|
||||
repo = "patchelf";
|
||||
rev = "d0f70eea5397606c486857e0a105e53ec123904a";
|
||||
hash = "sha256-CWAlYVtcswIpOZj5Qyxswsy1pAnPUTTUDapJO9ar0Mc=";
|
||||
};
|
||||
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ autoreconfHook ];
|
||||
doCheck = true;
|
||||
meta = old.meta // {
|
||||
changelog = "https://github.com/NixOS/patchelf/blob/d0f70eea5397606c486857e0a105e53ec123904a/ChangeLog.md";
|
||||
};
|
||||
})
|
||||
@@ -0,0 +1,232 @@
|
||||
# Adapted from hellas-ai/nix-strix-halo at b2969bd90fedc4a1f9d91648bfdf8f21479b8178,
|
||||
# pkgs/therock/rocm-sdk/default.nix. Maintained locally from ROCm 10.1 onward.
|
||||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
stdenv,
|
||||
binutils,
|
||||
jq,
|
||||
fetchurl,
|
||||
patchelf,
|
||||
libdrm,
|
||||
numactl,
|
||||
rdma-core,
|
||||
target,
|
||||
version,
|
||||
packageVersion ? version,
|
||||
url ? "https://stable.repo.amd.com/rocm/core/tarball/therock-dist-linux-${target}-${version}.tar.gz",
|
||||
hash,
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
pname = "therock-rocm-sdk-${target}";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
inherit url hash;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
binutils
|
||||
jq
|
||||
patchelf
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
libdrm
|
||||
numactl
|
||||
rdma-core
|
||||
];
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
dontPatchELF = true;
|
||||
dontStrip = true;
|
||||
# TheRock binary SDK ships both lib and lib64 content. Nix's generic
|
||||
# move-lib64 hook cannot merge this split layout and leaves lib64 non-empty.
|
||||
dontMoveLib64 = true;
|
||||
|
||||
unpackPhase = ''
|
||||
runHook preUnpack
|
||||
tar -xzf "$src"
|
||||
runHook postUnpack
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p "$out"
|
||||
shopt -s dotglob nullglob
|
||||
|
||||
if [ -d install ]; then
|
||||
cp -R install/* "$out/"
|
||||
else
|
||||
entries=(*/)
|
||||
if [ "''${#entries[@]}" -eq 1 ] && [ -d "''${entries[0]}install" ]; then
|
||||
cp -R "''${entries[0]}install/"* "$out/"
|
||||
else
|
||||
cp -R ./* "$out/"
|
||||
fi
|
||||
fi
|
||||
|
||||
chmod -R u+w "$out"
|
||||
find "$out" -type f -name "*.so*" -exec chmod 755 {} \; 2>/dev/null || true
|
||||
find "$out/bin" "$out/llvm/bin" -type f -exec chmod 755 {} \; 2>/dev/null || true
|
||||
|
||||
# TheRock binary SDKs are built as relocatable Linux tarballs, not Nix
|
||||
# derivations. Make the shipped ELF binaries/libraries usable in pure Nix
|
||||
# build sandboxes so CMake probes such as FindHIP can execute hipconfig.
|
||||
gcc_runtime=${lib.escapeShellArg "${stdenv.cc.cc.lib}/lib"}
|
||||
libdrm_runtime=${lib.escapeShellArg "${lib.getLib libdrm}/lib"}
|
||||
numa_runtime=${lib.escapeShellArg "${lib.getLib numactl}/lib"}
|
||||
rdma_runtime=${lib.escapeShellArg "${lib.getLib rdma-core}/lib"}
|
||||
dynamic_linker=${lib.escapeShellArg stdenv.cc.bintools.dynamicLinker}
|
||||
runtime_paths=(
|
||||
"$gcc_runtime"
|
||||
"$libdrm_runtime"
|
||||
"$numa_runtime"
|
||||
"$rdma_runtime"
|
||||
)
|
||||
|
||||
patch_elf() {
|
||||
local elf="$1"
|
||||
|
||||
# Use TheRock's pinned patchelf with NixOS/patchelf#544: late PHDR
|
||||
# tables in kpack split ELFs can be rewritten without corruption.
|
||||
if old_rpath=$(patchelf --print-rpath "$elf" 2>/dev/null); then
|
||||
new_rpath="$old_rpath"
|
||||
for runtime_path in "''${runtime_paths[@]}"; do
|
||||
case ":$new_rpath:" in
|
||||
*":$runtime_path:"*) ;;
|
||||
*) new_rpath="''${new_rpath:+$new_rpath:}$runtime_path" ;;
|
||||
esac
|
||||
done
|
||||
patchelf --set-rpath "$new_rpath" "$elf" || {
|
||||
echo "failed to patch RPATH: $elf" >&2
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
|
||||
if patchelf --print-interpreter "$elf" >/dev/null 2>&1; then
|
||||
patchelf --set-interpreter "$dynamic_linker" "$elf"
|
||||
fi
|
||||
}
|
||||
|
||||
# LLVM 24 also invokes auxiliary tools such as llvm-offload-binary.
|
||||
# Patch every top-level ELF tool, including these compiler subprocesses.
|
||||
for dir in "$out/bin" "$out/llvm/bin" "$out/lib/llvm/bin"; do
|
||||
[ -d "$dir" ] || continue
|
||||
for tool in "$dir"/*; do
|
||||
[ -f "$tool" ] || continue
|
||||
patch_elf "$tool"
|
||||
done
|
||||
done
|
||||
|
||||
for dir in \
|
||||
"$out/lib" \
|
||||
"$out/lib/rocm_sysdeps/lib" \
|
||||
"$out/lib/host-math/lib" \
|
||||
"$out/llvm/lib" \
|
||||
"$out/lib/llvm/lib" \
|
||||
"$out/share/amd_smi/amdsmi"; do
|
||||
[ -d "$dir" ] || continue
|
||||
while IFS= read -r -d "" elf; do
|
||||
patch_elf "$elf"
|
||||
done < <(find "$dir" -maxdepth 1 -type f \( -name "*.so" -o -name "*.so.*" \) -print0)
|
||||
done
|
||||
|
||||
# GCC's Nix wrapper enables the x86 TLS dialect globally. Clang's HIP
|
||||
# driver forwards that option to amdgcn too, where it is invalid.
|
||||
cc_cflags_before="$(sed -E 's/(^|[[:space:]])-mtls-dialect=[^[:space:]]+//g' ${stdenv.cc}/nix-support/cc-cflags-before)"
|
||||
cc_cflags="$(cat ${stdenv.cc}/nix-support/cc-cflags)"
|
||||
libc_cflags="$(cat ${stdenv.cc}/nix-support/libc-cflags)"
|
||||
libc_crt1_cflags="$(cat ${stdenv.cc}/nix-support/libc-crt1-cflags)"
|
||||
libc_ldflags="$(cat ${stdenv.cc}/nix-support/libc-ldflags)"
|
||||
cc_ldflags="$(cat ${stdenv.cc}/nix-support/cc-ldflags)"
|
||||
libc="$(cat ${stdenv.cc}/nix-support/orig-libc)"
|
||||
dynamic_linker="$(cat ${stdenv.cc}/nix-support/dynamic-linker)"
|
||||
|
||||
cat > "$out/bin/therock-hip-clang++" <<EOF
|
||||
#!/bin/sh
|
||||
exec "$out/lib/llvm/bin/clang++" \\
|
||||
--gcc-toolchain=${stdenv.cc.cc} \\
|
||||
--rocm-path="$out" \\
|
||||
$cc_cflags_before \\
|
||||
$cc_cflags \\
|
||||
$libc_cflags \\
|
||||
$libc_crt1_cflags \\
|
||||
"\$@" \\
|
||||
-L$libc/lib \\
|
||||
-Wl,--dynamic-linker=$dynamic_linker \\
|
||||
-Wl,-rpath,${stdenv.cc.cc.lib}/lib \\
|
||||
-Wl,-rpath,$libc/lib \\
|
||||
$libc_ldflags \\
|
||||
$cc_ldflags
|
||||
EOF
|
||||
sed -i 's/^ //' "$out/bin/therock-hip-clang++"
|
||||
chmod 755 "$out/bin/therock-hip-clang++"
|
||||
|
||||
# TheRock's CMake HIP helper normally re-enters hipcc, which then invokes
|
||||
# the raw bundled clang++ during link steps. That loses Nix's libc/libstdc++
|
||||
# search paths and fails to link extension modules in pure builds. Keep the
|
||||
# CMake contract (first argv is HIP_CLANG_PATH), but route the actual link
|
||||
# through the Nix-aware compiler wrapper above.
|
||||
cat > "$out/bin/hipcc_cmake_linker_helper" <<EOF
|
||||
#!/bin/sh
|
||||
[ "\$#" -gt 0 ] && shift
|
||||
exec "$out/bin/therock-hip-clang++" "\$@"
|
||||
EOF
|
||||
sed -i 's/^ //' "$out/bin/hipcc_cmake_linker_helper"
|
||||
chmod 755 "$out/bin/hipcc_cmake_linker_helper"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
installCheckPhase = ''
|
||||
runHook preInstallCheck
|
||||
jq -e --arg version '${version}' --arg packageVersion '${packageVersion}' \
|
||||
'.rocm_version == $version and .rocm_package_version == $packageVersion' \
|
||||
$out/share/therock/therock_manifest.json
|
||||
$out/bin/hipconfig --version
|
||||
$out/lib/llvm/bin/clang++ --version
|
||||
$out/lib/llvm/bin/llvm-offload-binary --version
|
||||
$out/lib/llvm/bin/llvm-readobj --file-headers $out/lib/libamdhip64.so
|
||||
readelf --program-headers $out/lib/libhsa-runtime64.so.1 > program-headers.log 2>&1
|
||||
if grep -E 'Error:|not covered by a LOAD segment' program-headers.log; then
|
||||
exit 1
|
||||
fi
|
||||
runHook postInstallCheck
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit target patchelf packageVersion;
|
||||
tests.hip = stdenv.mkDerivation {
|
||||
pname = "therock-hip-smoke-${target}";
|
||||
inherit version;
|
||||
dontUnpack = true;
|
||||
buildPhase = ''
|
||||
${finalAttrs.finalPackage}/bin/therock-hip-clang++ \
|
||||
-x hip --offload-arch=${target} ${./hip-smoke.cpp} \
|
||||
-L${finalAttrs.finalPackage}/lib -Wl,-rpath,${finalAttrs.finalPackage}/lib \
|
||||
-lrocblas -o hip-smoke
|
||||
'';
|
||||
installPhase = ''
|
||||
install -Dm755 hip-smoke $out/bin/hip-smoke
|
||||
'';
|
||||
meta = {
|
||||
description = "HIP vector-add and rocBLAS GPU checks for the packaged TheRock SDK";
|
||||
platforms = [ "x86_64-linux" ];
|
||||
mainProgram = "hip-smoke";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "TheRock ROCm SDK binary tarball for ${target}";
|
||||
homepage = "https://github.com/ROCm/TheRock";
|
||||
license = lib.licenses.mit;
|
||||
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
};
|
||||
})
|
||||
Reference in New Issue
Block a user