Class GpuBuffer

java.lang.Object
io.github.kirstenali.deepj.tensor.GpuBuffer

public final class GpuBuffer extends Object
Handle to a GPU-resident float buffer managed by a ComputeGraph.

The buffer persists on the GPU across graph flushes until explicitly released. Not tied to any specific GPU API (Metal, CUDA, etc.).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    boolean
    True if the runtime has allocated native memory for this id.
    final int
     
    boolean
    True if GPU has newer data than Tensor.data (CPU cache is stale).
    final int
     
    boolean
    True if this buffer was just allocated and needs CPU data uploaded before use.
    final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    GpuBuffer(int id, int rows, int cols, boolean needsUpload)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • id

      public final int id
    • rows

      public final int rows
    • cols

      public final int cols
    • needsUpload

      public boolean needsUpload
      True if this buffer was just allocated and needs CPU data uploaded before use.
    • cpuStale

      public boolean cpuStale
      True if GPU has newer data than Tensor.data (CPU cache is stale).
    • allocatedOnGpu

      public boolean allocatedOnGpu
      True if the runtime has allocated native memory for this id.
  • Constructor Details

    • GpuBuffer

      public GpuBuffer(int id, int rows, int cols, boolean needsUpload)
  • Method Details

    • floatCount

      public int floatCount()