Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dalg24 committed Aug 4, 2024
1 parent 64e7633 commit 523eafc
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions debugging/vov-bug-finder/kp_view_of_views_bug_finder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ namespace {
bool verbose = false;

std::atomic<uint64_t> events_count;

size_t const n = 256;
size_t const n = 128;
std::vector<std::string> events_description(n);
std::string get_event(uint64_t i) { return events_description[i % n]; }
void set_event(uint64_t i, std::string lbl) {
events_description[i % n] = std::move(lbl);
}

std::mutex current_mutex;
std::set<uint64_t> current;

std::string &get_event(uint64_t i) { return events_description[i % n]; }

std::optional<std::string> get_substr(std::string const &str,
std::string_view prefix,
std::string_view suffix) {
Expand All @@ -61,8 +62,7 @@ extern "C" void kokkosp_begin_parallel_for(char const *kernelName,
uint32_t deviceID,
uint64_t *kernelID) {
*kernelID = events_count++;

get_event(*kernelID) = kernelName;
set_event(*kernelID, kernelName);

std::lock_guard lock(current_mutex);
if (!current.empty()) {
Expand Down Expand Up @@ -98,13 +98,7 @@ extern "C" void kokkosp_end_parallel_for(uint64_t kernelID) {
extern "C" void kokkosp_begin_fence(char const *fenceName, uint32_t deviceID,
uint64_t *fenceID) {
*fenceID = events_count++;

get_event(*fenceID) = fenceName;

if (verbose) {
std::cout << "begin fence " << *fenceID << " " << fenceName << " on device "
<< deviceID << '\n';
}
set_event(*fenceID, fenceName);

std::lock_guard lock(current_mutex);
if (!current.empty() && (get_event(*fenceID) != "Foo") &&
Expand All @@ -117,6 +111,11 @@ extern "C" void kokkosp_begin_fence(char const *fenceName, uint32_t deviceID,
<< "\" will hang\n";
}
}

if (verbose) {
std::cout << "begin fence " << *fenceID << " " << fenceName << " on device "
<< deviceID << '\n';
}
}

extern "C" void kokkosp_end_fence(uint64_t fenceID) {
Expand Down

0 comments on commit 523eafc

Please sign in to comment.