2014-09-12 15:02:32 -04:00
|
|
|
#include "amdilUtils.hpp"
|
|
|
|
|
#include <regex>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
|
|
// Change all private uav length in a kernel
|
|
|
|
|
void amdilUtils::changePrivateUAVLength(std::string& kernel, unsigned length) {
|
|
|
|
|
std::regex pattern("dcl_typeless_uav_id\\(([[:digit:]]+)\\)_stride"
|
|
|
|
|
"\\(([[:digit:]]+)\\)_length\\([[:digit:]]+\\)_access\\(private\\)");
|
|
|
|
|
std::stringstream ss;
|
|
|
|
|
ss << "dcl_typeless_uav_id($1)_stride($2)_length(" << length <<
|
|
|
|
|
")_access(private)";
|
|
|
|
|
kernel = std::regex_replace(kernel, pattern, ss.str());
|
|
|
|
|
}
|
2014-10-29 22:56:55 -04:00
|
|
|
|
|
|
|
|
bool amdilUtils::isKernelMemoryBound(const std::string& kernel) {
|
|
|
|
|
std::istringstream is(kernel);
|
|
|
|
|
std::regex pattern("\\s*;\\s*membound\\s*:\\s*1\\s*");
|
|
|
|
|
while (is) {
|
|
|
|
|
std::string line;
|
|
|
|
|
is >> line;
|
|
|
|
|
if (std::regex_match(line, pattern))
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|