Skip to content

Commit 11c5856

Browse files
hdelankswiecicki
authored andcommitted
Add ur_usm_pool_flags_t entry
Add an entry so the user can specify if the native USM pool should be used.
1 parent 28ed14a commit 11c5856

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

include/ur_api.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -3350,15 +3350,16 @@ typedef enum ur_usm_device_mem_flag_t {
33503350
/// @brief USM memory property flags
33513351
typedef uint32_t ur_usm_pool_flags_t;
33523352
typedef enum ur_usm_pool_flag_t {
3353-
UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK = UR_BIT(0), ///< All coarse-grain allocations (allocations from the driver) will be
3354-
///< zero-initialized.
3353+
UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK = UR_BIT(0), ///< All coarse-grain allocations (allocations from the driver) will be
3354+
///< zero-initialized.
3355+
UR_USM_POOL_FLAG_USE_NATIVE_MEMORY_POOL_EXP = UR_BIT(1), ///< Use the native memory pool API
33553356
/// @cond
33563357
UR_USM_POOL_FLAG_FORCE_UINT32 = 0x7fffffff
33573358
/// @endcond
33583359

33593360
} ur_usm_pool_flag_t;
33603361
/// @brief Bit Mask for validating ur_usm_pool_flags_t
3361-
#define UR_USM_POOL_FLAGS_MASK 0xfffffffe
3362+
#define UR_USM_POOL_FLAGS_MASK 0xfffffffc
33623363

33633364
///////////////////////////////////////////////////////////////////////////////
33643365
/// @brief USM allocation type

include/ur_print.hpp

+13
Original file line numberDiff line numberDiff line change
@@ -6520,6 +6520,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_usm_pool_flag_t value)
65206520
case UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK:
65216521
os << "UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK";
65226522
break;
6523+
case UR_USM_POOL_FLAG_USE_NATIVE_MEMORY_POOL_EXP:
6524+
os << "UR_USM_POOL_FLAG_USE_NATIVE_MEMORY_POOL_EXP";
6525+
break;
65236526
default:
65246527
os << "unknown enumerator";
65256528
break;
@@ -6544,6 +6547,16 @@ inline ur_result_t printFlag<ur_usm_pool_flag_t>(std::ostream &os, uint32_t flag
65446547
}
65456548
os << UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK;
65466549
}
6550+
6551+
if ((val & UR_USM_POOL_FLAG_USE_NATIVE_MEMORY_POOL_EXP) == (uint32_t)UR_USM_POOL_FLAG_USE_NATIVE_MEMORY_POOL_EXP) {
6552+
val ^= (uint32_t)UR_USM_POOL_FLAG_USE_NATIVE_MEMORY_POOL_EXP;
6553+
if (!first) {
6554+
os << " | ";
6555+
} else {
6556+
first = false;
6557+
}
6558+
os << UR_USM_POOL_FLAG_USE_NATIVE_MEMORY_POOL_EXP;
6559+
}
65476560
if (val != 0) {
65486561
std::bitset<32> bits(val);
65496562
if (!first) {

scripts/core/exp-async-alloc.yml

+10
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ etors:
2323
value: "0x2021"
2424
desc: "[$x_bool_t] returns true if the device supports enqueueing of native work"
2525

26+
--- #--------------------------------------------------------------------------
27+
type: enum
28+
extend: true
29+
name: $x_usm_pool_flags_t
30+
desc: "USM memory property flag for creating a native USM pool"
31+
etors:
32+
- name: USE_NATIVE_MEMORY_POOL_EXP
33+
value: "$X_BIT(1)"
34+
desc: "Use the native memory pool API"
35+
2636
--- #--------------------------------------------------------------------------
2737
type: enum
2838
extend: true

0 commit comments

Comments
 (0)