Skip to content
Open
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
22 changes: 15 additions & 7 deletions opencl/source/program/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,21 @@ void Program::updateNonUniformFlag() {
if (pos == std::string::npos) {
programOptionVersion = 12u; // Default is 1.2
} else {
std::stringstream ss{options.c_str() + pos + clStdOptionName.size()};
uint32_t majorV = 0u, minorV = 0u;
char dot = 0u;
ss >> majorV;
ss >> dot;
ss >> minorV;
programOptionVersion = majorV * 10u + minorV;
const std::string_view opt(options.c_str() + pos + clStdOptionName.size());

if (opt.find("CLC++") == 0 || opt.find("CLC++1.0") == 0) {
programOptionVersion = 20;
} else if (opt.find("CLC++2021") == 0) {
programOptionVersion = 30;
} else {
std::stringstream ss{options.c_str() + pos + clStdOptionName.size()};
uint32_t majorV = 0u, minorV = 0u;
char dot = 0u;
ss >> majorV;
ss >> dot;
ss >> minorV;
programOptionVersion = majorV * 10u + minorV;
}
}

if (programOptionVersion >= 20u && (false == CompilerOptions::contains(options, CompilerOptions::uniformWorkgroupSize))) {
Expand Down
14 changes: 12 additions & 2 deletions shared/source/helpers/compiler_options_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,19 @@ uint32_t getMajorVersion(const std::string &compileOptions) {
if (clStdValuePosition == std::string::npos) {
return 0;
}
std::stringstream ss{compileOptions.c_str() + clStdValuePosition + clStdOptionName.size()};

uint32_t majorVersion;
ss >> majorVersion;
const std::string_view opt(compileOptions.c_str() + clStdValuePosition + clStdOptionName.size());

if (opt.find("CLC++") == 0 || opt.find("CLC++1.0") == 0) {
majorVersion = 2;
} else if (opt.find("CLC++2021") == 0) {
majorVersion = 3;
} else {
std::stringstream ss{compileOptions.c_str() + clStdValuePosition + clStdOptionName.size()};
ss >> majorVersion;
}

return majorVersion;
}

Expand Down