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

Fix an issue in simple-kernel-timer with mismatched linked symbols #199

Merged
merged 1 commit into from
Aug 3, 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
33 changes: 33 additions & 0 deletions profiling/simple-kernel-timer/kp_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,38 @@ char* outputDelimiter;
int current_region_level = 0;
KernelPerformanceInfo* regions[512];

void increment_counter(const char* name, KernelExecutionType kType) {
std::string nameStr(name);

if (count_map.find(name) == count_map.end()) {
KernelPerformanceInfo* info = new KernelPerformanceInfo(nameStr, kType);
count_map.insert(
std::pair<std::string, KernelPerformanceInfo*>(nameStr, info));

currentEntry = info;
} else {
currentEntry = count_map[nameStr];
}

currentEntry->startTimer();
}

void increment_counter_region(const char* name, KernelExecutionType kType) {
std::string nameStr(name);

if (count_map.find(name) == count_map.end()) {
KernelPerformanceInfo* info = new KernelPerformanceInfo(nameStr, kType);
count_map.insert(
std::pair<std::string, KernelPerformanceInfo*>(nameStr, info));

regions[current_region_level] = info;
} else {
regions[current_region_level] = count_map[nameStr];
}

regions[current_region_level]->startTimer();
current_region_level++;
}

} // namespace KernelTimer
} // namespace KokkosTools
35 changes: 2 additions & 33 deletions profiling/simple-kernel-timer/kp_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,39 +31,8 @@ extern char* outputDelimiter;
extern int current_region_level;
extern KernelPerformanceInfo* regions[512];

inline void increment_counter(const char* name, KernelExecutionType kType) {
std::string nameStr(name);

if (count_map.find(name) == count_map.end()) {
KernelPerformanceInfo* info = new KernelPerformanceInfo(nameStr, kType);
count_map.insert(
std::pair<std::string, KernelPerformanceInfo*>(nameStr, info));

currentEntry = info;
} else {
currentEntry = count_map[nameStr];
}

currentEntry->startTimer();
}

inline void increment_counter_region(const char* name,
KernelExecutionType kType) {
std::string nameStr(name);

if (count_map.find(name) == count_map.end()) {
KernelPerformanceInfo* info = new KernelPerformanceInfo(nameStr, kType);
count_map.insert(
std::pair<std::string, KernelPerformanceInfo*>(nameStr, info));

regions[current_region_level] = info;
} else {
regions[current_region_level] = count_map[nameStr];
}

regions[current_region_level]->startTimer();
current_region_level++;
}
void increment_counter(const char* name, KernelExecutionType kType);
void increment_counter_region(const char* name, KernelExecutionType kType);

inline bool compareKernelPerformanceInfo(KernelPerformanceInfo* left,
KernelPerformanceInfo* right) {
Expand Down