Documentation

Hesper.Training.SafeBuffer

Safe Buffer Operations #

Type-safe buffer read/write utilities with runtime bounds checking. Backend-agnostic via [GPUBackend β].

Safely read a UInt32 (4 bytes LE) from a ByteArray. Returns 0 if out of bounds.

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    Safely read a Float32 from a ByteArray at the given byte offset.

    Equations
    Instances For

      Safely read N Float32 values starting at byte offset 0.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        @[inline]
        def Hesper.Training.SafeBuffer.safeMapBufferReadF32 {β : Type} [GPUBackend β] (ctx : β) (buf : GPUBackend.Buf β) (numElements : Nat) :

        Safely read a GPU buffer and return Float32 values.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          @[inline]
          def Hesper.Training.SafeBuffer.safeReadF32 {β : Type} [GPUBackend β] (ctx : β) (buf : GPUBackend.Buf β) (elementIdx : Nat := 0) :

          Safely read a single Float32 from a GPU buffer at element index.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            @[inline]
            def Hesper.Training.SafeBuffer.hasNaN {β : Type} [GPUBackend β] (ctx : β) (buf : GPUBackend.Buf β) (numElements : Nat) :

            Check if any value in a GPU buffer is NaN.

            Equations
            Instances For