Class ImmutableKernelInfo
- All Implemented Interfaces:
KernelInfo
KernelInfo.
Use the builder to create immutable instances:
ImmutableKernelInfo.builder().
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final longprivate final Stringprivate final longprivate final longprivate final long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateImmutableKernelInfo(String name, long workGroupSize, long preferredWorkGroupSizeMultiple, long localMemSize, long privateMemSize) -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableKernelInfo.Builderbuilder()Creates a builder forKernelInfo.static KernelInfocopyOf(KernelInfo instance) Creates an immutable copy of aKernelInfovalue.booleanThis instance is equal to all instances ofImmutableKernelInfothat have equal attribute values.private booleanequalsByValue(ImmutableKernelInfo another) inthashCode()Computes a hash code from attributes:name,workGroupSize,preferredWorkGroupSizeMultiple,localMemSize,privateMemSize.longReturns the amount of local memory in bytes used by this kernel.name()Returns the name of the kernel function.longReturns the preferred work group size multiple for optimal kernel execution performance.longReturns the minimum amount of private memory in bytes used by each work-item.toString()Prints the immutable valueKernelInfowith attribute values.final ImmutableKernelInfowithLocalMemSize(long value) Copy the current immutable object by setting a value for thelocalMemSizeattribute.final ImmutableKernelInfoCopy the current immutable object by setting a value for thenameattribute.final ImmutableKernelInfowithPreferredWorkGroupSizeMultiple(long value) Copy the current immutable object by setting a value for thepreferredWorkGroupSizeMultipleattribute.final ImmutableKernelInfowithPrivateMemSize(long value) Copy the current immutable object by setting a value for theprivateMemSizeattribute.final ImmutableKernelInfowithWorkGroupSize(long value) Copy the current immutable object by setting a value for theworkGroupSizeattribute.longReturns the maximum work group size that can be used when executing this kernel on the device.
-
Field Details
-
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
Returns the name of the kernel function.- Specified by:
namein interfaceKernelInfo- 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:
workGroupSizein interfaceKernelInfo- 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:
preferredWorkGroupSizeMultiplein interfaceKernelInfo- 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:
localMemSizein interfaceKernelInfo- 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:
privateMemSizein interfaceKernelInfo- Returns:
- the private memory usage in bytes per work-item
-
withName
Copy the current immutable object by setting a value for thenameattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for name- Returns:
- A modified copy or the
thisobject
-
withWorkGroupSize
Copy the current immutable object by setting a value for theworkGroupSizeattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for workGroupSize- Returns:
- A modified copy or the
thisobject
-
withPreferredWorkGroupSizeMultiple
Copy the current immutable object by setting a value for thepreferredWorkGroupSizeMultipleattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for preferredWorkGroupSizeMultiple- Returns:
- A modified copy or the
thisobject
-
withLocalMemSize
Copy the current immutable object by setting a value for thelocalMemSizeattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for localMemSize- Returns:
- A modified copy or the
thisobject
-
withPrivateMemSize
Copy the current immutable object by setting a value for theprivateMemSizeattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for privateMemSize- Returns:
- A modified copy or the
thisobject
-
equals
This instance is equal to all instances ofImmutableKernelInfothat have equal attribute values. -
equalsByValue
-
hashCode
public int hashCode()Computes a hash code from attributes:name,workGroupSize,preferredWorkGroupSizeMultiple,localMemSize,privateMemSize. -
toString
Prints the immutable valueKernelInfowith attribute values. -
copyOf
Creates an immutable copy of aKernelInfovalue. 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
Creates a builder forKernelInfo.ImmutableKernelInfo.builder() .name(String) // requiredname.workGroupSize(long) // requiredworkGroupSize.preferredWorkGroupSizeMultiple(long) // requiredpreferredWorkGroupSizeMultiple.localMemSize(long) // requiredlocalMemSize.privateMemSize(long) // requiredprivateMemSize.build();- Returns:
- A new KernelInfo builder
-