Skip to content

[Issue]: HRX preview (v1.0.8, Linux): flm bench gemma4-it:e2b fails at 32k with 'ert state 8'; XRT completes, serve works #785

Open

Description

@mariolpantunes

Summary

With the v1.0.8 HRX preview package on Linux, flm bench gemma4-it:e2b aborts in its first stage (32k context) on a Ryzen AI 7 PRO 350 (Krackan Point, XDNA2).
Every dispatch fails with amdxdna dispatch did not complete: ert state 8, and the run ends with hrx_buffer_allocate failed.
The same bench with the standard XRT package completes all 6 stages on the same machine, same container image, same weights.
HRX otherwise works here: flm validate passes and flm serve with the same model handles a 31,242-token prompt without errors.
So the failure looks specific to the flm bench path (or its 32k stage), not to HRX in general.

Environment

Laptop Lenovo ThinkPad T14s Gen 6 (21TBCTO1WW), BIOS R33ET31W (1.14)
CPU / iGPU AMD Ryzen AI 7 PRO 350, 8C/16T, Radeon 860M
RAM 30 GiB
NPU 1022:17f0 rev 0x20 (Strix/Krackan/Strix Halo NPU), aie2p, 8 columns
NPU firmware 1.1.2.64
Host OS / kernel Slackware 15.0 -current, Linux 7.2.10, in-tree amdxdna ("amdxdna version: 0.10" in flm validate)
Module params present aie2_max_col, force_cmdlist, force_iova, tdr_timeout_ms (values not readable as non-root)
Container Docker 29.3.0, ubuntu:26.04, --device /dev/accel/accel0 --ulimit memlock=-1 --ipc host
FLM v1.0.8; HRX: HRX_fastflowlm_1.0.8_linux.tar.gz (bare Ubuntu, no extra packages); XRT: fastflowlm_1.0.8_ubuntu26.04_amd64.deb (system libxrt2/libxrt-npu2 from the Ubuntu archive)
Model gemma4-it:e2b (Gemma4-E2B-IT-NPU2), pulled with v1.0.8

flm validate output (HRX package, container): kernel 7.2.10, NPU /dev/accel/accel0 with 8 columns, FW 1.1.2.64, amdxdna 0.10, memlock infinity, platform aie2p.

Reproduce

docker run --rm --device /dev/accel/accel0 --ulimit memlock=-1 --ipc host \
  -v <HRX_tree>:/opt/flm:ro -v <models>:/app/models:ro -v $PWD/out:/out -w /out \
  -e FLM_MODEL_PATH=/app/models -e FLM_DISABLE_UPDATE_CHECK=1 \
  ubuntu:26.04 /opt/flm/flm bench gemma4-it:e2b --pmode performance --bench-iterations 2

Result on HRX (invalid)

Reproduced twice with identical output. Log, with the repeated line collapsed:

[FLM]  Starting benchmark with 6 stages...
[FLM]  Starting benchmark for 32k and iteration 1...
[hrx][ERROR] run::wait hrx_stream_wait: .../amdxdna/native_linux_kmq.cc:1140: INTERNAL; amdxdna dispatch did not complete: ert state 8   (x515)
[FLM]  Creating checkpoint at context length 31017
[FLM]  	TTFT: 11.7753s, Prefill Speed: 2649.89 tokens/s, Decoding Speed: 253.331 tokens/s
[FLM]  Starting benchmark for 16k and iteration 1...
[hrx][ERROR] ... ert state 8
[FLM]  Failed to allocate hrx::ext::bo: hrx::ext::bo: hrx_buffer_allocate failed
Error: Failed to allocate hrx::ext::bo: hrx::ext::bo: hrx_buffer_allocate failed

The "TTFT 11.8 s / 2650 tok/s" line should not be trusted: the dispatches had failed, and the model output is <unusedNN> tokens.
The process exits after the 16k stage starts, so no result table is produced.

Valid results on the same machine

XRT, flm bench gemma4-it:e2b --pmode performance --bench-iterations 2 (completes)

Context TTFT (s) Prefill (tok/s) Decode (tok/s)
1k 1.623 ± 0.008 603.57 ± 3.01 23.54 ± 0.01
2k 2.494 ± 0.009 781.56 ± 2.86 22.59 ± 0.05
4k 4.542 ± 0.051 856.43 ± 9.58 21.14 ± 0.05
8k 9.136 ± 0.116 850.32 ± 10.72 18.70 ± 0.04
16k 20.697 ± 0.237 749.98 ± 8.56 15.02 ± 0.01
32k 41.140 ± 0.027 754.40 ± 0.37 10.79 ± 0.02

XRT vs HRX through flm serve gemma4-it:e2b --ctx-len 32768 --pmode performance (both complete, HRX has no dispatch errors)

One request per length, max_tokens=16, temperature=0, numbers from the response usage block:

Prompt tokens XRT TTFT (s) HRX TTFT (s) XRT prefill (tok/s) HRX prefill (tok/s) XRT decode (tok/s) HRX decode (tok/s)
3,487 3.79 3.96 920.8 880.4 21.8 22.1
10,648 14.38 15.60 740.5 682.7 17.4 16.7
21,736 35.13 34.61 618.7 628.0 13.1 13.1
31,242 63.29 58.48 493.6 534.2 10.8 10.8

gemma4-it:12b, flm serve --ctx-len 8192, 24-token prompt, 200 generated tokens, 3 runs each: decode XRT 6.12 / 6.04 / 5.87 tok/s, HRX 6.04 / 5.31 / 5.62 tok/s; TTFT XRT 1.69-1.86 s, HRX 1.85-2.18 s.

