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++

SetArgs: the Metal fields exist only in Metal builds (the CUDA/HIP kernels take the struct by value)

Niko12218f7d53ccd589
diff --git a/include/strata/dsv41/exl3.hpp b/include/strata/dsv41/exl3.hpp
index a140fceed..f11176de1 100644
--- a/include/strata/dsv41/exl3.hpp
+++ b/include/strata/dsv41/exl3.hpp
@@ -158,9 +158,10 @@ struct SetArgs {
// their shared-memory tile anyway, so the same values come out; this only saves the F32 read of the same rows by
// every column block of an expert (18-36 reads of 1.8-3.7 MB on a prompt) - MarLin's "small operand cheap".
const uint16_t* x16 = nullptr;
- // (Metal, last so that the CUDA / HIP layout is what it was)
+#if defined(STRATA_METAL) // (only on Metal: keeps the CUDA / HIP struct as it was)
const int* hbounds = nullptr; // the same bounds on the host: [n_exp + 1], absolute rows
int total_rows = 0; // the set's rows in all
+#endif
};
/// h[local row] = FP16 clamped swiglu of gate and up over x[row_idx[local row]] (F32 rows, ldx floats apart).
void set_gate_up(const SetArgs& a, const float* x, int ldx, const int* row_idx, uint16_t* h16, int ldh, cudaStream_t s);
diff --git a/src/dsv41/ds4_gguf.cu b/src/dsv41/ds4_gguf.cu
index 24a72234f..8e1d605be 100644
--- a/src/dsv41/ds4_gguf.cu
+++ b/src/dsv41/ds4_gguf.cu
@@ -1563,8 +1563,10 @@ iq::SetArgs iq_set(const x3::SetArgs& sa) { // a set as ds4_iq's arguments (th
q.n_ff = sa.n_ff;
q.limit = sa.limit;
q.xf16 = sa.x16;
+#if defined(STRATA_METAL)
q.hbounds = sa.hbounds;
q.total_rows = sa.total_rows;
+#endif
return q;
}
} // namespace
diff --git a/src/dsv41/ds4_iq.cuh b/src/dsv41/ds4_iq.cuh
index 1712ad673..6a22576ab 100644
--- a/src/dsv41/ds4_iq.cuh
+++ b/src/dsv41/ds4_iq.cuh
@@ -95,9 +95,10 @@ struct SetArgs {
int ldo = 0;
int tg = 0, td = 0;
int skip_le = 0; // (the tiles) the experts of at most this many rows are left out: the light kernels took them
- // (Metal, after the CUDA / HIP fields so that their kernels' parameter layout is exactly what it was)
+#if defined(STRATA_METAL) // (only on Metal: the CUDA and HIP kernels take this struct by value, so its size is part of their ABI)
const int* hbounds = nullptr; // the bounds on the host: [n_exp + 1], absolute rows
int total_rows = 0; // the set's rows in all
+#endif
};
bool set_gate_up(const SetArgs& a, cudaStream_t s);
bool set_down(const SetArgs& a, cudaStream_t s);
diff --git a/src/dsv41/ds4_model.cu b/src/dsv41/ds4_model.cu
index b0f99d0fb..4767969dd 100644
--- a/src/dsv41/ds4_model.cu
+++ b/src/dsv41/ds4_model.cu
@@ -3993,8 +3993,10 @@ struct Model::Impl {
sa.bounds = d_bounds + i0;
sa.row0 = a;
sa.max_rows = max_rows;
+#if defined(STRATA_METAL)
sa.hbounds = b + i0;
sa.total_rows = nrows;
+#endif
sa.n_embd = D;
sa.n_ff = FF;
sa.limit = g.lim;