Skip to content

[SYCL] Update get version #6025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2024
Merged
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
29 changes: 17 additions & 12 deletions ggml-sycl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,24 +202,29 @@ namespace dpct
// Version string has the following format:
// a. OpenCL<space><major.minor><space><vendor-specific-information>
// b. <major.minor>
// c. <AmdGcnArchName> e.g gfx1030
std::string ver;
ver = dev.get_info<sycl::info::device::version>();
std::string::size_type i = 0;
while (i < ver.size())
{
if (isdigit(ver[i]))
break;
i++;
while (i < ver.size()) {
if (isdigit(ver[i]))
break;
i++;
}
major = std::stoi(&(ver[i]));
while (i < ver.size())
{
if (ver[i] == '.')
break;
i++;
while (i < ver.size()) {
if (ver[i] == '.')
break;
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>
Expand Down