Skip to content

Commit 50c37eb

Browse files
author
Petr Vesely
committed
[UR] Fix params test
1 parent 41af239 commit 50c37eb

File tree

6 files changed

+23
-22
lines changed

6 files changed

+23
-22
lines changed

include/ur.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,6 @@ class ur_device_partition_property_t(c_intptr_t):
591591
class ur_device_partition_v(IntEnum):
592592
EQUALLY = 0x1086 ## Partition Equally
593593
BY_COUNTS = 0x1087 ## Partition by counts
594-
BY_COUNTS_LIST_END = 0x0 ## End of by counts list
595594
BY_AFFINITY_DOMAIN = 0x1088 ## Partition by affinity domain
596595
BY_CSLICE = 0x1089 ## Partition by c-slice
597596

include/ur_api.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,6 @@ typedef intptr_t ur_device_partition_property_t;
10241024
typedef enum ur_device_partition_t {
10251025
UR_DEVICE_PARTITION_EQUALLY = 0x1086, ///< Partition Equally
10261026
UR_DEVICE_PARTITION_BY_COUNTS = 0x1087, ///< Partition by counts
1027-
UR_DEVICE_PARTITION_BY_COUNTS_LIST_END = 0x0, ///< End of by counts list
10281027
UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN = 0x1088, ///< Partition by affinity domain
10291028
UR_DEVICE_PARTITION_BY_CSLICE = 0x1089, ///< Partition by c-slice
10301029
/// @cond

scripts/core/device.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,6 @@ etors:
493493
- name: BY_COUNTS
494494
desc: "Partition by counts"
495495
value: "0x1087"
496-
- name: BY_COUNTS_LIST_END
497-
desc: "End of by counts list"
498-
value: "0x0"
499496
- name: BY_AFFINITY_DOMAIN
500497
desc: "Partition by affinity domain"
501498
value: "0x1088"

source/common/ur_params.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3280,10 +3280,6 @@ inline std::ostream &operator<<(std::ostream &os,
32803280
os << "UR_DEVICE_PARTITION_BY_COUNTS";
32813281
break;
32823282

3283-
case UR_DEVICE_PARTITION_BY_COUNTS_LIST_END:
3284-
os << "UR_DEVICE_PARTITION_BY_COUNTS_LIST_END";
3285-
break;
3286-
32873283
case UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN:
32883284
os << "UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN";
32893285
break;

source/common/ur_pool_manager.hpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,33 @@ struct pool_descriptor {
3535

3636
static inline std::pair<ur_result_t, std::vector<ur_device_handle_t>>
3737
urGetSubDevices(ur_device_handle_t hDevice) {
38-
size_t nComputeUnits;
38+
uint32_t nComputeUnits;
3939
auto ret = urDeviceGetInfo(hDevice, UR_DEVICE_INFO_MAX_COMPUTE_UNITS,
4040
sizeof(nComputeUnits), &nComputeUnits, nullptr);
4141
if (ret != UR_RESULT_SUCCESS) {
4242
return {ret, {}};
4343
}
4444

45-
ur_device_partition_property_t properties[] = {
46-
UR_DEVICE_PARTITION_EQUALLY,
47-
static_cast<ur_device_partition_property_t>(nComputeUnits), 0};
45+
// ur_device_partition_property_t properties[] = {
46+
// UR_DEVICE_PARTITION_EQUALLY,
47+
// static_cast<ur_device_partition_property_t>(nComputeUnits), 0};
48+
49+
ur_device_partition_equally_desc_t part_eq_desc{
50+
UR_STRUCTURE_TYPE_DEVICE_PARTITION_EQUALLY_DESC, nullptr,
51+
nComputeUnits};
52+
53+
ur_device_partition_desc_t part_desc{
54+
UR_STRUCTURE_TYPE_DEVICE_PARTITION_DESC, &part_eq_desc};
4855

4956
// Get the number of devices that will be created
5057
uint32_t deviceCount;
51-
ret = urDevicePartition(hDevice, properties, 0, nullptr, &deviceCount);
58+
ret = urDevicePartition(hDevice, &part_desc, 0, nullptr, &deviceCount);
5259
if (ret != UR_RESULT_SUCCESS) {
5360
return {ret, {}};
5461
}
5562

5663
std::vector<ur_device_handle_t> sub_devices(deviceCount);
57-
ret = urDevicePartition(hDevice, properties,
64+
ret = urDevicePartition(hDevice, &part_desc,
5865
static_cast<uint32_t>(sub_devices.size()),
5966
sub_devices.data(), nullptr);
6067
if (ret != UR_RESULT_SUCCESS) {
@@ -135,7 +142,7 @@ inline bool pool_descriptor::equal(const pool_descriptor &lhs,
135142
(isSharedAllocationReadOnlyOnDevice(lhs) ==
136143
isSharedAllocationReadOnlyOnDevice(rhs)) &&
137144
lhs.poolHandle == rhs.poolHandle;
138-
};
145+
}
139146

140147
inline std::size_t pool_descriptor::hash(const pool_descriptor &desc) {
141148
ur_native_handle_t native;
@@ -147,7 +154,7 @@ inline std::size_t pool_descriptor::hash(const pool_descriptor &desc) {
147154
return combine_hashes(0, desc.type, native,
148155
isSharedAllocationReadOnlyOnDevice(desc),
149156
desc.poolHandle);
150-
};
157+
}
151158

152159
inline std::pair<ur_result_t, std::vector<pool_descriptor>>
153160
pool_descriptor::create(ur_usm_pool_handle_t poolHandle,

test/unit/utils/params.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ struct UrDeviceGetInfoParamsInvalidSize : UrDeviceGetInfoParams {
239239
};
240240

241241
struct UrDeviceGetInfoParamsPartitionArray : UrDeviceGetInfoParams {
242-
ur_device_partition_property_t props[3] = {
243-
UR_DEVICE_PARTITION_BY_COUNTS, UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN,
244-
UR_DEVICE_PARTITION_BY_CSLICE};
242+
ur_device_partition_t props[4] = {
243+
UR_DEVICE_PARTITION_EQUALLY, UR_DEVICE_PARTITION_BY_COUNTS,
244+
UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, UR_DEVICE_PARTITION_BY_CSLICE};
245245
UrDeviceGetInfoParamsPartitionArray() : UrDeviceGetInfoParams() {
246246
propName = UR_DEVICE_INFO_PARTITION_PROPERTIES;
247247
pPropValue = &props;
@@ -251,8 +251,11 @@ struct UrDeviceGetInfoParamsPartitionArray : UrDeviceGetInfoParams {
251251
const char *get_expected() {
252252
return ".hDevice = nullptr, .propName = "
253253
"UR_DEVICE_INFO_PARTITION_PROPERTIES, .propSize "
254-
"= 24, .pPropValue = \\[4231, 4232, 4233\\], .pPropSizeRet = .+ "
255-
"\\(24\\)";
254+
"= 16, .pPropValue = \\[UR_DEVICE_PARTITION_EQUALLY, "
255+
"UR_DEVICE_PARTITION_BY_COUNTS, "
256+
"UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, "
257+
"UR_DEVICE_PARTITION_BY_CSLICE\\], .pPropSizeRet = .+ "
258+
"\\(16\\)";
256259
// TODO: should resolve type values for ur_device_partition_property_t...
257260
};
258261
};

0 commit comments

Comments
 (0)