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

Function _launch_kernel

src/fused_mm_sampling/tl_fused_mm_topk.py:119–143  ·  view source on GitHub ↗
(weights, hidden_states, out_vals, out_ids, V, D, H, top_k, temperature)

Source from the content-addressed store, hash-verified

117
118@torch.compiler.disable
119def _launch_kernel(weights, hidden_states, out_vals, out_ids, V, D, H, top_k, temperature): # noqa: N803
120 grid_size = {"v": None}
121
122 def grid(meta):
123 grid_size_v = triton.cdiv(V, meta["BLOCK_SIZE_V"])
124 grid_size["v"] = grid_size_v
125 return (
126 grid_size_v,
127 triton.cdiv(H, meta["BLOCK_SIZE_H"]),
128 )
129
130 fused_mm_topk_kernel[grid](
131 weights_ptr=weights,
132 hidden_states_ptr=hidden_states,
133 topk_vals_ptr=out_vals,
134 topk_ids_ptr=out_ids,
135 vocab_size=V,
136 hidden_size=D,
137 n_hidden_states=H,
138 top_k=top_k,
139 temperature_ptr=temperature,
140 )
141
142 assert grid_size["v"] is not None
143 return grid_size["v"]
144
145
146@triton.autotune(

Callers 1

fused_mm_topk_tritonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected