antirez / antirez/ds4

Fedora 44 / Strix Halo: build succeeds with -no-pie and -lamdhip64

Abierto
#626 1 comentario 2 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
C
Estrellas
22.3k
Forks
2.1k
Merge medio
1 d 3 h
PR fusionados (30 d)
4

Descripción

(Buongiorno!, sono italiano e scrivo moderatamente male in inglese, quindi perdonate se ho fatto elaborare il testo dall'amico sintetico per renderlo pubblicabile.)

## Summary

I tested DS4 on a Corsair AI Workstation 300 with an AMD Ryzen AI MAX+ 395
and Radeon 8060S (`gfx1151`), running Fedora 44.

The documented build command "make strix-halo" failed during the final linking stage on this system.

I was eventually able to build and run DS4 by adding:

1. `-no-pie` to `ROCM_CFLAGS`
2. `-lamdhip64` to `ROCM_LDLIBS`

This may be specific to Fedora's ROCm packaging or toolchain defaults. It is also possible that I missed a package, configuration step, or more appropriate way of setting up the build environment, so I am reporting the complete diagnostic information rather than assuming that the Makefile itself is necessarily at fault.

No DS4 source files were modified.

## System

OS: Fedora Linux 44 (Workstation Edition)
Kernel: 7.0.9-202.fc44.x86_64
Hardware: CORSAIR AI WORKSTATION 300
CPU: AMD Ryzen AI MAX+ 395
GPU: AMD Radeon 8060S Graphics
ROCm architecture: gfx1151
RAM: 128 GB
HIP: 7.1.52802-9999
ROCm Clang: 20.0.0.rocm
GCC: 16.1.1
LLD: 20.0.0
DS4 commit: 54b36ed9ba42da31b24f2d1a5feb075c2475dbb1

Installed Fedora packages:

hipcc-20-13.rocm7.1.1.fc44.x86_64
rocminfo-7.1.0-4.fc44.x86_64
rocm-hip-devel-7.1.1-3.fc44.x86_64
hipblas-devel-7.1.0-6.fc44.x86_64
hipblaslt-devel-7.1.1-7.fc44.x86_64
rocblas-devel-7.1.1-7.fc44.x86_64
rocwmma-devel-7.1.0-5.fc44.x86_64
hipcub-devel-7.1.0-5.fc44.x86_64

Relevant kernel parameters:

iommu=pt
ttm.pages_limit=28311552

ROCm correctly detects the GPU:

Name: gfx1151
Marketing Name: AMD Radeon 8060S Graphics
Device Type: GPU
ISA: amdgcn-amd-amdhsa--gfx1151

## First build failure: PIE relocation errors

Running:

make clean
make strix-halo -j"$(nproc)"

produced repeated linker errors such as:

ld.lld: error: relocation R_X86_64_32 cannot be used against local symbol;
recompile with -fPIC

On this Fedora installation, the C source files were compiled by GCC without PIE/PIC enabled, while the final `hipcc` link produced a PIE executable by default.

I verified the default `hipcc` behavior with a minimal test. The resulting executable was reported as:

Type: DYN (Position-Independent Executable file)

Adding `-no-pie` to the flags passed to `hipcc` removed the relocation errors.

I understand that compiling the C objects with `-fPIE` or another solution may be preferable upstream. I used `-no-pie` only as the smallest diagnostic change to verify the cause.

## Second build failure: unresolved HIP runtime symbols

After adding `-no-pie`, the relocation errors disappeared, but linking thenfailed with unresolved symbols including:

hipSetDevice
hipMalloc
hipFree
hipMemcpyAsync
hipLaunchKernel

I verified that these symbols were exported by Fedora's installed library:

/lib64/libamdhip64.so

A minimal HIP program linked successfully when `-lamdhip64` was explicitly included.

## Working build command

The following command completed successfully on this machine:

make strix-halo -j"$(nproc)" \
ROCM_CFLAGS="-O3 -ffast-math -g -fno-finite-math-only -pthread -D__HIP_PLATFORM_AMD__ -Wno-unused-command-line-argument --offload-arch=gfx1151 -no-pie" \
ROCM_LDLIBS="-lm -pthread -lhipblas -lhipblaslt -lamdhip64"

It produced:

ds4
ds4-server
ds4-bench
ds4-eval
ds4-agent

The resulting `ds4` executable dynamically links the expected Fedora libraries:

libhipblas.so.3
libhipblaslt.so.1
libamdhip64.so.7

## Runtime validation

Model:

DeepSeek-V4-Flash-IQ2XXS-w2Q2K-AProjQ8-SExpQ8-OutQ8-chat-v2-imatrix.gguf
Size: 80.76 GiB

Test command:

./ds4 --rocm -m ./ds4flash.gguf --ctx 4096 \
--nothink --temp 0 --tokens 32 \
-p "Rispondi esattamente con: DS4 operativo"

Relevant output:

ds4: ROCm backend initialized on AMD Radeon 8060S Graphics (sm_115)
ds4: ROCm preparing model tensor mappings: 80.24 GiB
ds4: ROCm startup model preparation covered 80.76 GiB of tensor spans in 25.625s
ds4: memory: KV 0.39 GiB + buffers 0.03 GiB + resident model 80.76 GiB = 81.18 GiB planned
DS4 operativo
ds4: prefill: 3.58 t/s, generation: 8.73 t/s

## Question

Is this expected with Fedora's ROCm packages, or is there a package or build configuration step that I may have missed?

Possible fixes might include:

- linking `libamdhip64` explicitly for ROCm builds;
- adding `-no-pie` for affected toolchains;
- compiling the host C objects with `-fPIE`;
- or allowing `hipcc` to determine the necessary runtime linkage differently.

I would be happy to test a proposed patch or alternative build command on this machine.
Un abbraccio a tutti! <3

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.