Skip to content

Commit b5c04e4

Browse files
Jaime Arteagajaime.a.arteaga.molina
andauthored
[SYCL][UR][L0] Use std::string instead of const char * in call map (#10252)
Signed-off-by: jaime.a.arteaga.molina <[email protected]> Co-authored-by: jaime.a.arteaga.molina <[email protected]>
1 parent 9c7bd9e commit b5c04e4

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

sycl/plugins/unified_runtime/ur/adapters/level_zero/common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ bool setEnvVar(const char *name, const char *value) {
9090
ZeUSMImportExtension ZeUSMImport;
9191

9292
// This will count the calls to Level-Zero
93-
std::map<const char *, int> *ZeCallCount = nullptr;
93+
std::map<std::string, int> *ZeCallCount = nullptr;
9494

9595
inline void zeParseError(ze_result_t ZeError, const char *&ErrorString) {
9696
switch (ZeError) {

sycl/plugins/unified_runtime/ur/adapters/level_zero/common.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ class ZeUSMImportExtension {
451451
extern ZeUSMImportExtension ZeUSMImport;
452452

453453
// This will count the calls to Level-Zero
454-
extern std::map<const char *, int> *ZeCallCount;
454+
extern std::map<std::string, int> *ZeCallCount;
455455

456456
// Some opencl extensions we know are supported by all Level Zero devices.
457457
constexpr char ZE_SUPPORTED_EXTENSIONS[] =

sycl/plugins/unified_runtime/ur/adapters/level_zero/platform.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urTearDown(
3232
delete PiPlatformsCacheMutex;
3333

3434
bool LeakFound = false;
35+
3536
// Print the balance of various create/destroy native calls.
3637
// The idea is to verify if the number of create(+) and destroy(-) calls are
3738
// matched.
@@ -43,7 +44,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urTearDown(
4344
// one are allocating objects of that type, while the last element is known
4445
// to deallocate objects of that type.
4546
//
46-
std::vector<std::vector<const char *>> CreateDestroySet = {
47+
std::vector<std::vector<std::string>> CreateDestroySet = {
4748
{"zeContextCreate", "zeContextDestroy"},
4849
{"zeCommandQueueCreate", "zeCommandQueueDestroy"},
4950
{"zeModuleCreate", "zeModuleDestroy"},
@@ -83,7 +84,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urTearDown(
8384
for (const auto &Row : CreateDestroySet) {
8485
int diff = 0;
8586
for (auto I = Row.begin(); I != Row.end();) {
86-
const char *ZeName = *I;
87+
const char *ZeName = (*I).c_str();
8788
const auto &ZeCount = (*ZeCallCount)[*I];
8889

8990
bool First = (I == Row.begin());
@@ -137,7 +138,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urPlatformGet(
137138
try {
138139
std::call_once(ZeCallCountInitialized, []() {
139140
if (UrL0Debug & UR_L0_DEBUG_CALL_COUNT) {
140-
ZeCallCount = new std::map<const char *, int>;
141+
ZeCallCount = new std::map<std::string, int>;
141142
}
142143
});
143144
} catch (const std::bad_alloc &) {

0 commit comments

Comments
 (0)