tilelang.language.copyΒΆ

The language interface for tl programs.

FunctionsΒΆ

region(buffer, access_type, *args)

Create a memory region descriptor for tile operations.

buffer_to_tile_region(buffer, access_type)

Convert a TVM buffer to a tile region descriptor.

buffer_load_to_tile_region(load, access_type, extents)

Convert a buffer load operation to a tile region descriptor.

buffer_region_to_tile_region(buffer_region, ...)

Convert a buffer region to a tile region descriptor.

copy(src, dst[, coalesced_width, disable_tma])

Copy data between memory regions.

c2d_im2col(img, col, nhw_step, c_step, kernel, stride, ...)

Perform im2col transformation for 2D convolution.

Module ContentsΒΆ

tilelang.language.copy.region(buffer, access_type, *args)ΒΆ

Create a memory region descriptor for tile operations.

Parameters:
  • buffer (tir.BufferLoad) – The buffer to create a region for

  • access_type (str) – Type of access - β€˜r’ for read, β€˜w’ for write, β€˜rw’ for read-write

  • *args (tir.PrimExpr) – Extent expressions defining the region size

Returns:

A region descriptor for tile operations

Return type:

tir.Call

tilelang.language.copy.buffer_to_tile_region(buffer, access_type)ΒΆ

Convert a TVM buffer to a tile region descriptor.

Parameters:
  • buffer (tir.Buffer) – The buffer to convert

  • access_type (str) – Type of access - β€˜r’ for read, β€˜w’ for write, β€˜rw’ for read-write

Returns:

A region descriptor covering the entire buffer

Return type:

tir.Call

tilelang.language.copy.buffer_load_to_tile_region(load, access_type, extents)ΒΆ

Convert a buffer load operation to a tile region descriptor.

Parameters:
  • load (tir.BufferLoad) – The buffer load operation

  • access_type (str) – Type of access - β€˜r’ for read, β€˜w’ for write, β€˜rw’ for read-write

  • extents (List[tir.PrimExpr]) – List of expressions defining the region size

Returns:

A region descriptor for the loaded area

Return type:

tir.Call

tilelang.language.copy.buffer_region_to_tile_region(buffer_region, access_type, extents)ΒΆ

Convert a buffer region to a tile region descriptor.

Parameters:
  • buffer_region (tir.BufferRegion) – The buffer region to convert

  • access_type (str) – Type of access - β€˜r’ for read, β€˜w’ for write, β€˜rw’ for read-write

  • extents (List[tvm.tir.PrimExpr])

Returns:

A region descriptor for the specified buffer region

Return type:

tir.Call

tilelang.language.copy.copy(src, dst, coalesced_width=None, disable_tma=False)ΒΆ

Copy data between memory regions.

Parameters:
  • src (Union[tir.Buffer, tir.BufferLoad, tir.BufferRegion]) – Source memory region

  • dst (Union[tir.Buffer, tir.BufferLoad]) – Destination memory region

  • coalesced_width (Optional[int], optional) – Width for coalesced memory access. Defaults to None.

  • disable_tma (bool)

Raises:

TypeError – If copy extents cannot be deduced from arguments

Returns:

A handle to the copy operation

Return type:

tir.Call

tilelang.language.copy.c2d_im2col(img, col, nhw_step, c_step, kernel, stride, dilation, pad)ΒΆ

Perform im2col transformation for 2D convolution.

Parameters:
  • img (tir.Buffer) – Input image buffer

  • col (tir.Buffer) – Output column buffer

  • nhw_step (tir.PrimExpr) – Step size for batch and spatial dimensions

  • c_step (tir.PrimExpr) – Step size for channel dimension

  • kernel (int) – Kernel size

  • stride (int) – Stride of the convolution

  • dilation (int) – Dilation rate

  • pad (int) – Padding size

Returns:

A handle to the im2col operation

Return type:

tir.Call