Commit 017c3a785 for llama.cpp
commit 017c3a785bf2118947b3593f5f7696d4225f0306
Author: Marin Radic <mradic07@gmail.com>
Date: Fri Dec 4 13:17:44 2026 +0100
ggml-et : fix global barrier shire fan-out and pin counter to .data (#33478)
diff --git a/ggml/src/ggml-et/et-kernels/src/platform.h b/ggml/src/ggml-et/et-kernels/src/platform.h
index 2ea9592a3..1baeb0236 100644
--- a/ggml/src/ggml-et/et-kernels/src/platform.h
+++ b/ggml/src/ggml-et/et-kernels/src/platform.h
@@ -193,9 +193,8 @@ typedef enum {
// The counter lives in a cache-line-aligned global to avoid coherency problems
//******************************************************************************
-// Barrier counter cache-line aligned to avoid coherency problems
-// Must be zero-initialized (BSS).
-static uint32_t __attribute__((aligned(64))) et_global_barrier_count[64 / sizeof(uint32_t)] = { 0 };
+// Cache-line aligned barrier counter pinned to .data because crt.S does not zero .bss (NOLOAD).
+static uint32_t __attribute__((aligned(64), section(".data"))) et_global_barrier_count[64 / sizeof(uint32_t)] = { 0 };
// Cross-shire barrier: all harts in num_active_shires shires synchronize.
// Returns 1 if this hart was the globally-last to arrive, 0 otherwise.
@@ -217,14 +216,15 @@ static inline uint64_t __attribute__((always_inline)) et_barrier_global(uint64_t
uint32_t prev = et_global_add_w(et_global_barrier_count, 1);
if (prev == num_active_shires - 1) {
- // Last shire. reset counter and fan out FCC to all shires
+ // Last shire: reset counter and fan out FCC 1 to participating shires only.
+ // Master shire (32) firmware never drains FCC 1, so do not credit it unless included.
last_global = 1;
et_global_swap_w(et_global_barrier_count, 0);
- for (uint64_t sid = 0; sid < 33; sid++) {
- // Send FCC 1 credit to all harts (both threads) in each shire
- fcc_send(sid, THREAD_0, FCC_1, 0xFFFFFFFF);
- fcc_send(sid, THREAD_1, FCC_1, 0xFFFFFFFF);
+ for (uint64_t sid = 0; sid < num_active_shires; sid++) {
+ uint32_t mask = (sid == SHIRE_MASTER) ? 0xFFFF0000U : 0xFFFFFFFFU;
+ fcc_send(sid, THREAD_0, FCC_1, mask);
+ fcc_send(sid, THREAD_1, FCC_1, mask);
}
}
}