@triton.jit
def copy_dense_to_sparse_kernel(input_ptr, output_ptr, scores_ptr,
    sparse_rows_ptr, num_columns: tl.constexpr, num_experts_per_token: tl.
    constexpr, block_size: tl.constexpr):
    dense_row = tl.program_id(0)
    offsets = tl.arange(0, block_size) + block_size * tl.program_id(1)
    mask = None if num_columns % block_size == 0 else offsets < num_columns
    out = tl.load(input_ptr + dense_row * num_columns + offsets, mask=mask)
    for top_index in range(num_experts_per_token):
        sparse_row = tl.load(sparse_rows_ptr + dense_row *
            num_experts_per_token + top_index)
        out_scaled = out if scores_ptr is None else out * tl.load(
            scores_ptr + dense_row * num_experts_per_token + top_index).to(tl
            .float32)
        tl.store(output_ptr + sparse_row * num_columns + offsets,
            out_scaled, mask=mask)
