Fill | Modular

Mojo struct

@register_passable(trivial) struct Fill

Represents memory fill patterns for GPU memory operations.

This struct defines different fill patterns that can be used when allocating or initializing GPU memory. The patterns control how memory is initialized, which can be important for debugging and performance optimization.

Implemented traits

AnyType, Copyable, Equatable, ImplicitlyCopyable, ImplicitlyDestructible, Movable, RegisterPassable, TrivialRegisterPassable

comptime members

__copy_ctor_is_trivial

comptime __copy_ctor_is_trivial = True

__del__is_trivial

comptime __del__is_trivial = True

__move_ctor_is_trivial

comptime __move_ctor_is_trivial = True

NAN

comptime NAN = Fill(2)

Fill memory with NaN values. Useful for debugging floating point computations.

NONE

comptime NONE = Fill(0)

No fill pattern - memory is left uninitialized.

ZERO

comptime ZERO = Fill(1)

Fill memory with zeros.

Methods

__eq__

__eq__(self, other: Self) -> Bool

Tests if two Fill instances have the same fill pattern.

Args:

  • other (Self): The Fill instance to compare against.

Returns:

Bool: True if the fill patterns are equal, False otherwise.

__str__

__str__(self) -> String

Returns a string representation of the fill pattern.

Converts the fill pattern into a human-readable string for debugging and display purposes.

Returns:

String: A string describing the fill pattern.