Class ImmutableKernelInfo
- All Implemented Interfaces:
KernelInfo
KernelInfo
.
Use the builder to create immutable instances:
ImmutableKernelInfo.builder()
.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Builds instances of typeImmutableKernelInfo
. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final long
private final String
private final long
private final long
private final long
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
ImmutableKernelInfo
(String name, long workGroupSize, long preferredWorkGroupSizeMultiple, long localMemSize, long privateMemSize) -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableKernelInfo.Builder
builder()
Creates a builder forImmutableKernelInfo
.static ImmutableKernelInfo
copyOf
(KernelInfo instance) Creates an immutable copy of aKernelInfo
value.boolean
This instance is equal to all instances ofImmutableKernelInfo
that have equal attribute values.private boolean
equalTo
(int synthetic, ImmutableKernelInfo another) int
hashCode()
Computes a hash code from attributes:name
,workGroupSize
,preferredWorkGroupSizeMultiple
,localMemSize
,privateMemSize
.long
Returns the amount of local memory in bytes used by this kernel.name()
Returns the name of the kernel function.long
Returns the preferred work group size multiple for optimal kernel execution performance.long
Returns the minimum amount of private memory in bytes used by each work-item.toString()
Prints the immutable valueKernelInfo
with attribute values.final ImmutableKernelInfo
withLocalMemSize
(long value) Copy the current immutable object by setting a value for thelocalMemSize
attribute.final ImmutableKernelInfo
Copy the current immutable object by setting a value for thename
attribute.final ImmutableKernelInfo
withPreferredWorkGroupSizeMultiple
(long value) Copy the current immutable object by setting a value for thepreferredWorkGroupSizeMultiple
attribute.final ImmutableKernelInfo
withPrivateMemSize
(long value) Copy the current immutable object by setting a value for theprivateMemSize
attribute.final ImmutableKernelInfo
withWorkGroupSize
(long value) Copy the current immutable object by setting a value for theworkGroupSize
attribute.long
Returns 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:
name
in 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:
workGroupSize
in 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:
preferredWorkGroupSizeMultiple
in 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:
localMemSize
in 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:
privateMemSize
in interfaceKernelInfo
- Returns:
- the private memory usage in bytes per work-item
-
withName
Copy the current immutable object by setting a value for thename
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for name- Returns:
- A modified copy of the
this
object
-
withWorkGroupSize
Copy the current immutable object by setting a value for theworkGroupSize
attribute. 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 of the
this
object
-
withPreferredWorkGroupSizeMultiple
Copy the current immutable object by setting a value for thepreferredWorkGroupSizeMultiple
attribute. 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 of the
this
object
-
withLocalMemSize
Copy the current immutable object by setting a value for thelocalMemSize
attribute. 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 of the
this
object
-
withPrivateMemSize
Copy the current immutable object by setting a value for theprivateMemSize
attribute. 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 of the
this
object
-
equals
This instance is equal to all instances ofImmutableKernelInfo
that have equal attribute values. -
equalTo
-
hashCode
public int hashCode()Computes a hash code from attributes:name
,workGroupSize
,preferredWorkGroupSizeMultiple
,localMemSize
,privateMemSize
. -
toString
Prints the immutable valueKernelInfo
with attribute values. -
copyOf
Creates an immutable copy of aKernelInfo
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
Creates a builder forImmutableKernelInfo
.ImmutableKernelInfo.builder() .name(String) // required
name
.workGroupSize(long) // requiredworkGroupSize
.preferredWorkGroupSizeMultiple(long) // requiredpreferredWorkGroupSizeMultiple
.localMemSize(long) // requiredlocalMemSize
.privateMemSize(long) // requiredprivateMemSize
.build();- Returns:
- A new ImmutableKernelInfo builder
-