(weights, hidden_states, out_vals, out_ids, V, D, H, top_k, temperature)
| 117 | |
| 118 | @torch.compiler.disable |
| 119 | def _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( |
no outgoing calls
no test coverage detected