Skip to content

Commit fb9d03b

Browse files
committed
Derive GOLDEN_STEP from f64::consts::GOLDEN_RATIO at compile time
round(17 / φ) = 11, now computed as a const expression instead of a magic number. Verified identical value on 1.94.0. https://claude.ai/code/session_01HmdXNPit7QsTCfhJFef3Ee
1 parent ab3049e commit fb9d03b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/hpc/gguf_indexer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ pub fn classify_tensor(name: &str, dims: &[u64]) -> LayerType {
100100
// ============================================================================
101101

102102
const BASE_DIM: usize = 17;
103-
/// Golden-step = round(17 / φ) = round(17 / 1.618) = 11. gcd(11,17)=1 → visits all residues.
104-
const GOLDEN_STEP: usize = 11;
103+
/// round(17 / φ) = 11 — maximally irrational stride across BASE_DIM positions.
104+
const GOLDEN_STEP: usize = (BASE_DIM as f64 / std::f64::consts::GOLDEN_RATIO + 0.5) as usize;
105105
const FP_SCALE: f64 = 256.0;
106106

107107
/// Golden-step position table (compile-time).

0 commit comments

Comments
 (0)