Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

DeepSeek drafter cumulative cut 0.5 by default on gfx1200/gfx1201 only (Model::gpus_are_gfx12); Strix Halo, other AMD and CUDA keep 0 until measured

Niko12213b64abf5e095
diff --git a/src/dsv41/ds4_main.cpp b/src/dsv41/ds4_main.cpp
index fdbd542e3..2c11b8761 100644
--- a/src/dsv41/ds4_main.cpp
+++ b/src/dsv41/ds4_main.cpp
@@ -152,21 +152,14 @@ static int g_round_nd = 0;
// The drafts' cut on the product of their confidences (DeepInfer's cumulative rule): a draft is verified while the chance
// that it and every draft before it are kept stays at least this - a long window whose later drafts are likely lost is
// not verified whole. STRATA_DS4_DSPARK_CUM=F, a request's dspark_cum key; 0: off, only the floor on each draft's own
-// confidence (dspark_conf). On AMD 0.5 is the default: measured on 4x R9700, DeepSeek 2.25 bpw, six 128-token
-// decodes an arm in one load - 71.7 -> 76.9 tok/s (medians), the same ids; Project Maya runs 0.5 on a Radeon 8065S
-// too (+6.5% decode, the same tokens), while the CUDA measurements in 0.2.7 had it flat, so CUDA keeps 0.
-// STRATA_DS4_DSPARK_CUM overrides either way.
-float dspark_cum_default() {
- static const float v = [] {
- const char* e = std::getenv("STRATA_DS4_DSPARK_CUM");
- if (e != nullptr) return (float) std::atof(e);
-#if defined(STRATA_USE_HIP)
- return 0.5f;
-#else
- return 0.0f;
-#endif
- }();
- return v;
+// confidence (dspark_conf). 0.5 is the default on gfx1200 / gfx1201 (RDNA4: R9700, RX 9000) only: measured on 4x R9700, DeepSeek 2.25 bpw,
+// six 128-token decodes an arm in one load - 71.7 -> 76.9 tok/s (medians), the same ids. Project Maya ran 0.5 on a Radeon 8065S (Strix Halo,
+// gfx1151: +6.5% decode, the same tokens), but that is a single datapoint on a box the 0.2.7 defaults have not been tested on, so
+// Strix keeps 0 until it is; the CUDA measurements in 0.2.7 had it flat, so CUDA keeps 0. STRATA_DS4_DSPARK_CUM overrides everywhere.
+float dspark_cum_default(const strata::ds4::Model& m) {
+ static const char* const e = std::getenv("STRATA_DS4_DSPARK_CUM");
+ if (e != nullptr) return (float) std::atof(e);
+ return m.gpus_are_gfx12() ? 0.5f : 0.0f;
}
// One round of decoding after `tok` (the token at pos(), not fed yet): with the drafter, its drafts while their
@@ -184,7 +177,7 @@ bool round(strata::ds4::Model& m, int tok, int room, bool spec, float conf_min,
g_round_conf = conf;
g_round_nd = (int) drafts.size();
int keep = 0;
- if (cum_min < 0) cum_min = dspark_cum_default();
+ if (cum_min < 0) cum_min = dspark_cum_default(m);
float cum = 1.0f;
while (keep < (int) drafts.size() && keep < room - 1 && conf[(size_t) keep] >= conf_min &&
(cum *= conf[(size_t) keep]) >= cum_min)
diff --git a/src/dsv41/ds4_model.cu b/src/dsv41/ds4_model.cu
index 8c3052ae8..0286e7165 100644
--- a/src/dsv41/ds4_model.cu
+++ b/src/dsv41/ds4_model.cu
@@ -811,6 +811,7 @@ struct Model::Impl {
std::vector<Group> groups;
std::vector<std::unique_ptr<Worker>> workers; // threads mode: one per device
bool par = false; // threads mode (the windows: decode)
+ mutable int all_gfx12 = -1; // gpus_are_gfx12(): -1 not asked yet
bool prompt_par = false; // the prompt path's chunks (a thread a GPU), as --tp / --threads asked
unsigned win_seq = 0; // the windows the threads ran (the hand-offs' seq)
// the chunked prompt path (threads mode): chunk tokens a pass, runs shorter than chunk_min in windows
@@ -9663,6 +9664,21 @@ void Model::set_images(std::vector<Image> images) {
p_->imgs = std::move(images);
}
int Model::draft_block() const { return p_->g.n_mtp > 0 ? p_->g.d_block : 0; }
+bool Model::gpus_are_gfx12() const {
+ if (p_->all_gfx12 < 0) {
+ bool yes = false;
+#if defined(STRATA_USE_HIP)
+ yes = !p_->devs.empty();
+ for (const auto& d : p_->devs) {
+ cudaDeviceProp prop{};
+ yes = yes && cudaGetDeviceProperties(&prop, d.id) == cudaSuccess &&
+ (std::strncmp(prop.gcnArchName, "gfx1200", 7) == 0 || std::strncmp(prop.gcnArchName, "gfx1201", 7) == 0);
+ }
+#endif
+ p_->all_gfx12 = yes ? 1 : 0;
+ }
+ return p_->all_gfx12 == 1;
+}
bool Model::draft(int y, std::vector<int>& d, std::vector<float>& c, std::string& err, float t, float tp, int tk,
float mp, uint64_t seed, uint64_t counter) {
return p_->draft(y, d, c, err, t, tp, tk, mp, seed, counter);
diff --git a/src/dsv41/ds4_model.hpp b/src/dsv41/ds4_model.hpp
index 9cac562c2..afa9d2a69 100644
--- a/src/dsv41/ds4_model.hpp
+++ b/src/dsv41/ds4_model.hpp
@@ -129,6 +129,8 @@ public:
/// DeepSeek's reference does. verify() keeps a draft d with probability min(1, p(d) / q(d)) over the request's
/// chain - the speculative-sampling rule, so every token is still distributed as the model's own draw.
int draft_block() const;
+ /// every GPU the engine uses is a gfx1200 / gfx1201 (RDNA4: R9700, RX 9000) in a HIP build, false anywhere else (decided once)
+ bool gpus_are_gfx12() const;
bool draft(int y, std::vector<int>& drafts, std::vector<float>& conf, std::string& err, float temperature = 0.0f,
float top_p = 1.0f, int top_k = 0, float min_p = 0.0f, uint64_t seed = 0, uint64_t counter = 0);
bool verify(int y, const std::vector<int>& drafts, float temperature, float top_p, int top_k, float min_p,