core.fusions.fused_row_copy#
Contiguous copy of a row-strided tensor: contiguous rows at a uniform stride, such as a slice of the last dimension.
Tensor.contiguous copies such a view with PyTorch’s generic strided copy kernel, which does
not vectorize its accesses. This kernel copies 2D tiles instead. The values are copied unchanged
and the gradient is passed through, as for Tensor.contiguous.
Module Contents#
Classes#
Functions#
Return (rows, columns, row stride) if |
|
Return |
API#
- core.fusions.fused_row_copy._row_copy_kernel(
- x_ptr,
- y_ptr,
- n_rows,
- n_cols,
- row_stride,
- BLOCK_R: triton.language.constexpr,
- BLOCK_C: triton.language.constexpr,
- core.fusions.fused_row_copy._row_layout(
- x: torch.Tensor,
Return (rows, columns, row stride) if
xis contiguous rows at a uniform stride.
- class core.fusions.fused_row_copy._RowContiguous#
Bases:
torch.autograd.Function- static forward(ctx, x, n_rows, n_cols, row_stride)#
Copy the rows of
xinto a contiguous tensor.
- static backward(ctx, grad)#
Pass the gradient through, as the backward of
Tensor.contiguousdoes.
- core.fusions.fused_row_copy.contiguous_rows(x: torch.Tensor) torch.Tensor#
Return
x.contiguous(), copying row-strided CUDA tensors with a 2D-tiled kernel.- Parameters:
x (torch.Tensor) – Input tensor.
- Returns:
xitself if it is contiguous, otherwise a contiguous copy.- Return type:
torch.Tensor