Skip to content

Commit 810a577

Browse files
authored
Merge pull request #1172 from igchor/fix_tracing_pool
Fix tracing param in disjoint_pool_parser
2 parents fb83446 + 8ee650d commit 810a577

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

source/adapters/level_zero/usm.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,26 @@ 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");
6355
const char *PoolTraceVal = PoolUrTraceVal
6456
? PoolUrTraceVal
6557
: (PoolPiTraceVal ? PoolPiTraceVal : nullptr);
6658

67-
bool PoolTrace = false;
59+
int PoolTrace = 0;
6860
if (PoolTraceVal != nullptr) {
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: 6 additions & 2 deletions
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,10 +58,14 @@ 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,
64-
bool trace) {
68+
int trace) {
6569
DisjointPoolAllConfigs AllConfigs;
6670

6771
// TODO: replace with UR ENV var parser and avoid creating a copy of 'config'

source/common/umf_pools/disjoint_pool_config_parser.hpp

Lines changed: 2 additions & 2 deletions
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:
@@ -51,7 +51,7 @@ class DisjointPoolAllConfigs {
5151
// Example of usage:
5252
// "1;32M;host:1M,4,64K;device:1M,4,64K;shared:0,0,2M"
5353
DisjointPoolAllConfigs parseDisjointPoolConfig(const std::string &config,
54-
bool trace = 1);
54+
int trace = 1);
5555
} // namespace usm
5656

5757
#endif

0 commit comments

Comments
 (0)