[HIPIFY][fix] Fix typo and functions' string arguments
+ Fix typo with missing comma in counterNames array + Change std::string argument to const std::string& argument in all functions
This commit is contained in:
1 parent
9fdc1cb875
commit
48abb4a36b
4 files changed
+14
-14
No files matched your search
@@ -14,7 +14,7 @@ const char *counterNames[NUM_CONV_TYPES] = {
|
|||||||
"addressing", // CONV_ADDRESSING
|
"addressing", // CONV_ADDRESSING
|
||||||
"stream", // CONV_STREAM
|
"stream", // CONV_STREAM
|
||||||
"event", // CONV_EVENT
|
"event", // CONV_EVENT
|
||||||
"external_resource_interop" // CONV_EXT_RES
|
"external_resource_interop", // CONV_EXT_RES
|
||||||
"stream_memory", // CONV_STREAM_MEMORY
|
"stream_memory", // CONV_STREAM_MEMORY
|
||||||
"execution", // CONV_EXECUTION
|
"execution", // CONV_EXECUTION
|
||||||
"graph", // CONV_GRAPH
|
"graph", // CONV_GRAPH
|
||||||
@@ -74,7 +74,7 @@ void printStat(std::ostream *csv, llvm::raw_ostream* printOut, const std::string
|
|||||||
|
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
void StatCounter::incrementCounter(const hipCounter& counter, std::string name) {
|
void StatCounter::incrementCounter(const hipCounter& counter, const std::string& name) {
|
||||||
counters[name]++;
|
counters[name]++;
|
||||||
apiCounters[(int) counter.apiType]++;
|
apiCounters[(int) counter.apiType]++;
|
||||||
convTypeCounters[(int) counter.type]++;
|
convTypeCounters[(int) counter.type]++;
|
||||||
@@ -100,7 +100,7 @@ int StatCounter::getConvSum() {
|
|||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatCounter::print(std::ostream* csv, llvm::raw_ostream* printOut, std::string prefix) {
|
void StatCounter::print(std::ostream* csv, llvm::raw_ostream* printOut, const std::string& prefix) {
|
||||||
conditionalPrint(csv, printOut, "\nCUDA ref type;Count\n", "[HIPIFY] info: " + prefix + " refs by type:\n");
|
conditionalPrint(csv, printOut, "\nCUDA ref type;Count\n", "[HIPIFY] info: " + prefix + " refs by type:\n");
|
||||||
for (int i = 0; i < NUM_CONV_TYPES; i++) {
|
for (int i = 0; i < NUM_CONV_TYPES; i++) {
|
||||||
if (convTypeCounters[i] > 0) {
|
if (convTypeCounters[i] > 0) {
|
||||||
@@ -117,7 +117,7 @@ void StatCounter::print(std::ostream* csv, llvm::raw_ostream* printOut, std::str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Statistics::Statistics(std::string name): fileName(name) {
|
Statistics::Statistics(const std::string& name): fileName(name) {
|
||||||
// Compute the total bytes/lines in the input file.
|
// Compute the total bytes/lines in the input file.
|
||||||
std::ifstream src_file(name, std::ios::binary | std::ios::ate);
|
std::ifstream src_file(name, std::ios::binary | std::ios::ate);
|
||||||
src_file.clear();
|
src_file.clear();
|
||||||
@@ -129,7 +129,7 @@ Statistics::Statistics(std::string name): fileName(name) {
|
|||||||
|
|
||||||
///////// Counter update routines //////////
|
///////// Counter update routines //////////
|
||||||
|
|
||||||
void Statistics::incrementCounter(const hipCounter &counter, std::string name) {
|
void Statistics::incrementCounter(const hipCounter &counter, const std::string& name) {
|
||||||
if (counter.unsupported) {
|
if (counter.unsupported) {
|
||||||
unsupported.incrementCounter(counter, name);
|
unsupported.incrementCounter(counter, name);
|
||||||
} else {
|
} else {
|
||||||
@@ -218,7 +218,7 @@ Statistics& Statistics::current() {
|
|||||||
return *Statistics::currentStatistics;
|
return *Statistics::currentStatistics;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Statistics::setActive(std::string name) {
|
void Statistics::setActive(const std::string& name) {
|
||||||
stats.emplace(std::make_pair(name, Statistics{name}));
|
stats.emplace(std::make_pair(name, Statistics{name}));
|
||||||
Statistics::currentStatistics = &stats.at(name);
|
Statistics::currentStatistics = &stats.at(name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ enum ConvTypes {
|
|||||||
// Driver API : 5.5. Device Management, 5.6. Device Management [DEPRECATED]
|
// Driver API : 5.5. Device Management, 5.6. Device Management [DEPRECATED]
|
||||||
// Runtime API: 5.1. Device Management
|
// Runtime API: 5.1. Device Management
|
||||||
CONV_DEVICE,
|
CONV_DEVICE,
|
||||||
// Driver API : 5.8.Context Management, 5.9. Context Management [DEPRECATED]
|
// Driver API : 5.7. Primary Context Management, 5.8.Context Management, 5.9. Context Management [DEPRECATED]
|
||||||
CONV_CONTEXT,
|
CONV_CONTEXT,
|
||||||
// Driver API : 5.10. Module Management
|
// Driver API : 5.10. Module Management
|
||||||
CONV_MODULE,
|
CONV_MODULE,
|
||||||
@@ -134,11 +134,11 @@ private:
|
|||||||
int convTypeCounters[NUM_CONV_TYPES] = {};
|
int convTypeCounters[NUM_CONV_TYPES] = {};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void incrementCounter(const hipCounter& counter, std::string name);
|
void incrementCounter(const hipCounter& counter, const std::string& name);
|
||||||
// Add the counters from `other` onto the counters of this object.
|
// Add the counters from `other` onto the counters of this object.
|
||||||
void add(const StatCounter& other);
|
void add(const StatCounter& other);
|
||||||
int getConvSum();
|
int getConvSum();
|
||||||
void print(std::ostream* csv, llvm::raw_ostream* printOut, std::string prefix);
|
void print(std::ostream* csv, llvm::raw_ostream* printOut, const std::string& prefix);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -156,8 +156,8 @@ class Statistics {
|
|||||||
chr::steady_clock::time_point completionTime;
|
chr::steady_clock::time_point completionTime;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Statistics(std::string name);
|
Statistics(const std::string& name);
|
||||||
void incrementCounter(const hipCounter &counter, std::string name);
|
void incrementCounter(const hipCounter &counter, const std::string& name);
|
||||||
// Add the counters from `other` onto the counters of this object.
|
// Add the counters from `other` onto the counters of this object.
|
||||||
void add(const Statistics &other);
|
void add(const Statistics &other);
|
||||||
void lineTouched(int lineNumber);
|
void lineTouched(int lineNumber);
|
||||||
@@ -192,5 +192,5 @@ public:
|
|||||||
* Set the active Statistics object to the named one, creating it if necessary, and write the completion
|
* Set the active Statistics object to the named one, creating it if necessary, and write the completion
|
||||||
* timestamp into the currently active one.
|
* timestamp into the currently active one.
|
||||||
*/
|
*/
|
||||||
static void setActive(std::string name);
|
static void setActive(const std::string& name);
|
||||||
};
|
};
|
||||||
@@ -7,7 +7,7 @@ llvm::StringRef unquoteStr(llvm::StringRef s) {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void removePrefixIfPresent(std::string &s, std::string prefix) {
|
void removePrefixIfPresent(std::string &s, const std::string& prefix) {
|
||||||
if (s.find(prefix) != 0) {
|
if (s.find(prefix) != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,4 +11,4 @@ llvm::StringRef unquoteStr(llvm::StringRef s);
|
|||||||
/**
|
/**
|
||||||
* If `s` starts with `prefix`, remove it. Otherwise, does nothing.
|
* If `s` starts with `prefix`, remove it. Otherwise, does nothing.
|
||||||
*/
|
*/
|
||||||
void removePrefixIfPresent(std::string &s, std::string prefix);
|
void removePrefixIfPresent(std::string &s, const std::string& prefix);
|
||||||
Reference in new issue
Block a user