[GH-ISSUE #5101] [Engine] ExpertSource::prefetch has two overloads and each source overrides one, so the other call form is a silent no-op (#611-D) #2380

Open
opened 2026-11-04 01:58:50 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @ackalker on GitHub (Nov 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5101

Area

Engine

Desktop app, Terminal or source?

Source (START-HERE.bat, setup.sh or a build) — a build from ./update.sh

What happened

ExpertSource has two prefetch overloads, and each of the two real sources overrides only one of them. nvcc says so
four times a build:

/home/miki/Projects/git/Strata/include/strata/core/expert_source.hpp(710): warning #611-D: overloaded virtual function "strata::core::ExpertSource::prefetch" is only partially overridden in class "strata::core::FileExpertSource"
/home/miki/Projects/git/Strata/include/strata/core/expert_source.hpp(1261): warning #611-D: overloaded virtual function "strata::core::ExpertSource::prefetch" is only partially overridden in class "strata::core::ArenaExpertSource"

Reading it, both sides look like they miss the other half:

  • the base: include/strata/core/expert_source.hpp:226 virtual void prefetch(int64_t layer, int64_t expert) — body
    is a (void) no-op; and include/strata/core/expert_source.hpp:262
    virtual void prefetch(int64_t layer, const int64_t* experts, int64_t n) — also a no-op.
    prefetch_begin's default (:268-269) delegates to the batch form.
  • FileExpertSource (:710) overrides only the batch one (:929, implemented at src/core/expert_source.cpp:2140).
  • ArenaExpertSource (:1261) overrides only the single-expert one (:1288, implemented at
    src/core/expert_source.cpp:6254, an madvise(..., MADV_WILLNEED)).

Which call sites then land on the base no-op:

  • The single-expert form is called from the expert-arena / adaptive-swap code:
    src/program/generate.cpp:9104, :12585, :12600, :12984, :19919 — for example
    :12600 srcp->prefetch(s.layer, s.out); // a file-backed arena released its pages: read them back ahead.
    srcp is &src when the file source is on (src/program/generate.cpp:6989 declares
    strata::core::FileExpertSource src;, :7203 srcp = &src;) or &arena_src when the arena is on (:7065 declares
    strata::core::ArenaExpertSource arena_src;, :7387 srcp = &arena_src;). So with the file source those five
    calls do nothing.
  • The batch form is called from the CPU dispatch: src/core/expert_source.cpp:5122
    d.src->prefetch(d.layers, miss.data(), (int64_t) miss.size()); (CS-T, d.cold_mode == 0), with drive.d.src = srcp
    at src/program/generate.cpp:8448. So with the arena source that call, and prefetch_begin's default at
    :268-269, do nothing.

Smallest steps or command that reproduce it

The warning appears in the CUDA pass of the engine build:

./update.sh           # or: cmake --build build --target strata -j 16 | grep '#611-D'

The call-site reading above is from the source at ffa80d73.

Reproduction status

Unconfirmed static analysis. I read the code and the compiler warning; I did not see a runtime failure and I
measured no timing difference (no A/B of a decode with and without the missing read-ahead). It may be that the
no-op path is deliberate, or that the file source's own read-ahead elsewhere covers those five call sites — I did not
check that.

Suggested smallest fix

One line per class, delegating to the half that exists, and #611-D goes away:

// FileExpertSource
void prefetch(int64_t layer, int64_t expert) override { prefetch(layer, &expert, 1); }
// ArenaExpertSource
void prefetch(int64_t layer, const int64_t* experts, int64_t n) override {
    for (int64_t i = 0; i < n; ++i) prefetch(layer, experts[i]);
}

If a no-op is intended for one of them, override on the missing overload with a one-line comment saying so would
also silence the warning and make the intent readable.

Strata version

Strata 0.2.10 · engine 0.1.56 · source checkout at ffa80d73

Graphics card, memory and system

RTX 5080 16 GB · 96 GB RAM · Linux (Arch), gcc 16.2.1, CMake 4.4.3, ninja 1.13.2, CUDA/nvcc 13.4
(-DSTRATA_ENABLE_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=120)

Originally created by @ackalker on GitHub (Nov 3, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/5101 ### Area Engine ### Desktop app, Terminal or source? Source (START-HERE.bat, setup.sh or a build) — a build from `./update.sh` ### What happened `ExpertSource` has two `prefetch` overloads, and each of the two real sources overrides only one of them. nvcc says so four times a build: ``` /home/miki/Projects/git/Strata/include/strata/core/expert_source.hpp(710): warning #611-D: overloaded virtual function "strata::core::ExpertSource::prefetch" is only partially overridden in class "strata::core::FileExpertSource" /home/miki/Projects/git/Strata/include/strata/core/expert_source.hpp(1261): warning #611-D: overloaded virtual function "strata::core::ExpertSource::prefetch" is only partially overridden in class "strata::core::ArenaExpertSource" ``` Reading it, both sides look like they miss the other half: - the base: `include/strata/core/expert_source.hpp:226` `virtual void prefetch(int64_t layer, int64_t expert)` — body is a `(void)` no-op; and `include/strata/core/expert_source.hpp:262` `virtual void prefetch(int64_t layer, const int64_t* experts, int64_t n)` — also a no-op. `prefetch_begin`'s default (`:268-269`) delegates to the batch form. - `FileExpertSource` (`:710`) overrides only the batch one (`:929`, implemented at `src/core/expert_source.cpp:2140`). - `ArenaExpertSource` (`:1261`) overrides only the single-expert one (`:1288`, implemented at `src/core/expert_source.cpp:6254`, an `madvise(..., MADV_WILLNEED)`). Which call sites then land on the base no-op: - The single-expert form is called from the expert-arena / adaptive-swap code: `src/program/generate.cpp:9104`, `:12585`, `:12600`, `:12984`, `:19919` — for example `:12600` `srcp->prefetch(s.layer, s.out); // a file-backed arena released its pages: read them back ahead`. `srcp` is `&src` when the file source is on (`src/program/generate.cpp:6989` declares `strata::core::FileExpertSource src;`, `:7203` `srcp = &src;`) or `&arena_src` when the arena is on (`:7065` declares `strata::core::ArenaExpertSource arena_src;`, `:7387` `srcp = &arena_src;`). So with the **file** source those five calls do nothing. - The batch form is called from the CPU dispatch: `src/core/expert_source.cpp:5122` `d.src->prefetch(d.layers, miss.data(), (int64_t) miss.size());` (CS-T, `d.cold_mode == 0`), with `drive.d.src = srcp` at `src/program/generate.cpp:8448`. So with the **arena** source that call, and `prefetch_begin`'s default at `:268-269`, do nothing. ### Smallest steps or command that reproduce it The warning appears in the CUDA pass of the engine build: ```sh ./update.sh # or: cmake --build build --target strata -j 16 | grep '#611-D' ``` The call-site reading above is from the source at `ffa80d73`. ### Reproduction status **Unconfirmed static analysis.** I read the code and the compiler warning; I did not see a runtime failure and I measured no timing difference (no A/B of a decode with and without the missing read-ahead). It may be that the no-op path is deliberate, or that the file source's own read-ahead elsewhere covers those five call sites — I did not check that. ### Suggested smallest fix One line per class, delegating to the half that exists, and `#611-D` goes away: ```cpp // FileExpertSource void prefetch(int64_t layer, int64_t expert) override { prefetch(layer, &expert, 1); } // ArenaExpertSource void prefetch(int64_t layer, const int64_t* experts, int64_t n) override { for (int64_t i = 0; i < n; ++i) prefetch(layer, experts[i]); } ``` If a no-op is intended for one of them, `override` on the missing overload with a one-line comment saying so would also silence the warning and make the intent readable. ### Strata version Strata 0.2.10 · engine 0.1.56 · source checkout at `ffa80d73` ### Graphics card, memory and system RTX 5080 16 GB · 96 GB RAM · Linux (Arch), gcc 16.2.1, CMake 4.4.3, ninja 1.13.2, CUDA/nvcc 13.4 (`-DSTRATA_ENABLE_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=120`)
Author
Owner

@github-actions[bot] commented on GitHub (Nov 3, 2026):

Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:

  • Fill in "Area".
  • Fill in "Desktop app, Terminal or source?".

Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

Details: CONTRIBUTING.md

<!-- gh-comment-id:6603498789 --> @github-actions[bot] commented on GitHub (Nov 3, 2026): Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing: - [ ] Fill in "Area". - [ ] Fill in "Desktop app, Terminal or source?". Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment `/reopen`. Details: [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md)
Author
Owner

@github-actions[bot] commented on GitHub (Nov 3, 2026):

Thanks, this follows the format now.

<!-- gh-comment-id:6603722254 --> @github-actions[bot] commented on GitHub (Nov 3, 2026): Thanks, this follows the format now.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2380
No description provided.