triton.extension.buffer.language.to_tensor#
- triton.extension.buffer.language.to_tensor(memref: buffer, writable: bool = 'True', target_shape: None = 'None', _semantic: None = 'None') tl.tensor#
Create a tl.tensor from a bl.buffer.
- 参数:
memref -- the input bl.buffer object.
writable (bool) -- If set true, the resultant tensor is considered "writable" during bufferization.
- Memref type:
bl.buffer
示例
import triton import triton.language as tl import triton.extension.buffer.language as bl @triton.jit def kernel_func(XBLOCK: tl.constexpr): buffer1 = bl.alloc(tl.float32, [XBLOCK]) buffer1.to_tensor(writable=True) buffer2 = bl.alloc(tl.float32, [XBLOCK]) bl.to_tensor(buffer2, writable=True)
特殊说明
Same type support constraints as alloc.