MCPcopy Create free account
hub / github.com/FlashSampling/FlashSampling / model_bytes

Function model_bytes

benchmarking/plot-triton-bench.py:236–243  ·  view source on GitHub ↗

Minimum bytes transferred for fused matmul+sampling (read W + read X + write indices).

(vocab_size: int, hidden_size: int, n_hidden_states: float)

Source from the content-addressed store, hash-verified

234
235
236def model_bytes(vocab_size: int, hidden_size: int, n_hidden_states: float) -> float:
237 """Minimum bytes transferred for fused matmul+sampling (read W + read X + write indices)."""
238 H = int(n_hidden_states) # noqa: N806
239 return (
240 vocab_size * hidden_size * BYTES_PER_ELEMENT # read weights [V, D]
241 + H * hidden_size * BYTES_PER_ELEMENT # read hidden_states [H, D]
242 + H * BYTES_PER_INDEX # write sampled indices [H]
243 )
244
245
246def model_flops(vocab_size: int, hidden_size: int, n_hidden_states: float) -> float:

Callers 2

plot_rooflineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected