Per-I/O-thread OpenMP teams: thread count grows with requests, requests rotate across cold teams

Đang mở
#961 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 1 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
25/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, linux
Lĩnh vực
backend, performance

Hướng nghiên cứu

Start by reading server/server.hpp for io_threads_ and main.cpp for the I/O thread setting, then reproduce the reported thread-count growth by checking /proc/<pid>/task after requests. Compare affected models and builds, including Windows behavior, and inspect related issue #882. Done means the cause is reproduced and a bounded threading fix is established; the issue lists several possible directions but does not choose one.

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

Mô tả

Summary

Each server I/O thread that runs an OpenMP region (prefill/decode CPU work) becomes its own libgomp master and builds its own team of workers. libgomp keeps these teams for the life of the process, so the thread count grows as requests land on I/O threads that haven't run OpenMP work yet, until every I/O thread has its own team. Requests then rotate across teams.

This is a bounded one-time cost, not an unbounded leak, but it costs memory, cold-start latency and CPU.

Observations

  • Observed in a prefill profiling run (not yet re-verified in a clean setup): threads went 46 -> 79 after 4 requests (+33, about 3 teams of 11 workers).
  • FLM does not start a thread per request. The server has a fixed I/O pool (server/server.hpp io_threads_; main.cpp calls set_io_threads(10), server default is 5). The growth tracks distinct I/O threads that have run OpenMP work.
  • Earlier measurement on d3 (see #882): ~122 threads with 10 I/O threads, requests rotating across cold teams cost +10-16% latency. With one I/O thread (a single team) latency was 86 ms vs 92-100 ms.
  • OMP_PROC_BIND=true OMP_PLACES=cores saved about 20 ms at 1k tokens in the profiling run (single measurement, not repeated).

Possible directions

  1. Run all OpenMP work from one master thread (or set_io_threads(1) for the compute path).
  2. Process-wide worker pool with bounded spin then sleep, instead of per-master OpenMP teams. A prototype for d3 exists (d3_par.hpp, spin 30 us then sleep): single-master 11.6 -> 4.6 busy cores at the same latency.
  3. Set a sane default for bind/places and GOMP_SPINCOUNT / wait policy.

The fix belongs on the FLM side (server threading / CPU worker pool), not in an individual model engine.

To do

  • Reproduce cleanly: ls /proc/<pid>/task | wc -l after each of N requests, plateau expected near io_threads x (workers+1).
  • Confirm which models/builds are affected, and check Windows (vcomp behaves differently).

Related: #882

Ngôn ngữ chính
C++
Star
2.1k
Fork
184
Merge trung bình
12 giờ 22 phút
Pull request đã merge (30 ngày)
239

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

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 ROCm/FastFlowLM

Tất cả issue của ROCm/FastFlowLM

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.