Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions ggml/src/ggml-spacemit/ime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,14 @@ template <typename BLOC_TYPE, int64_t INTER_SIZE, int64_t NB_COLS> class tensor_

bool pad8_all = false;
if constexpr (std::is_same_v<BLOC_TYPE, block_q4_0> && INTER_SIZE == 256) {
pad8_all = ids->ne[1] > 1 && quantize_a_i8_r4 != nullptr && ne01 % 32 == 0 && hp_aligned();
// Skip M8 tail padding for the validated K=2048, N=512 projection
// with broadcast activations and 2-4 tokens. Full M8 groups remain
// eligible. Wider projections retain their existing padding policy.
const bool small_token_batch = ids->ne[1] >= 2 && ids->ne[1] <= 4;
const bool narrow_broadcast_shape = ne00 == 2048 && ne01 == 512 && ne11 == 1;
const bool skip_m8_tail_padding = small_token_batch && narrow_broadcast_shape;
pad8_all = ids->ne[1] > 1 && quantize_a_i8_r4 != nullptr && ne01 % 32 == 0 && hp_aligned() &&
!skip_m8_tail_padding;
}

if (!pad8_all && ne11 == 1) {
Expand Down Expand Up @@ -1860,10 +1867,6 @@ class tensor_traits_f16 : public ggml::spacemit::tensor_traits_base {
const int ith = ctx.ith;
const int nth = ctx.nth;

if (ith == 0 && getenv("GGML_SPACEMIT_Q41_TRACE") != nullptr) {
fprintf(stderr, "q41_mul_mat: N=%zu M=%zu K=%zu (%s)\n", N, M, K, M == 1 ? "decode" : "prefill");
}

const size_t out_row_stride = dst->nb[1]; // bytes

constexpr size_t m_tile = F16_M_TILE;
Expand Down
Loading