Update get version (llama/6025)

gg/alloc-enc-results
AidanBeltonS 2024-03-13 13:17:54 +00:00 committed by Georgi Gerganov
parent 46e3c3f112
commit 2bddfdd7c8
No known key found for this signature in database
GPG Key ID: BF970631944C16B7
1 changed files with 17 additions and 12 deletions

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>