@@ -734,12 +734,25 @@ public static PartitionType getEnum(long v) {
734
734
735
735
@InfoName(" CL_DEVICE_PARTITION_PROPERTIES ")
736
736
public EnumSet<PartitionType> getPartitionProperties() {
737
+ return getPartitionTypeInfo(CL_DEVICE_PARTITION_PROPERTIES);
738
+ }
739
+
740
+ @InfoName(" CL_DEVICE_PARTITION_TYPE ")
741
+ public EnumSet<PartitionType> getPartitionType() {
742
+ return getPartitionTypeInfo(CL_DEVICE_PARTITION_TYPE);
743
+ }
744
+
745
+ private EnumSet<PartitionType> getPartitionTypeInfo(int info) {
737
746
EnumSet<PartitionType> ret = EnumSet.noneOf(PartitionType.class);
738
- Pointer<?> ptr = infos.getPointer(getEntity(), CL_DEVICE_PARTITION_PROPERTIES); ;
747
+ Pointer<?> ptr = infos.getPointer(getEntity(), info) ;
739
748
if (ptr != null) {
740
749
Pointer<SizeT> props = ptr.as(SizeT.class);
741
750
for (long i = 0, n = props.getValidElements(); i < n; i++) {
742
- ret.add(PartitionType.getEnum(props.getSizeTAtIndex(i)));
751
+ long value = props.getSizeTAtIndex(i);
752
+ if (value == 0) {
753
+ break;
754
+ }
755
+ ret.add(PartitionType.getEnum(value));
743
756
}
744
757
}
745
758
return ret;
@@ -756,7 +769,11 @@ public EnumSet<AffinityDomain> getPartitionAffinityDomains() {
756
769
if (ptr != null) {
757
770
Pointer<SizeT> props = ptr.as(SizeT.class);
758
771
for (long i = 0, n = props.getValidElements(); i < n; i++) {
759
- ret.add(AffinityDomain.getEnum(props.getSizeTAtIndex(i)));
772
+ long value = props.getSizeTAtIndex(i);
773
+ if (value == 0) {
774
+ break;
775
+ }
776
+ ret.add(AffinityDomain.getEnum(value));
760
777
}
761
778
}
762
779
return ret;
0 commit comments