Class ImmutableKernelInfo

java.lang.Object
net.bmahe.genetics4j.gpu.opencl.model.ImmutableKernelInfo
All Implemented Interfaces:
KernelInfo

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableKernelInfo extends Object implements KernelInfo
Immutable implementation of KernelInfo.

Use the builder to create immutable instances: ImmutableKernelInfo.builder().

  • Field Details

    • name

      private final String name
    • workGroupSize

      private final long workGroupSize
    • preferredWorkGroupSizeMultiple

      private final long preferredWorkGroupSizeMultiple
    • localMemSize

      private final long localMemSize
    • privateMemSize

      private final long privateMemSize
  • Constructor Details

    • ImmutableKernelInfo

      private ImmutableKernelInfo(String name, long workGroupSize, long preferredWorkGroupSizeMultiple, long localMemSize, long privateMemSize)
  • Method Details

    • name

      public String name()
      Returns the name of the kernel function.
      Specified by:
      name in interface KernelInfo
      Returns:
      the kernel function name as specified in the OpenCL program
    • workGroupSize

      public long workGroupSize()
      Returns the maximum work group size that can be used when executing this kernel on the device.

      This value represents the maximum number of work-items that can be in a work group when executing this specific kernel on the target device. It may be smaller than the device's general maximum work group size due to kernel-specific resource requirements.

      Specified by:
      workGroupSize in interface KernelInfo
      Returns:
      the maximum work group size for this kernel
    • preferredWorkGroupSizeMultiple

      public long preferredWorkGroupSizeMultiple()
      Returns the preferred work group size multiple for optimal kernel execution performance.

      For optimal performance, the work group size should be a multiple of this value. This represents the native vector width or wavefront size of the device and helps achieve better resource utilization and memory coalescing.

      Specified by:
      preferredWorkGroupSizeMultiple in interface KernelInfo
      Returns:
      the preferred work group size multiple for performance optimization
    • localMemSize

      public long localMemSize()
      Returns the amount of local memory in bytes used by this kernel.

      Local memory is shared among all work-items in a work group and includes both statically allocated local variables and dynamically allocated local memory passed as kernel arguments. This value is used to validate that the total local memory usage doesn't exceed the device's local memory capacity.

      Specified by:
      localMemSize in interface KernelInfo
      Returns:
      the local memory usage in bytes per work group
    • privateMemSize

      public long privateMemSize()
      Returns the minimum amount of private memory in bytes used by each work-item.

      Private memory is individual to each work-item and includes local variables, function call stacks, and other per-work-item data. This value helps estimate the total memory footprint when launching kernels with large work group sizes.

      Specified by:
      privateMemSize in interface KernelInfo
      Returns:
      the private memory usage in bytes per work-item
    • withName

      public final ImmutableKernelInfo withName(String value)
      Copy the current immutable object by setting a value for the name attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for name
      Returns:
      A modified copy of the this object
    • withWorkGroupSize

      public final ImmutableKernelInfo withWorkGroupSize(long value)
      Copy the current immutable object by setting a value for the workGroupSize attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for workGroupSize
      Returns:
      A modified copy of the this object
    • withPreferredWorkGroupSizeMultiple

      public final ImmutableKernelInfo withPreferredWorkGroupSizeMultiple(long value)
      Copy the current immutable object by setting a value for the preferredWorkGroupSizeMultiple attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for preferredWorkGroupSizeMultiple
      Returns:
      A modified copy of the this object
    • withLocalMemSize

      public final ImmutableKernelInfo withLocalMemSize(long value)
      Copy the current immutable object by setting a value for the localMemSize attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for localMemSize
      Returns:
      A modified copy of the this object
    • withPrivateMemSize

      public final ImmutableKernelInfo withPrivateMemSize(long value)
      Copy the current immutable object by setting a value for the privateMemSize attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for privateMemSize
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableKernelInfo that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • equalTo

      private boolean equalTo(int synthetic, ImmutableKernelInfo another)
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: name, workGroupSize, preferredWorkGroupSizeMultiple, localMemSize, privateMemSize.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value KernelInfo with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableKernelInfo copyOf(KernelInfo instance)
      Creates an immutable copy of a KernelInfo value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable KernelInfo instance
    • builder

      public static ImmutableKernelInfo.Builder builder()
      Creates a builder for ImmutableKernelInfo.
       ImmutableKernelInfo.builder()
          .name(String) // required name
          .workGroupSize(long) // required workGroupSize
          .preferredWorkGroupSizeMultiple(long) // required preferredWorkGroupSizeMultiple
          .localMemSize(long) // required localMemSize
          .privateMemSize(long) // required privateMemSize
          .build();
       
      Returns:
      A new ImmutableKernelInfo builder