Skip to content

Commit 8ee650d

Browse files
committed
[UR][L0] Make allocator tracing independent of setting the limits
Without this change, setting UR_L0_USM_ALLOCATOR_TRACE or SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR_TRACE only had an effect if UR_L0_USM_ALLOCATOR or SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR was also set.
1 parent a314dd8 commit 8ee650d

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

source/adapters/level_zero/usm.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@ ur_result_t umf2urResult(umf_result_t umfResult) {
4949
}
5050

5151
usm::DisjointPoolAllConfigs InitializeDisjointPoolConfig() {
52-
const char *PoolUrConfigVal = std::getenv("SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR");
53-
const char *PoolPiConfigVal = std::getenv("UR_L0_USM_ALLOCATOR");
54-
const char *PoolConfigVal =
55-
PoolUrConfigVal ? PoolUrConfigVal : PoolPiConfigVal;
56-
if (PoolConfigVal == nullptr) {
57-
return usm::DisjointPoolAllConfigs();
58-
}
59-
6052
const char *PoolUrTraceVal = std::getenv("UR_L0_USM_ALLOCATOR_TRACE");
6153
const char *PoolPiTraceVal =
6254
std::getenv("SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR_TRACE");
@@ -69,6 +61,14 @@ usm::DisjointPoolAllConfigs InitializeDisjointPoolConfig() {
6961
PoolTrace = std::atoi(PoolTraceVal);
7062
}
7163

64+
const char *PoolUrConfigVal = std::getenv("SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR");
65+
const char *PoolPiConfigVal = std::getenv("UR_L0_USM_ALLOCATOR");
66+
const char *PoolConfigVal =
67+
PoolUrConfigVal ? PoolUrConfigVal : PoolPiConfigVal;
68+
if (PoolConfigVal == nullptr) {
69+
return usm::DisjointPoolAllConfigs(PoolTrace);
70+
}
71+
7272
return usm::parseDisjointPoolConfig(PoolConfigVal, PoolTrace);
7373
}
7474

source/common/umf_pools/disjoint_pool_config_parser.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ constexpr auto operator""_GB(unsigned long long x) -> size_t {
2424
return x * 1024 * 1024 * 1024;
2525
}
2626

27-
DisjointPoolAllConfigs::DisjointPoolAllConfigs() {
27+
DisjointPoolAllConfigs::DisjointPoolAllConfigs(int trace) {
2828
Configs[DisjointPoolMemType::Host].name = "Host";
2929
Configs[DisjointPoolMemType::Device].name = "Device";
3030
Configs[DisjointPoolMemType::Shared].name = "Shared";
@@ -58,6 +58,10 @@ DisjointPoolAllConfigs::DisjointPoolAllConfigs() {
5858
Configs[DisjointPoolMemType::SharedReadOnly].MaxPoolableSize = 4_MB;
5959
Configs[DisjointPoolMemType::SharedReadOnly].Capacity = 4;
6060
Configs[DisjointPoolMemType::SharedReadOnly].SlabMinSize = 2_MB;
61+
62+
for (auto &Config : Configs) {
63+
Config.PoolTrace = trace;
64+
}
6165
}
6266

6367
DisjointPoolAllConfigs parseDisjointPoolConfig(const std::string &config,

source/common/umf_pools/disjoint_pool_config_parser.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class DisjointPoolAllConfigs {
2323
size_t EnableBuffers = 1;
2424
DisjointPoolConfig Configs[DisjointPoolMemType::All];
2525

26-
DisjointPoolAllConfigs();
26+
DisjointPoolAllConfigs(int trace = 0);
2727
};
2828

2929
// Parse optional config parameters of this form:

0 commit comments

Comments
 (0)