[Engine] strata-ink2: wrong logits in about 1 of 10 runs with the decode graph and the expert offload together (HIP, Windows)

Đang mở
#7,333 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 4 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp
Lĩnh vực
backend, performance

Hướng nghiên cứu

Start with scripts/tokpath_repeat.sh and the logs token_path_hunt.txt and token_path_probe.txt to reproduce and inspect the failing decode runs. Compare decode graph plus expert offload against each mode disabled, then investigate the issue’s suspected table or pool data visibility across kernels and the named HIP graph switches. Done when repeated runs no longer produce incorrect logits with both features enabled.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

On an RX 7900 XTX (Windows 11, ROCm 10.2.0), strata-ink2 from feat/inkling2 (bb137fd8, plus the Windows build fix in baptisterajaut/Strata#17) sometimes gives wrong logits on the decode path. When it happens, the run is wrong from the first token on: KL 0.03 against a normal run at token 0, and top-1 agreement 8% over 100 tokens. The values stay finite, and the engine log looks exactly like a good run's.

How I see it

--kv i8r --tc 1 --vram-reserve-mib 1500 --chunk 0, 100 tokens, --dump-logits, compared byte for byte with a normal run (99% of the experts on the card):

decode graph expert offload runs wrong
on on 29 3
off (--graph 0) on 40 0
on off (no --vram-reserve-mib) 40 0

Both "off" modes give logits byte-identical to a normal run. The prompt path (--chunk 512) matched in 11 of 11 runs. So it seems to need the decode graph and the offload together. I haven't found the mechanism.

Ruled out: upload_embed copies the embedding with cudaMemcpyAsync from a vector that is freed right after, and HIP can read it late. That is a real race (fixed in baptisterajaut/Strata#23), but a build with that fix also gave a wrong run.

A guess, not checked: with the offload, k_cache_plan rewrites the expert tables (tabA / tabB) and k_fetch fills pool slots during the token, and the GEMVs read them in the next kernels. If HIP's optimized graph path launched those kernels without invalidating the per-CU caches, a GEMV could read a stale table entry or stale slot data. The runtime has switches I didn't try: DEBUG_HIP_GRAPH_CLASSIC_PATH, DEBUG_CLR_AQL_BARRIER_OPT.

Workaround: --graph 0. In this 100-token test it cost nothing measurable (1,158 ms median per 100 tokens, about 1,160 with the graph). I didn't measure it at long contexts.

Logs: token_path_hunt.txt and token_path_probe.txt; script: scripts/tokpath_repeat.sh. Not tested: Linux, CUDA, other cards.

Ngôn ngữ chính
C++
Star
11.6k
Fork
1k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Niko1221/Strata

Tất cả issue của Niko1221/Strata

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.