Update get version (#6025)

This commit is contained in:
AidanBeltonS 2024-03-13 13:17:54 +00:00 committed by GitHub
parent 99b71c068f
commit b3d978600f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -202,24 +202,29 @@ namespace dpct
// Version string has the following format: // Version string has the following format:
// a. OpenCL<space><major.minor><space><vendor-specific-information> // a. OpenCL<space><major.minor><space><vendor-specific-information>
// b. <major.minor> // b. <major.minor>
// c. <AmdGcnArchName> e.g gfx1030
std::string ver; std::string ver;
ver = dev.get_info<sycl::info::device::version>(); ver = dev.get_info<sycl::info::device::version>();
std::string::size_type i = 0; std::string::size_type i = 0;
while (i < ver.size()) while (i < ver.size()) {
{ if (isdigit(ver[i]))
if (isdigit(ver[i])) break;
break; i++;
i++;
} }
major = std::stoi(&(ver[i])); major = std::stoi(&(ver[i]));
while (i < ver.size()) while (i < ver.size()) {
{ if (ver[i] == '.')
if (ver[i] == '.') break;
break; i++;
i++; }
if (i < ver.size()) {
// a. and b.
i++;
minor = std::stoi(&(ver[i]));
} else {
// c.
minor = 0;
} }
i++;
minor = std::stoi(&(ver[i]));
} }
template <typename tag, typename T> template <typename tag, typename T>