pub trait Tritonwhere
Self::I32Tensor: Add<i32, Output = Self::I32Tensor> + Sub<i32, Output = Self::I32Tensor> + Mul<i32, Output = Self::I32Tensor> + Div<i32, Output = Self::I32Tensor>,
Self::BoolTensor: BitAnd<Output = Self::BoolTensor> + BitOr<Output = Self::BoolTensor>,{
type BoolTensor: Copy + Clone;
type I32Tensor: Copy + Clone;
type Tensor<D: Dtype>: Copy + Clone + Add<Self::Tensor<D>, Output = Self::Tensor<D>> + Sub<Self::Tensor<D>, Output = Self::Tensor<D>> + Mul<Self::Tensor<D>, Output = Self::Tensor<D>> + Div<Self::Tensor<D>, Output = Self::Tensor<D>> + Neg<Output = Self::Tensor<D>>;
type Pointer<D: Dtype>: Copy + Clone + Dtype + Add<Self::Pointer<D>, Output = Self::Pointer<D>>;
Show 106 methods
// Required methods
fn program_id(axis: Axis) -> i32;
fn num_programs(axis: Axis) -> i32;
fn load_scalar_f32_as_i32(ptr: Self::Pointer<f32>, offset: i32) -> i32;
fn arange(start: impl Into<i32>, end: impl Into<i32>) -> Self::I32Tensor;
fn arange_f32(
start: impl Into<i32>,
end: impl Into<i32>,
) -> Self::Tensor<f32>;
fn zeros<D: Dtype>(shape: &[i32]) -> Self::Tensor<D>;
fn zeros_like<D: Dtype>(x: Self::Tensor<D>) -> Self::Tensor<D>;
fn full<D: Dtype>(shape: &[i32], value: D) -> Self::Tensor<D>;
fn cast<Src: Dtype, Dst: Dtype>(
x: Self::Tensor<Src>,
fp_downcast_rounding: Option<FpDowncastRounding>,
bitcast: bool,
) -> Self::Tensor<Dst>;
fn cat<D: Dtype>(
a: Self::Tensor<D>,
b: Self::Tensor<D>,
can_reorder: bool,
) -> Self::Tensor<D>;
fn broadcast<D: Dtype>(
a: Self::Tensor<D>,
b: Self::Tensor<D>,
) -> (Self::Tensor<D>, Self::Tensor<D>);
fn broadcast_to<D: Dtype>(
x: Self::Tensor<D>,
shape: &[i32],
) -> Self::Tensor<D>;
fn expand_dims<D: Dtype>(x: Self::Tensor<D>, axis: i32) -> Self::Tensor<D>;
fn permute<D: Dtype>(x: Self::Tensor<D>, dims: &[i32]) -> Self::Tensor<D>;
fn reshape<D: Dtype>(
x: Self::Tensor<D>,
shape: &[i32],
can_reorder: bool,
) -> Self::Tensor<D>;
fn trans<D: Dtype>(x: Self::Tensor<D>, dims: &[i32]) -> Self::Tensor<D>;
fn ravel<D: Dtype>(x: Self::Tensor<D>, can_reorder: bool) -> Self::Tensor<D>;
fn view<D: Dtype>(x: Self::Tensor<D>, shape: &[i32]) -> Self::Tensor<D>;
fn join<D: Dtype>(a: Self::Tensor<D>, b: Self::Tensor<D>) -> Self::Tensor<D>;
fn interleave<D: Dtype>(
a: Self::Tensor<D>,
b: Self::Tensor<D>,
) -> Self::Tensor<D>;
fn split<D: Dtype>(x: Self::Tensor<D>) -> (Self::Tensor<D>, Self::Tensor<D>);
fn dot<D: Num, O: Num>(
a: Self::Tensor<D>,
b: Self::Tensor<D>,
acc: Option<Self::Tensor<O>>,
input_precision: Option<InputPrecision>,
max_num_imprecise_acc: Option<i32>,
) -> Self::Tensor<O>;
fn dot_scaled<D: Num, S: Num, O: Num>(
lhs: Self::Tensor<D>,
lhs_scale: Self::Tensor<S>,
lhs_format: DotFormat,
rhs: Self::Tensor<D>,
rhs_scale: Self::Tensor<S>,
rhs_format: DotFormat,
acc: Option<Self::Tensor<O>>,
fast_math: bool,
) -> Self::Tensor<O>;
fn make_block_ptr<D: Dtype>(
base: Self::Pointer<D>,
shape: &[i32],
strides: &[i32],
offsets: &[i32],
block_shape: &[i32],
order: &[i32],
) -> Self::Pointer<D>;
fn advance<D: Dtype>(
ptr: Self::Pointer<D>,
offsets: &[i32],
) -> Self::Pointer<D>;
fn make_tensor_descriptor<D: Dtype>(
base: Self::Pointer<D>,
shape: &[i32],
strides: &[i32],
block_shape: &[i32],
padding_option: Option<PaddingOption>,
) -> Self::Pointer<D>;
fn load_tensor_descriptor<D: Dtype>(
desc: Self::Pointer<D>,
offsets: &[i32],
) -> Self::Tensor<D>;
fn store_tensor_descriptor<D: Dtype>(
desc: Self::Pointer<D>,
offsets: &[i32],
value: Self::Tensor<D>,
);
fn load<D: Dtype, const N: usize>(
ptr: Self::Tensor<Self::Pointer<D>>,
mask: Option<Self::BoolTensor>,
other: Option<Self::Tensor<D>>,
boundary_check: &[i32; N],
padding_option: Option<PaddingOption>,
cache_modifier: Option<CacheModifier>,
eviction_policy: Option<EvictionPolicy>,
volatile: bool,
) -> Self::Tensor<D>;
fn store<D: Dtype, const N: usize>(
dest: Self::Tensor<Self::Pointer<D>>,
src: Self::Tensor<D>,
mask: Option<Self::BoolTensor>,
boundary_check: &[i32; N],
cache_modifier: Option<CacheModifier>,
eviction_policy: Option<EvictionPolicy>,
);
fn lt<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor;
fn le<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor;
fn gt<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor;
fn ge<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor;
fn eq<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor;
fn ne<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor;
fn lt_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor;
fn le_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor;
fn gt_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor;
fn ge_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor;
fn eq_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor;
fn ne_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor;
fn where_<D: Dtype>(
cond: Self::BoolTensor,
x: Self::Tensor<D>,
y: Self::Tensor<D>,
) -> Self::Tensor<D>;
fn flip<D: Dtype>(x: Self::Tensor<D>, dim: Option<i32>) -> Self::Tensor<D>;
fn gather<D: Dtype>(
src: Self::Tensor<D>,
index: Self::I32Tensor,
axis: i32,
) -> Self::Tensor<D>;
fn abs<D: Dtype>(x: Self::Tensor<D>) -> Self::Tensor<D>;
fn ceil<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>;
fn floor<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>;
fn cos<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>;
fn sin<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>;
fn exp<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>;
fn exp2<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>;
fn log<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>;
fn log2<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>;
fn rsqrt<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>;
fn sigmoid<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>;
fn sqrt<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>;
fn sqrt_rn<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>;
fn erf<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>;
fn atan<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>;
fn softmax<D: Float>(
x: Self::Tensor<D>,
dim: Option<i32>,
keep_dims: bool,
ieee_rounding: bool,
) -> Self::Tensor<D>;
fn maximum<D: Num>(
x: Self::Tensor<D>,
y: Self::Tensor<D>,
) -> Self::Tensor<D>;
fn minimum<D: Num>(
x: Self::Tensor<D>,
y: Self::Tensor<D>,
) -> Self::Tensor<D>;
fn clamp<D: Num>(
x: Self::Tensor<D>,
lo: Self::Tensor<D>,
hi: Self::Tensor<D>,
) -> Self::Tensor<D>;
fn fma<D: Float>(
x: Self::Tensor<D>,
y: Self::Tensor<D>,
z: Self::Tensor<D>,
) -> Self::Tensor<D>;
fn fdiv<D: Float>(
x: Self::Tensor<D>,
y: Self::Tensor<D>,
ieee_rounding: bool,
) -> Self::Tensor<D>;
fn div_rn<D: Float>(
x: Self::Tensor<D>,
y: Self::Tensor<D>,
) -> Self::Tensor<D>;
fn umulhi(x: Self::Tensor<u32>, y: Self::Tensor<u32>) -> Self::Tensor<u32>;
fn cdiv(x: i32, div: i32) -> i32;
fn swizzle2d(
i: i32,
j: i32,
size_i: i32,
size_j: i32,
size_g: i32,
) -> (i32, i32);
fn sum<D: Num>(
x: Self::Tensor<D>,
axis: Option<i32>,
keep_dims: bool,
) -> Self::Tensor<D>;
fn max<D: Num>(
x: Self::Tensor<D>,
axis: Option<i32>,
keep_dims: bool,
) -> Self::Tensor<D>;
fn max_with_indices<D: Num>(
x: Self::Tensor<D>,
axis: i32,
tie_break_left: bool,
keep_dims: bool,
) -> (Self::Tensor<D>, Self::I32Tensor);
fn min<D: Num>(
x: Self::Tensor<D>,
axis: Option<i32>,
keep_dims: bool,
) -> Self::Tensor<D>;
fn min_with_indices<D: Num>(
x: Self::Tensor<D>,
axis: i32,
tie_break_left: bool,
keep_dims: bool,
) -> (Self::Tensor<D>, Self::I32Tensor);
fn argmax<D: Num>(
x: Self::Tensor<D>,
axis: i32,
tie_break_left: bool,
keep_dims: bool,
) -> Self::I32Tensor;
fn argmin<D: Num>(
x: Self::Tensor<D>,
axis: i32,
tie_break_left: bool,
keep_dims: bool,
) -> Self::I32Tensor;
fn xor_sum<D: Int>(
x: Self::Tensor<D>,
axis: Option<i32>,
keep_dims: bool,
) -> Self::Tensor<D>;
fn cumsum<D: Num>(
x: Self::Tensor<D>,
axis: i32,
reverse: bool,
) -> Self::Tensor<D>;
fn cumprod<D: Num>(
x: Self::Tensor<D>,
axis: i32,
reverse: bool,
) -> Self::Tensor<D>;
fn sort<D: Num>(
x: Self::Tensor<D>,
dim: Option<i32>,
descending: bool,
) -> Self::Tensor<D>;
fn histogram(
x: Self::I32Tensor,
num_bins: i32,
mask: Option<Self::BoolTensor>,
) -> Self::I32Tensor;
fn reduce<D: Dtype, O: Dtype>(
x: Self::Tensor<D>,
axis: i32,
combine_fn: fn(Self::Tensor<O>, Self::Tensor<O>) -> Self::Tensor<O>,
keep_dims: bool,
) -> Self::Tensor<O>;
fn associative_scan<D: Dtype>(
x: Self::Tensor<D>,
axis: i32,
combine_fn: fn(Self::Tensor<D>, Self::Tensor<D>) -> Self::Tensor<D>,
reverse: bool,
) -> Self::Tensor<D>;
fn atomic_add<D: Num>(
ptr: Self::Tensor<Self::Pointer<D>>,
val: Self::Tensor<D>,
mask: Option<Self::BoolTensor>,
sem: Option<MemSem>,
scope: Option<MemScope>,
) -> Self::Tensor<D>;
fn atomic_and<D: Int>(
ptr: Self::Tensor<Self::Pointer<D>>,
val: Self::Tensor<D>,
mask: Option<Self::BoolTensor>,
sem: Option<MemSem>,
scope: Option<MemScope>,
) -> Self::Tensor<D>;
fn atomic_or<D: Int>(
ptr: Self::Tensor<Self::Pointer<D>>,
val: Self::Tensor<D>,
mask: Option<Self::BoolTensor>,
sem: Option<MemSem>,
scope: Option<MemScope>,
) -> Self::Tensor<D>;
fn atomic_xor<D: Int>(
ptr: Self::Tensor<Self::Pointer<D>>,
val: Self::Tensor<D>,
mask: Option<Self::BoolTensor>,
sem: Option<MemSem>,
scope: Option<MemScope>,
) -> Self::Tensor<D>;
fn atomic_max<D: Num>(
ptr: Self::Tensor<Self::Pointer<D>>,
val: Self::Tensor<D>,
mask: Option<Self::BoolTensor>,
sem: Option<MemSem>,
scope: Option<MemScope>,
) -> Self::Tensor<D>;
fn atomic_min<D: Num>(
ptr: Self::Tensor<Self::Pointer<D>>,
val: Self::Tensor<D>,
mask: Option<Self::BoolTensor>,
sem: Option<MemSem>,
scope: Option<MemScope>,
) -> Self::Tensor<D>;
fn atomic_xchg<D: Dtype>(
ptr: Self::Tensor<Self::Pointer<D>>,
val: Self::Tensor<D>,
mask: Option<Self::BoolTensor>,
sem: Option<MemSem>,
scope: Option<MemScope>,
) -> Self::Tensor<D>;
fn atomic_cas<D: Dtype>(
ptr: Self::Tensor<Self::Pointer<D>>,
cmp: Self::Tensor<D>,
val: Self::Tensor<D>,
sem: Option<MemSem>,
scope: Option<MemScope>,
) -> Self::Tensor<D>;
fn rand(
seed: u32,
offsets: Self::I32Tensor,
n_rounds: i32,
) -> Self::Tensor<f32>;
fn randn(
seed: u32,
offsets: Self::I32Tensor,
n_rounds: i32,
) -> Self::Tensor<f32>;
fn randint(
seed: u32,
offsets: Self::I32Tensor,
n_rounds: i32,
) -> Self::I32Tensor;
fn randint4x(
seed: u32,
offsets: Self::I32Tensor,
n_rounds: i32,
) -> (Self::I32Tensor, Self::I32Tensor, Self::I32Tensor, Self::I32Tensor);
fn inline_asm_elementwise<D: Dtype>(
asm: &str,
constraints: &str,
is_pure: bool,
pack: i32,
) -> Self::Tensor<D>;
fn assume(cond: Self::BoolTensor);
fn multiple_of<D: Dtype>(
x: Self::Tensor<D>,
values: &[i32],
) -> Self::Tensor<D>;
fn max_contiguous<D: Dtype>(
x: Self::Tensor<D>,
values: &[i32],
) -> Self::Tensor<D>;
fn max_constancy<D: Dtype>(
x: Self::Tensor<D>,
values: &[i32],
) -> Self::Tensor<D>;
fn debug_barrier();
fn device_assert(
cond: Self::BoolTensor,
msg: &str,
mask: Option<Self::BoolTensor>,
);
fn device_print<D: Dtype>(prefix: &str, val: Self::Tensor<D>, hex: bool);
fn static_assert(cond: bool, msg: &str);
fn static_print(msg: &str);
}Expand description
The Triton-like kernel DSL: tensor/pointer types and the operations (creation, shape
manipulation, linear algebra, memory, math, reduction, scan/sort, atomics, RNG) available
inside a #[kernel]-annotated function. See the module docs for how this compiles.
Required Associated Types§
Sourcetype BoolTensor: Copy + Clone
type BoolTensor: Copy + Clone
A tensor of bool, produced by comparisons and used as a mask.
Sourcetype I32Tensor: Copy + Clone
type I32Tensor: Copy + Clone
A tensor of i32, e.g. produced by Triton::arange.
Required Methods§
Sourcefn program_id(axis: Axis) -> i32
fn program_id(axis: Axis) -> i32
The current program’s index along axis within the launch grid.
Sourcefn num_programs(axis: Axis) -> i32
fn num_programs(axis: Axis) -> i32
The total number of programs launched along axis.
Sourcefn load_scalar_f32_as_i32(ptr: Self::Pointer<f32>, offset: i32) -> i32
fn load_scalar_f32_as_i32(ptr: Self::Pointer<f32>, offset: i32) -> i32
Scalar gather: load the f32 at ptr + offset, truncate to i32,
and return it as a plain Rust i32 usable in scalar arithmetic
(e.g. as an addend to arange results via I32Tensor + i32).
Used when integer indices are stored as f32 (the graph’s default dtype).
Sourcefn arange(start: impl Into<i32>, end: impl Into<i32>) -> Self::I32Tensor
fn arange(start: impl Into<i32>, end: impl Into<i32>) -> Self::I32Tensor
Create a 1-D i32 tensor with values [start, start+1, ..., end-1].
Sourcefn arange_f32(start: impl Into<i32>, end: impl Into<i32>) -> Self::Tensor<f32>
fn arange_f32(start: impl Into<i32>, end: impl Into<i32>) -> Self::Tensor<f32>
Create a 1-D f32 tensor with values [start as f32, start+1, ..., end-1].
Equivalent to casting arange(start, end) to f32, but avoids the
intermediate I32Tensor copy that some backends cannot handle.
Sourcefn zeros<D: Dtype>(shape: &[i32]) -> Self::Tensor<D>
fn zeros<D: Dtype>(shape: &[i32]) -> Self::Tensor<D>
Create a tensor of the given shape filled with zeros.
Sourcefn zeros_like<D: Dtype>(x: Self::Tensor<D>) -> Self::Tensor<D>
fn zeros_like<D: Dtype>(x: Self::Tensor<D>) -> Self::Tensor<D>
Create a zero-filled tensor with the same shape/dtype as x.
Sourcefn full<D: Dtype>(shape: &[i32], value: D) -> Self::Tensor<D>
fn full<D: Dtype>(shape: &[i32], value: D) -> Self::Tensor<D>
Create a tensor of the given shape filled with value.
Sourcefn cast<Src: Dtype, Dst: Dtype>(
x: Self::Tensor<Src>,
fp_downcast_rounding: Option<FpDowncastRounding>,
bitcast: bool,
) -> Self::Tensor<Dst>
fn cast<Src: Dtype, Dst: Dtype>( x: Self::Tensor<Src>, fp_downcast_rounding: Option<FpDowncastRounding>, bitcast: bool, ) -> Self::Tensor<Dst>
Cast a tensor to a different dtype.
fp_downcast_rounding: rounding mode when narrowing float types (defaultNone= unspecified).bitcast: reinterpret bits without conversion (defaultfalse).
Sourcefn cat<D: Dtype>(
a: Self::Tensor<D>,
b: Self::Tensor<D>,
can_reorder: bool,
) -> Self::Tensor<D>
fn cat<D: Dtype>( a: Self::Tensor<D>, b: Self::Tensor<D>, can_reorder: bool, ) -> Self::Tensor<D>
Concatenate two tensors.
can_reorder: allow the compiler to reorder elements (defaultfalse).
Sourcefn broadcast<D: Dtype>(
a: Self::Tensor<D>,
b: Self::Tensor<D>,
) -> (Self::Tensor<D>, Self::Tensor<D>)
fn broadcast<D: Dtype>( a: Self::Tensor<D>, b: Self::Tensor<D>, ) -> (Self::Tensor<D>, Self::Tensor<D>)
Broadcast two tensors to a common compatible shape.
Sourcefn broadcast_to<D: Dtype>(x: Self::Tensor<D>, shape: &[i32]) -> Self::Tensor<D>
fn broadcast_to<D: Dtype>(x: Self::Tensor<D>, shape: &[i32]) -> Self::Tensor<D>
Broadcast x to shape.
Sourcefn expand_dims<D: Dtype>(x: Self::Tensor<D>, axis: i32) -> Self::Tensor<D>
fn expand_dims<D: Dtype>(x: Self::Tensor<D>, axis: i32) -> Self::Tensor<D>
Insert a size-1 dimension at axis.
Sourcefn permute<D: Dtype>(x: Self::Tensor<D>, dims: &[i32]) -> Self::Tensor<D>
fn permute<D: Dtype>(x: Self::Tensor<D>, dims: &[i32]) -> Self::Tensor<D>
Permute x’s dimensions according to dims.
Sourcefn reshape<D: Dtype>(
x: Self::Tensor<D>,
shape: &[i32],
can_reorder: bool,
) -> Self::Tensor<D>
fn reshape<D: Dtype>( x: Self::Tensor<D>, shape: &[i32], can_reorder: bool, ) -> Self::Tensor<D>
Reshape a tensor.
can_reorder: allow element reordering during reshape (defaultfalse).
Sourcefn trans<D: Dtype>(x: Self::Tensor<D>, dims: &[i32]) -> Self::Tensor<D>
fn trans<D: Dtype>(x: Self::Tensor<D>, dims: &[i32]) -> Self::Tensor<D>
Permute dimensions. Alias for permute.
Sourcefn ravel<D: Dtype>(x: Self::Tensor<D>, can_reorder: bool) -> Self::Tensor<D>
fn ravel<D: Dtype>(x: Self::Tensor<D>, can_reorder: bool) -> Self::Tensor<D>
Flatten to 1-D.
can_reorder: allow element reordering (defaultfalse).
Sourcefn view<D: Dtype>(x: Self::Tensor<D>, shape: &[i32]) -> Self::Tensor<D>
fn view<D: Dtype>(x: Self::Tensor<D>, shape: &[i32]) -> Self::Tensor<D>
View with a new shape (order not preserved).
Sourcefn join<D: Dtype>(a: Self::Tensor<D>, b: Self::Tensor<D>) -> Self::Tensor<D>
fn join<D: Dtype>(a: Self::Tensor<D>, b: Self::Tensor<D>) -> Self::Tensor<D>
Join two tensors along a new minor dimension.
Sourcefn interleave<D: Dtype>(
a: Self::Tensor<D>,
b: Self::Tensor<D>,
) -> Self::Tensor<D>
fn interleave<D: Dtype>( a: Self::Tensor<D>, b: Self::Tensor<D>, ) -> Self::Tensor<D>
Interleave two tensors along their last dimension.
Sourcefn split<D: Dtype>(x: Self::Tensor<D>) -> (Self::Tensor<D>, Self::Tensor<D>)
fn split<D: Dtype>(x: Self::Tensor<D>) -> (Self::Tensor<D>, Self::Tensor<D>)
Split a tensor in two along its last dimension (which must have size 2).
Sourcefn dot<D: Num, O: Num>(
a: Self::Tensor<D>,
b: Self::Tensor<D>,
acc: Option<Self::Tensor<O>>,
input_precision: Option<InputPrecision>,
max_num_imprecise_acc: Option<i32>,
) -> Self::Tensor<O>
fn dot<D: Num, O: Num>( a: Self::Tensor<D>, b: Self::Tensor<D>, acc: Option<Self::Tensor<O>>, input_precision: Option<InputPrecision>, max_num_imprecise_acc: Option<i32>, ) -> Self::Tensor<O>
Matrix (or batched matrix) multiply.
acc: optional accumulator tensor added to the result.input_precision: Tensor Core precision forf32 × f32(defaultNone= TF32 on capable hardware).max_num_imprecise_acc: limit on imprecise accumulations (defaultNone).
Sourcefn dot_scaled<D: Num, S: Num, O: Num>(
lhs: Self::Tensor<D>,
lhs_scale: Self::Tensor<S>,
lhs_format: DotFormat,
rhs: Self::Tensor<D>,
rhs_scale: Self::Tensor<S>,
rhs_format: DotFormat,
acc: Option<Self::Tensor<O>>,
fast_math: bool,
) -> Self::Tensor<O>
fn dot_scaled<D: Num, S: Num, O: Num>( lhs: Self::Tensor<D>, lhs_scale: Self::Tensor<S>, lhs_format: DotFormat, rhs: Self::Tensor<D>, rhs_scale: Self::Tensor<S>, rhs_format: DotFormat, acc: Option<Self::Tensor<O>>, fast_math: bool, ) -> Self::Tensor<O>
Scaled mixed-precision matrix multiply (FP8 / narrow formats).
acc: optional accumulator (defaultNone).fast_math: allow reduced precision accumulation (defaultfalse).
Sourcefn make_block_ptr<D: Dtype>(
base: Self::Pointer<D>,
shape: &[i32],
strides: &[i32],
offsets: &[i32],
block_shape: &[i32],
order: &[i32],
) -> Self::Pointer<D>
fn make_block_ptr<D: Dtype>( base: Self::Pointer<D>, shape: &[i32], strides: &[i32], offsets: &[i32], block_shape: &[i32], order: &[i32], ) -> Self::Pointer<D>
Create a block pointer encoding shape, strides, offsets, and tile shape.
Sourcefn advance<D: Dtype>(ptr: Self::Pointer<D>, offsets: &[i32]) -> Self::Pointer<D>
fn advance<D: Dtype>(ptr: Self::Pointer<D>, offsets: &[i32]) -> Self::Pointer<D>
Advance a block pointer by the given per-dimension offsets.
Sourcefn make_tensor_descriptor<D: Dtype>(
base: Self::Pointer<D>,
shape: &[i32],
strides: &[i32],
block_shape: &[i32],
padding_option: Option<PaddingOption>,
) -> Self::Pointer<D>
fn make_tensor_descriptor<D: Dtype>( base: Self::Pointer<D>, shape: &[i32], strides: &[i32], block_shape: &[i32], padding_option: Option<PaddingOption>, ) -> Self::Pointer<D>
Create a tensor descriptor for TMA (Tensor Memory Accelerator) operations.
padding_option: out-of-bounds padding behaviour (defaultPaddingOption::Zero).
Sourcefn load_tensor_descriptor<D: Dtype>(
desc: Self::Pointer<D>,
offsets: &[i32],
) -> Self::Tensor<D>
fn load_tensor_descriptor<D: Dtype>( desc: Self::Pointer<D>, offsets: &[i32], ) -> Self::Tensor<D>
Load a tile from memory using a tensor descriptor and per-dimension offsets.
Sourcefn store_tensor_descriptor<D: Dtype>(
desc: Self::Pointer<D>,
offsets: &[i32],
value: Self::Tensor<D>,
)
fn store_tensor_descriptor<D: Dtype>( desc: Self::Pointer<D>, offsets: &[i32], value: Self::Tensor<D>, )
Store a tile to memory using a tensor descriptor and per-dimension offsets.
Sourcefn load<D: Dtype, const N: usize>(
ptr: Self::Tensor<Self::Pointer<D>>,
mask: Option<Self::BoolTensor>,
other: Option<Self::Tensor<D>>,
boundary_check: &[i32; N],
padding_option: Option<PaddingOption>,
cache_modifier: Option<CacheModifier>,
eviction_policy: Option<EvictionPolicy>,
volatile: bool,
) -> Self::Tensor<D>
fn load<D: Dtype, const N: usize>( ptr: Self::Tensor<Self::Pointer<D>>, mask: Option<Self::BoolTensor>, other: Option<Self::Tensor<D>>, boundary_check: &[i32; N], padding_option: Option<PaddingOption>, cache_modifier: Option<CacheModifier>, eviction_policy: Option<EvictionPolicy>, volatile: bool, ) -> Self::Tensor<D>
Load a tensor from memory.
mask: whenSome, lanes where mask isfalseare not loaded (defaultNone= unconditional).other: fill value for masked-off lanes (defaultNone= undefined).boundary_check: dimensions to check for out-of-bounds (block-pointer mode only, default&[]).padding_option: fill for out-of-bounds lanes in block-pointer mode (defaultNone).cache_modifier: L1/L2 cache behaviour (defaultNone).eviction_policy: eviction priority hint (defaultNone).volatile: always fetch fresh from memory (defaultfalse).
Sourcefn store<D: Dtype, const N: usize>(
dest: Self::Tensor<Self::Pointer<D>>,
src: Self::Tensor<D>,
mask: Option<Self::BoolTensor>,
boundary_check: &[i32; N],
cache_modifier: Option<CacheModifier>,
eviction_policy: Option<EvictionPolicy>,
)
fn store<D: Dtype, const N: usize>( dest: Self::Tensor<Self::Pointer<D>>, src: Self::Tensor<D>, mask: Option<Self::BoolTensor>, boundary_check: &[i32; N], cache_modifier: Option<CacheModifier>, eviction_policy: Option<EvictionPolicy>, )
Store a tensor to memory.
mask: whenSome, lanes where mask isfalseare not stored (defaultNone= unconditional).boundary_check: dimensions to check for out-of-bounds (block-pointer mode only, default&[]).cache_modifier: L1/L2 cache behaviour (defaultNone).eviction_policy: eviction priority hint (defaultNone).
Sourcefn lt<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor
fn lt<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor
Element-wise less-than between two tensors.
Sourcefn le<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor
fn le<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor
Element-wise less-than-or-equal between two tensors.
Sourcefn gt<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor
fn gt<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor
Element-wise greater-than between two tensors.
Sourcefn ge<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor
fn ge<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor
Element-wise greater-than-or-equal between two tensors.
Sourcefn eq<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor
fn eq<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor
Element-wise equality between two tensors.
Sourcefn ne<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor
fn ne<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::BoolTensor
Element-wise inequality between two tensors.
Sourcefn lt_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor
fn lt_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor
Element-wise less-than against a scalar.
Sourcefn le_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor
fn le_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor
Element-wise less-than-or-equal against a scalar.
Sourcefn gt_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor
fn gt_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor
Element-wise greater-than against a scalar.
Sourcefn ge_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor
fn ge_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor
Element-wise greater-than-or-equal against a scalar.
Sourcefn eq_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor
fn eq_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor
Element-wise equality against a scalar.
Sourcefn ne_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor
fn ne_scalar<D: Num>(x: Self::Tensor<D>, y: D) -> Self::BoolTensor
Element-wise inequality against a scalar.
Sourcefn where_<D: Dtype>(
cond: Self::BoolTensor,
x: Self::Tensor<D>,
y: Self::Tensor<D>,
) -> Self::Tensor<D>
fn where_<D: Dtype>( cond: Self::BoolTensor, x: Self::Tensor<D>, y: Self::Tensor<D>, ) -> Self::Tensor<D>
Conditional element selection — corresponds to tl.where.
Named where_ to avoid collision with the Rust keyword where.
Sourcefn flip<D: Dtype>(x: Self::Tensor<D>, dim: Option<i32>) -> Self::Tensor<D>
fn flip<D: Dtype>(x: Self::Tensor<D>, dim: Option<i32>) -> Self::Tensor<D>
Reverse a tensor along dim. None reverses all dimensions.
Sourcefn gather<D: Dtype>(
src: Self::Tensor<D>,
index: Self::I32Tensor,
axis: i32,
) -> Self::Tensor<D>
fn gather<D: Dtype>( src: Self::Tensor<D>, index: Self::I32Tensor, axis: i32, ) -> Self::Tensor<D>
Gather elements from src along axis using index.
Sourcefn exp<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>
fn exp<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>
Element-wise natural exponential (e^x).
Sourcefn exp2<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>
fn exp2<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>
Element-wise base-2 exponential (2^x).
Sourcefn rsqrt<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>
fn rsqrt<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>
Element-wise reciprocal square root (1/sqrt(x)).
Sourcefn sqrt_rn<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>
fn sqrt_rn<D: Float>(x: Self::Tensor<D>) -> Self::Tensor<D>
Element-wise square root, round-to-nearest.
Sourcefn softmax<D: Float>(
x: Self::Tensor<D>,
dim: Option<i32>,
keep_dims: bool,
ieee_rounding: bool,
) -> Self::Tensor<D>
fn softmax<D: Float>( x: Self::Tensor<D>, dim: Option<i32>, keep_dims: bool, ieee_rounding: bool, ) -> Self::Tensor<D>
Numerically-stable softmax along dim. dim = None defaults to the last dimension.
keep_dims: retain the reduced dimension with length 1 (defaultfalse).ieee_rounding: use IEEE-754 rounding (defaultfalse).
Sourcefn maximum<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::Tensor<D>
fn maximum<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::Tensor<D>
Element-wise maximum of two tensors.
Sourcefn minimum<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::Tensor<D>
fn minimum<D: Num>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::Tensor<D>
Element-wise minimum of two tensors.
Sourcefn clamp<D: Num>(
x: Self::Tensor<D>,
lo: Self::Tensor<D>,
hi: Self::Tensor<D>,
) -> Self::Tensor<D>
fn clamp<D: Num>( x: Self::Tensor<D>, lo: Self::Tensor<D>, hi: Self::Tensor<D>, ) -> Self::Tensor<D>
Element-wise clamp of x to [lo, hi].
Sourcefn fma<D: Float>(
x: Self::Tensor<D>,
y: Self::Tensor<D>,
z: Self::Tensor<D>,
) -> Self::Tensor<D>
fn fma<D: Float>( x: Self::Tensor<D>, y: Self::Tensor<D>, z: Self::Tensor<D>, ) -> Self::Tensor<D>
Element-wise fused multiply-add: x * y + z.
Sourcefn fdiv<D: Float>(
x: Self::Tensor<D>,
y: Self::Tensor<D>,
ieee_rounding: bool,
) -> Self::Tensor<D>
fn fdiv<D: Float>( x: Self::Tensor<D>, y: Self::Tensor<D>, ieee_rounding: bool, ) -> Self::Tensor<D>
Element-wise floating-point division.
ieee_rounding: use IEEE-754 rounding (defaultfalse).
Sourcefn div_rn<D: Float>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::Tensor<D>
fn div_rn<D: Float>(x: Self::Tensor<D>, y: Self::Tensor<D>) -> Self::Tensor<D>
Element-wise division, round-to-nearest.
Sourcefn umulhi(x: Self::Tensor<u32>, y: Self::Tensor<u32>) -> Self::Tensor<u32>
fn umulhi(x: Self::Tensor<u32>, y: Self::Tensor<u32>) -> Self::Tensor<u32>
Element-wise high 32 bits of an unsigned 32×32→64-bit multiply.
Sourcefn swizzle2d(
i: i32,
j: i32,
size_i: i32,
size_j: i32,
size_g: i32,
) -> (i32, i32)
fn swizzle2d( i: i32, j: i32, size_i: i32, size_j: i32, size_g: i32, ) -> (i32, i32)
Swizzle 2-D indices for shared-memory bank-conflict avoidance.
Returns the remapped (i, j) indices.
Sourcefn sum<D: Num>(
x: Self::Tensor<D>,
axis: Option<i32>,
keep_dims: bool,
) -> Self::Tensor<D>
fn sum<D: Num>( x: Self::Tensor<D>, axis: Option<i32>, keep_dims: bool, ) -> Self::Tensor<D>
Sum all elements along axis. axis = None reduces all dimensions.
Sourcefn max<D: Num>(
x: Self::Tensor<D>,
axis: Option<i32>,
keep_dims: bool,
) -> Self::Tensor<D>
fn max<D: Num>( x: Self::Tensor<D>, axis: Option<i32>, keep_dims: bool, ) -> Self::Tensor<D>
Maximum along axis. axis = None reduces all dimensions.
Sourcefn max_with_indices<D: Num>(
x: Self::Tensor<D>,
axis: i32,
tie_break_left: bool,
keep_dims: bool,
) -> (Self::Tensor<D>, Self::I32Tensor)
fn max_with_indices<D: Num>( x: Self::Tensor<D>, axis: i32, tie_break_left: bool, keep_dims: bool, ) -> (Self::Tensor<D>, Self::I32Tensor)
Maximum along axis, also returning the index of the maximum.
tie_break_left: whentrue, the leftmost index wins on ties (defaulttrue).
Sourcefn min<D: Num>(
x: Self::Tensor<D>,
axis: Option<i32>,
keep_dims: bool,
) -> Self::Tensor<D>
fn min<D: Num>( x: Self::Tensor<D>, axis: Option<i32>, keep_dims: bool, ) -> Self::Tensor<D>
Minimum along axis. axis = None reduces all dimensions.
Sourcefn min_with_indices<D: Num>(
x: Self::Tensor<D>,
axis: i32,
tie_break_left: bool,
keep_dims: bool,
) -> (Self::Tensor<D>, Self::I32Tensor)
fn min_with_indices<D: Num>( x: Self::Tensor<D>, axis: i32, tie_break_left: bool, keep_dims: bool, ) -> (Self::Tensor<D>, Self::I32Tensor)
Minimum along axis, also returning the index of the minimum.
tie_break_left: whentrue, the leftmost index wins on ties (defaulttrue).
Sourcefn argmax<D: Num>(
x: Self::Tensor<D>,
axis: i32,
tie_break_left: bool,
keep_dims: bool,
) -> Self::I32Tensor
fn argmax<D: Num>( x: Self::Tensor<D>, axis: i32, tie_break_left: bool, keep_dims: bool, ) -> Self::I32Tensor
Index of the maximum along axis.
tie_break_left: whentrue, the leftmost index wins on ties (defaulttrue).
Sourcefn argmin<D: Num>(
x: Self::Tensor<D>,
axis: i32,
tie_break_left: bool,
keep_dims: bool,
) -> Self::I32Tensor
fn argmin<D: Num>( x: Self::Tensor<D>, axis: i32, tie_break_left: bool, keep_dims: bool, ) -> Self::I32Tensor
Index of the minimum along axis.
tie_break_left: whentrue, the leftmost index wins on ties (defaulttrue).
Sourcefn xor_sum<D: Int>(
x: Self::Tensor<D>,
axis: Option<i32>,
keep_dims: bool,
) -> Self::Tensor<D>
fn xor_sum<D: Int>( x: Self::Tensor<D>, axis: Option<i32>, keep_dims: bool, ) -> Self::Tensor<D>
XOR-reduction along axis. axis = None reduces all dimensions.
Sourcefn cumsum<D: Num>(
x: Self::Tensor<D>,
axis: i32,
reverse: bool,
) -> Self::Tensor<D>
fn cumsum<D: Num>( x: Self::Tensor<D>, axis: i32, reverse: bool, ) -> Self::Tensor<D>
Cumulative sum along axis.
Sourcefn cumprod<D: Num>(
x: Self::Tensor<D>,
axis: i32,
reverse: bool,
) -> Self::Tensor<D>
fn cumprod<D: Num>( x: Self::Tensor<D>, axis: i32, reverse: bool, ) -> Self::Tensor<D>
Cumulative product along axis.
Sourcefn sort<D: Num>(
x: Self::Tensor<D>,
dim: Option<i32>,
descending: bool,
) -> Self::Tensor<D>
fn sort<D: Num>( x: Self::Tensor<D>, dim: Option<i32>, descending: bool, ) -> Self::Tensor<D>
Sort along dim. dim = None sorts along the last dimension.
Sourcefn histogram(
x: Self::I32Tensor,
num_bins: i32,
mask: Option<Self::BoolTensor>,
) -> Self::I32Tensor
fn histogram( x: Self::I32Tensor, num_bins: i32, mask: Option<Self::BoolTensor>, ) -> Self::I32Tensor
Compute a histogram with num_bins bins (width 1, starting at 0).
mask: whenSome, masked-off elements are excluded (defaultNone).
Sourcefn reduce<D: Dtype, O: Dtype>(
x: Self::Tensor<D>,
axis: i32,
combine_fn: fn(Self::Tensor<O>, Self::Tensor<O>) -> Self::Tensor<O>,
keep_dims: bool,
) -> Self::Tensor<O>
fn reduce<D: Dtype, O: Dtype>( x: Self::Tensor<D>, axis: i32, combine_fn: fn(Self::Tensor<O>, Self::Tensor<O>) -> Self::Tensor<O>, keep_dims: bool, ) -> Self::Tensor<O>
Generic reduction along axis using a user-supplied combine function.
combine_fn must be a statically-known function pointer (corresponds to a
@triton.jit-decorated helper in Python Triton).
Sourcefn associative_scan<D: Dtype>(
x: Self::Tensor<D>,
axis: i32,
combine_fn: fn(Self::Tensor<D>, Self::Tensor<D>) -> Self::Tensor<D>,
reverse: bool,
) -> Self::Tensor<D>
fn associative_scan<D: Dtype>( x: Self::Tensor<D>, axis: i32, combine_fn: fn(Self::Tensor<D>, Self::Tensor<D>) -> Self::Tensor<D>, reverse: bool, ) -> Self::Tensor<D>
Generic prefix-scan along axis using a user-supplied combine function.
reverse: scan in the reverse direction (defaultfalse).
Sourcefn atomic_add<D: Num>(
ptr: Self::Tensor<Self::Pointer<D>>,
val: Self::Tensor<D>,
mask: Option<Self::BoolTensor>,
sem: Option<MemSem>,
scope: Option<MemScope>,
) -> Self::Tensor<D>
fn atomic_add<D: Num>( ptr: Self::Tensor<Self::Pointer<D>>, val: Self::Tensor<D>, mask: Option<Self::BoolTensor>, sem: Option<MemSem>, scope: Option<MemScope>, ) -> Self::Tensor<D>
Atomic add. Returns the previous value.
mask: whenSome, only masked lanes perform the operation (defaultNone).sem: memory ordering semantics (defaultNone= AcqRel).scope: synchronization scope (defaultNone= Gpu).
Sourcefn atomic_and<D: Int>(
ptr: Self::Tensor<Self::Pointer<D>>,
val: Self::Tensor<D>,
mask: Option<Self::BoolTensor>,
sem: Option<MemSem>,
scope: Option<MemScope>,
) -> Self::Tensor<D>
fn atomic_and<D: Int>( ptr: Self::Tensor<Self::Pointer<D>>, val: Self::Tensor<D>, mask: Option<Self::BoolTensor>, sem: Option<MemSem>, scope: Option<MemScope>, ) -> Self::Tensor<D>
Atomic bitwise AND. Returns the previous value. See Triton::atomic_add for parameters.
Sourcefn atomic_or<D: Int>(
ptr: Self::Tensor<Self::Pointer<D>>,
val: Self::Tensor<D>,
mask: Option<Self::BoolTensor>,
sem: Option<MemSem>,
scope: Option<MemScope>,
) -> Self::Tensor<D>
fn atomic_or<D: Int>( ptr: Self::Tensor<Self::Pointer<D>>, val: Self::Tensor<D>, mask: Option<Self::BoolTensor>, sem: Option<MemSem>, scope: Option<MemScope>, ) -> Self::Tensor<D>
Atomic bitwise OR. Returns the previous value. See Triton::atomic_add for parameters.
Sourcefn atomic_xor<D: Int>(
ptr: Self::Tensor<Self::Pointer<D>>,
val: Self::Tensor<D>,
mask: Option<Self::BoolTensor>,
sem: Option<MemSem>,
scope: Option<MemScope>,
) -> Self::Tensor<D>
fn atomic_xor<D: Int>( ptr: Self::Tensor<Self::Pointer<D>>, val: Self::Tensor<D>, mask: Option<Self::BoolTensor>, sem: Option<MemSem>, scope: Option<MemScope>, ) -> Self::Tensor<D>
Atomic bitwise XOR. Returns the previous value. See Triton::atomic_add for parameters.
Sourcefn atomic_max<D: Num>(
ptr: Self::Tensor<Self::Pointer<D>>,
val: Self::Tensor<D>,
mask: Option<Self::BoolTensor>,
sem: Option<MemSem>,
scope: Option<MemScope>,
) -> Self::Tensor<D>
fn atomic_max<D: Num>( ptr: Self::Tensor<Self::Pointer<D>>, val: Self::Tensor<D>, mask: Option<Self::BoolTensor>, sem: Option<MemSem>, scope: Option<MemScope>, ) -> Self::Tensor<D>
Atomic maximum. Returns the previous value. See Triton::atomic_add for parameters.
Sourcefn atomic_min<D: Num>(
ptr: Self::Tensor<Self::Pointer<D>>,
val: Self::Tensor<D>,
mask: Option<Self::BoolTensor>,
sem: Option<MemSem>,
scope: Option<MemScope>,
) -> Self::Tensor<D>
fn atomic_min<D: Num>( ptr: Self::Tensor<Self::Pointer<D>>, val: Self::Tensor<D>, mask: Option<Self::BoolTensor>, sem: Option<MemSem>, scope: Option<MemScope>, ) -> Self::Tensor<D>
Atomic minimum. Returns the previous value. See Triton::atomic_add for parameters.
Sourcefn atomic_xchg<D: Dtype>(
ptr: Self::Tensor<Self::Pointer<D>>,
val: Self::Tensor<D>,
mask: Option<Self::BoolTensor>,
sem: Option<MemSem>,
scope: Option<MemScope>,
) -> Self::Tensor<D>
fn atomic_xchg<D: Dtype>( ptr: Self::Tensor<Self::Pointer<D>>, val: Self::Tensor<D>, mask: Option<Self::BoolTensor>, sem: Option<MemSem>, scope: Option<MemScope>, ) -> Self::Tensor<D>
Atomic exchange. Returns the previous value. See Triton::atomic_add for parameters.
Sourcefn atomic_cas<D: Dtype>(
ptr: Self::Tensor<Self::Pointer<D>>,
cmp: Self::Tensor<D>,
val: Self::Tensor<D>,
sem: Option<MemSem>,
scope: Option<MemScope>,
) -> Self::Tensor<D>
fn atomic_cas<D: Dtype>( ptr: Self::Tensor<Self::Pointer<D>>, cmp: Self::Tensor<D>, val: Self::Tensor<D>, sem: Option<MemSem>, scope: Option<MemScope>, ) -> Self::Tensor<D>
Atomic compare-and-swap. Returns the previous value.
Sourcefn rand(seed: u32, offsets: Self::I32Tensor, n_rounds: i32) -> Self::Tensor<f32>
fn rand(seed: u32, offsets: Self::I32Tensor, n_rounds: i32) -> Self::Tensor<f32>
Uniform random f32 in [0, 1).
n_rounds: number of Philox rounds (default10).
Sourcefn randn(
seed: u32,
offsets: Self::I32Tensor,
n_rounds: i32,
) -> Self::Tensor<f32>
fn randn( seed: u32, offsets: Self::I32Tensor, n_rounds: i32, ) -> Self::Tensor<f32>
Standard-normal random f32.
n_rounds: number of Philox rounds (default10).
Sourcefn randint(
seed: u32,
offsets: Self::I32Tensor,
n_rounds: i32,
) -> Self::I32Tensor
fn randint( seed: u32, offsets: Self::I32Tensor, n_rounds: i32, ) -> Self::I32Tensor
Random i32.
n_rounds: number of Philox rounds (default10).
Sourcefn randint4x(
seed: u32,
offsets: Self::I32Tensor,
n_rounds: i32,
) -> (Self::I32Tensor, Self::I32Tensor, Self::I32Tensor, Self::I32Tensor)
fn randint4x( seed: u32, offsets: Self::I32Tensor, n_rounds: i32, ) -> (Self::I32Tensor, Self::I32Tensor, Self::I32Tensor, Self::I32Tensor)
Four random i32 streams (maximally efficient Philox entry point).
n_rounds: number of Philox rounds (default10).
Sourcefn inline_asm_elementwise<D: Dtype>(
asm: &str,
constraints: &str,
is_pure: bool,
pack: i32,
) -> Self::Tensor<D>
fn inline_asm_elementwise<D: Dtype>( asm: &str, constraints: &str, is_pure: bool, pack: i32, ) -> Self::Tensor<D>
Emit inline PTX/assembly applied element-wise across a tensor.
asm: the assembly template string.constraints: register constraint string.is_pure: whether the assembly has no side-effects (may be CSE’d).pack: number of elements packed into each register.
Sourcefn assume(cond: Self::BoolTensor)
fn assume(cond: Self::BoolTensor)
Assert that cond is always true, allowing the compiler to assume so.
Sourcefn multiple_of<D: Dtype>(x: Self::Tensor<D>, values: &[i32]) -> Self::Tensor<D>
fn multiple_of<D: Dtype>(x: Self::Tensor<D>, values: &[i32]) -> Self::Tensor<D>
Hint that values of x are always multiples of the given constants.
Sourcefn max_contiguous<D: Dtype>(
x: Self::Tensor<D>,
values: &[i32],
) -> Self::Tensor<D>
fn max_contiguous<D: Dtype>( x: Self::Tensor<D>, values: &[i32], ) -> Self::Tensor<D>
Hint that x has values[i] contiguous elements along dimension i.
Sourcefn max_constancy<D: Dtype>(
x: Self::Tensor<D>,
values: &[i32],
) -> Self::Tensor<D>
fn max_constancy<D: Dtype>( x: Self::Tensor<D>, values: &[i32], ) -> Self::Tensor<D>
Hint that x has values[i] constant elements along dimension i.
Sourcefn debug_barrier()
fn debug_barrier()
Insert a memory barrier for debugging purposes.
Sourcefn device_assert(
cond: Self::BoolTensor,
msg: &str,
mask: Option<Self::BoolTensor>,
)
fn device_assert( cond: Self::BoolTensor, msg: &str, mask: Option<Self::BoolTensor>, )
Emit a runtime assertion on the device. No-op when cond is true.
msg: message shown on assertion failure (default"").mask: whenSome, only lanes where mask istruecheck the assertion.
Sourcefn device_print<D: Dtype>(prefix: &str, val: Self::Tensor<D>, hex: bool)
fn device_print<D: Dtype>(prefix: &str, val: Self::Tensor<D>, hex: bool)
Print a tensor value from device code for debugging.
hex: print values in hexadecimal (defaultfalse).
Sourcefn static_assert(cond: bool, msg: &str)
fn static_assert(cond: bool, msg: &str)
Compile-time assertion (evaluated before kernel launch).
Sourcefn static_print(msg: &str)
fn static_print(msg: &str)
Compile-time print (evaluated before kernel launch).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.