triton.language.store

triton.language.store(pointer, value, mask=None, boundary_check=(), cache_modifier='', eviction_policy='')

Store a tensor of data into memory locations defined by pointer.

  1. If pointer is a single element pointer, a scalar is stored. In this case:

    • mask must also be scalar, and

    • boundary_check and padding_option must be empty.

  2. If pointer is an N-dimensional tensor of pointers, an N-dimensional block is stored. In this case:

    • mask is implicitly broadcast to pointer.shape, and

    • boundary_check must be empty.

  3. If pointer is a block pointer defined by make_block_ptr, a block of data is stored. In this case:

    • mask must be None, and

    • boundary_check can be specified to control the behavior of out-of-bound access.

value is implicitly broadcast to pointer.shape and typecast to pointer.dtype.element_ty.

Parameters:
  • pointer (triton.PointerType, or block of dtype=triton.PointerType) – The memory location where the elements of value are stored

  • value (Block) – The tensor of elements to be stored

  • mask (Block of triton.int1, optional) – If mask[idx] is false, do not store value[idx] at pointer[idx]

  • boundary_check (tuple of ints, optional) – tuple of integers, indicating the dimensions which should do the boundary check

  • cache_modifier (str, optional) – changes cache option in NVIDIA PTX

  • eviction_policy (str, optional) – changes eviction policy in NVIDIA PTX

This function can also be called as a member function on tensor, as x.store(...) instead of store(x, ...).