Single runs, so roughly ±5% noise. HRX is at parity with XRT in serve mode on this machine.

Questions

  1. Is flm bench on HRX known to fail at 32k? ert state 8 looks like a command timeout; could a single large dispatch in the bench path exceed the amdxdna TDR timeout, while serve chunks the prefill differently?
  2. Is there a recommended tdr_timeout_ms (or other amdxdna module parameter) for the HRX path?
  3. Is --prefill-chunk-len honoured by flm bench? I did not try changing it.

Happy to run more tests (other models, --prefill-chunk-len, smaller contexts) and attach full logs.

Activity

  1. jtuyls commented on Oct 21, 2026

    @jtuyls
    Collaborator

    @mariolpantunes Thanks for reporting!

    I reproduced the reported failure and traced it to the interaction between valid long-running 32k commands and amdxdna’s default two-second TDR.

    Reproduction results

    Test environment:

    • Ubuntu 26.04 container
    • Linux 7.2.10
    • amdxdna 0.10
    • NPU firmware 1.1.2.64
    • gemma4-it:e2b
    • FastFlowLM HRX v1.0.8 and v1.0.9

    With the default tdr_timeout_ms=2000:

    • HRX v1.0.8 reproduces the reported ERT state-8 errors at 32k.
    • Repeated context resets eventually cause the later hrx_buffer_allocate failed.
    • HRX v1.0.9 still receives seven state-8 errors per 32k iteration.
    • v1.0.9 reports those errors and keeps the runtime usable, but FastFlowLM continues the benchmark and exits 0 with invalid 32k metrics.
    • XRT also receives state 8 for the same seven commands. It only appears to pass because it does not validate the final ERT packet state.

    With tdr_timeout_ms=10000, the unchanged benchmark completes on both HRX v1.0.8 and v1.0.9 without state errors or allocation failures.

    Issues identified

    1. The two-second amdxdna TDR rejects valid 32k work

    At 32k, seven NPU commands run longer than the current watchdog permits.

    Observed timings:

    • Default TDR: commands are reset after approximately 2.02–2.07 seconds.
    • HRX with a ten-second TDR: the same commands complete in approximately 3.297 seconds.
    • XRT waits approximately 2.01–2.07 seconds, but the resulting ERT packets still contain state 8 with the default TDR.

    This is therefore not exclusively an HRX failure. XRT encounters the same command aborts but does not report them.

    Selecting a new global timeout or redesigning progress detection requires coordination with the amdxdna maintainers.

    2. HRX omits the instruction BO dependency

    HRX Linux submissions omit the instruction/control BO from the EXEC_CMD dependency list.

    Registering that dependency reduces each affected HRX command from approximately 3.297 seconds to 2.02–2.06 seconds, matching XRT much more closely.

    This is a separate HRX performance and residency defect. It should be fixed independently, but it does not fully resolve the issue because the commands still narrowly exceed the current two-second watchdog. I will be working on that fix in any case.

    3. Failed commands are reported as successful benchmark results

    HRX already detects state 8 and returns an error to its caller. Keeping the runtime usable after a command-scoped failure is appropriate, but the failed operation itself must not be treated as successful.

    FastFlowLM currently logs the HRX error, continues the benchmark, publishes invalid metrics, and exits 0.

    The expected behavior is:

    • A benchmark should stop the failed iteration/run and exit nonzero.
    • A server should fail the affected request while keeping the server available.
    • XRT should validate the final ERT packet state and propagate state 8 in the same way.

    This error-handling correction is separate from making the 32k operation succeed. The amdxdna TDR and HRX BO-dependency fixes address execution; honoring the returned error prevents false-success results.

    4. Why serve succeeds

    serve configures a 4096-token maximum prefill length and chunks long prompts.

    bench exercises a monolithic 32k prefill, which reaches the long-running commands that trigger the watchdog.

    Exact reproduction

    First confirm the environment:

    uname -r
    flm validate
    sudo cat /sys/module/amdxdna/parameters/tdr_timeout_ms

    The failing environment should report:

    • Linux 7.2.10
    • amdxdna 0.10
    • firmware 1.1.2.64
    • unlimited memlock
    • tdr_timeout_ms=2000

    Reset the driver to the default two-second TDR:

    sudo modprobe -r amdxdna
    sudo modprobe amdxdna tdr_timeout_ms=2000

    Ensure no other NPU workloads are active before unloading the module.

    Set the extracted FastFlowLM package and model-cache locations:

    FLM_PACKAGE=/path/to/extracted/fastflowlm
    MODEL_CACHE=/path/to/model-cache
    OUTPUT_DIR="$PWD/flm-785-output"
    
    mkdir -p "$OUTPUT_DIR"

    Run the benchmark inside Ubuntu 26.04:

    docker run --rm \
      --device /dev/accel/accel0 \
      --ulimit memlock=-1:-1 \
      --ipc host \
      -v "$FLM_PACKAGE:/opt/flm:ro" \
      -v "$MODEL_CACHE:/app/models:ro" \
      -v "$OUTPUT_DIR:/out" \
      -w /out \
      -e FLM_MODEL_PATH=/app/models \
      -e FLM_DISABLE_UPDATE_CHECK=1 \
      ubuntu:26.04 \
      /opt/flm/flm bench gemma4-it:e2b \
        --pmode performance \
        --bench-iterations 2

    To verify the TDR diagnosis, reload amdxdna with a longer timeout:

    sudo modprobe -r amdxdna
    sudo modprobe amdxdna tdr_timeout_ms=10000
    sudo cat /sys/module/amdxdna/parameters/tdr_timeout_ms

    Re-run the identical Docker command. The benchmark should then complete without ERT state errors or allocation failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions