mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-04 15:28:40 +00:00
HIP: verify-window routing for non-native routers (256 experts) on every HIP card
This commit is contained in:
1 parent
70813d5b83
commit
51d8370a86
1 file changed
+21
-6
+21
-6
@@ -201,6 +201,21 @@ inline int g_side_mixer() {
|
||||
return per_dev[dev] - 1;
|
||||
#endif
|
||||
}
|
||||
// The verify window's non-native router in one launch pair per layer (moe_route_window) instead of a pair per
|
||||
// token. On by default on HIP (gfx906 before; every HIP card now - bitwise on gfx1201 by route_window_parity and
|
||||
// the decode's output); STRATA_ROUTE_WIN=0 turns it off. CUDA: opt-in (STRATA_ROUTE_WIN=1), not measured there yet.
|
||||
inline bool route_window_on() {
|
||||
static const bool on = [] {
|
||||
const char* v = std::getenv("STRATA_ROUTE_WIN");
|
||||
#if defined(STRATA_USE_HIP) || defined(STRATA_HIP_GFX906)
|
||||
return v == nullptr || v[0] != '0';
|
||||
#else
|
||||
return v != nullptr && v[0] == '1';
|
||||
#endif
|
||||
}();
|
||||
return on;
|
||||
}
|
||||
|
||||
inline bool g_qfuse() { static const bool on = [] { const char* v = std::getenv("STRATA_QFUSE"); return v != nullptr && std::atoi(v) != 0; }(); return on; }
|
||||
#define VDBG(...) do { if (g_dbg) { std::fprintf(stderr, "verify dbg: " __VA_ARGS__); std::fflush(stderr); } } while (0)
|
||||
|
||||
@@ -1865,15 +1880,15 @@ bool Verifier::record_window(int T, cudaStream_t cs, std::string& err) {
|
||||
NE, n, cs);
|
||||
native_router_top10_multi(logits_ + tb * NE, ids_ + tb * K, w_ + tb * K, n, cs);
|
||||
} catch (const std::exception& e) { err = "verify router: " + std::string(e.what()); return false; }
|
||||
#if defined(STRATA_HIP_GFX906)
|
||||
} else if (dec_batch) {
|
||||
// gfx906: the Coder's 256-expert router (the native router is 512 x 10 only) for the whole window in one
|
||||
// multi-column BF16 projection and one top-k, bitwise the per-token calls (route_window_parity); ~3 ms
|
||||
// of a ~55 ms verify window on 2x MI50. STRATA_ROUTE_PER_TOKEN=1: the per-token calls.
|
||||
} else if (dec_batch && route_window_on()) {
|
||||
// a router the native one does not take (it is 512 x 10 only: the Coder's 256 experts) for the whole
|
||||
// window in one multi-column BF16 projection and one top-k, bitwise the per-token calls
|
||||
// (route_window_parity). gfx906: ~3 ms of a ~55 ms verify window on 2x MI50; gfx1201 (R9700, Coder
|
||||
// IQ1_M, --spec 4): the routing 3.34 -> 1.39 ms a window, decode +9%. STRATA_ROUTE_PER_TOKEN=1 or
|
||||
// STRATA_ROUTE_WIN=0: the per-token calls.
|
||||
if (!moe_route_window(wt, g, l, K, ss.moe, mixed_ + tb * N, logits_ + tb * NE, ids_ + tb * K, w_ + tb * K, n,
|
||||
cs, err))
|
||||
return false;
|
||||
#endif
|
||||
} else
|
||||
for (int t = tb; t < te; ++t) {
|
||||
MoEBuffers mb = ss.moe;
|
||||
|
||||
Reference in new issue
Block a user