agentsclimarketplace

Cycle estimation via bandwidth and wave efficiency

Skill kjuhwa/skills-hub/skills/performance-modeling/cycle-estimation-via-bandwidth-and-wave-efficiency

Self-correcting knowledge corpus for Claude Code — 9 stable shape clusters, bias-correction pipeline baked into contribution flow. 47 papers, 45 techniques, 1.1k skills.

Install
npx -y skills add kjuhwa/skills-hub --skill cycle-estimation-via-bandwidth-and-wave-efficiency

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Score kernel config candidates with a closed-form cost model combining L1/L2 bandwidth-limited cycles, compute cycles, and wave-efficiency loss from partial final waves.

SKILL.md

2.6 KB, as published. Nobody here has run it

Cycle Estimation via Bandwidth and Wave Efficiency

What / Why

To rank kernel configs without actually running them, estimate total cycles as the max of (L1 cycles, L2 cycles, compute cycles), then divide by wave efficiency to penalize configs whose last wave is half-empty. The model doesn't need to be accurate in absolute terms — just good enough to rank-order candidates.

Procedure

  1. Compute L2 bytes per block.
    l2_bytes_per_block = k × (block_m / cluster_n + block_n / cluster_m) × elem_size
    
    (multicast reduces effective fetch per cluster by the cluster dim).
  2. Compute L1 bytes per block.
    l1_bytes_per_block = k × (block_m + block_n)
    
  3. Epilogue L1+L2 cost for C/D.
    cd_bytes = block_m × block_n × elem_size × (2 if accumulating else 1)
    
  4. Convert bytes to cycles using peak sustainable bandwidth per SM:
    l2_cycles = total_l2_bytes / (64 bytes × num_sms)
    l1_cycles = total_l1_bytes / (128 bytes × num_sms)
    
  5. Wave efficiency.
    num_blocks     = ceil_div(m, block_m) × ceil_div(n, block_n)
    num_waves      = ceil_div(num_blocks, num_sms / (cluster_m × cluster_n))
    wave_efficiency = num_blocks / (num_waves × num_sms)
    
  6. Total cycles. max(l1_cycles, l2_cycles, compute_cycles) / wave_efficiency.
  7. Compare. Lower is better. Additionally: if num_waves == 1, disable multicast (reuse benefit fits in-wave but cluster sync still costs you).

Key design points

  • Constants are machine tunables — 64 bytes × num_sms per cycle for L2 is the Hopper figure, revise per arch.
  • The model ignores memory latency and focuses on bandwidth; for small-shape kernels, augment with a TMA-descriptor-latency term or drop candidates with num_stages < 3.
  • Keep the cost function pure — takes config, returns cycles. Makes unit-testing the scorer trivial.

References

  • csrc/jit_kernels/heuristics/sm90.hpp — cost function used by get_best_configs.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.