HIP: the packed Q6_K heads (opt-in STRATA_Q6_PACKED=1), bitwise
The main output head (248320 x 2560) and the MTP draft head (its 106299-row subset) are Q6_K: 210-byte blocks, so every int load is 2-byte aligned. STRATA_Q6_PACKED=1 builds a packed copy of each at load - the same bytes as ql / qh / scales / d planes (+497 MiB, +213 MiB) - and native_q6_k_mmvq on a registered pointer runs native_q6_k_packed_kernel: aligned non-temporal dword loads, 640 persistent workgroups, and the thread ownership, q6_q8_dot_impl expression, accumulation order and reduction of native_q6_k_mmvq_kernel<false> / native_mmvq_multi_kernel<Q6KTraits, NC, 4, 1>, so every output is bitwise equal (exact multi-column layout only). STRATA_Q6P_SELFTEST=1 checks it at load (1-4 columns, memcmp) and times it paired; =2 also sweeps the grid. gfx1151 load-time self-test (11 paired samples, medians): main head 1 column 2420 -> 2300 us, 2 columns 2563 -> 2455, 4 columns 2973 -> 2975 (no gain: not bandwidth-bound there); draft head 1 column 1319-1351 -> 946-961 us, 2 columns 1420-1459 -> 1064-1090, 4 columns 1629-1678 -> 1320-1365. Outputs bitwise equal. Grid 320-20480 flat.
This commit is contained in:
1 parent
be7889ed84
commit
5cf0079bcc
4 files changed
+261
-1
No files matched your search
@@ -12,6 +12,7 @@
|
||||
namespace strata::core {
|
||||
|
||||
NativeHead::~NativeHead() {
|
||||
if (weights_) strata::kernels::native_q6_k_unpack(weights_);
|
||||
if (scratch_) cudaFree(scratch_);
|
||||
if (weights_) cudaFree(weights_);
|
||||
}
|
||||
@@ -61,6 +62,8 @@ bool NativeHead::load(const std::vector<std::string>& shards, int64_t n_in, int6
|
||||
n_in_ = (int) n_in;
|
||||
n_out_ = (int) n_out;
|
||||
type_ = (int) tensor->type;
|
||||
if (type_ == 14 && strata::kernels::native_q6_k_packed_enabled()) // STRATA_Q6_PACKED=1
|
||||
strata::kernels::native_q6_k_pack(weights_, n_in_, n_out_, "output head");
|
||||
return true;
|
||||
} catch (const std::exception& error) {
|
||||
err = std::string("native head: ") + error.what();
|
||||
|
||||
Reference in new issue
Block a user