Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCL][UR][L0] Use std::string instead of const char * in call map #10252

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ bool setEnvVar(const char *name, const char *value) {
ZeUSMImportExtension ZeUSMImport;

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

inline void zeParseError(ze_result_t ZeError, const char *&ErrorString) {
switch (ZeError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ class ZeUSMImportExtension {
extern ZeUSMImportExtension ZeUSMImport;

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

// Some opencl extensions we know are supported by all Level Zero devices.
constexpr char ZE_SUPPORTED_EXTENSIONS[] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urTearDown(
delete PiPlatformsCacheMutex;

bool LeakFound = false;

// Print the balance of various create/destroy native calls.
// The idea is to verify if the number of create(+) and destroy(-) calls are
// matched.
Expand All @@ -43,7 +44,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urTearDown(
// one are allocating objects of that type, while the last element is known
// to deallocate objects of that type.
//
std::vector<std::vector<const char *>> CreateDestroySet = {
std::vector<std::vector<std::string>> CreateDestroySet = {
{"zeContextCreate", "zeContextDestroy"},
{"zeCommandQueueCreate", "zeCommandQueueDestroy"},
{"zeModuleCreate", "zeModuleDestroy"},
Expand Down Expand Up @@ -83,7 +84,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urTearDown(
for (const auto &Row : CreateDestroySet) {
int diff = 0;
for (auto I = Row.begin(); I != Row.end();) {
const char *ZeName = *I;
const char *ZeName = (*I).c_str();
const auto &ZeCount = (*ZeCallCount)[*I];

bool First = (I == Row.begin());
Expand Down Expand Up @@ -137,7 +138,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urPlatformGet(
try {
std::call_once(ZeCallCountInitialized, []() {
if (UrL0Debug & UR_L0_DEBUG_CALL_COUNT) {
ZeCallCount = new std::map<const char *, int>;
ZeCallCount = new std::map<std::string, int>;
}
});
} catch (const std::bad_alloc &) {
Expand Down
Loading