Skip to content

Commit b3d9786

Browse files
authored
Update get version (#6025)
1 parent 99b71c0 commit b3d9786

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

ggml-sycl.cpp

+17-12
Original file line numberDiff line numberDiff line change
@@ -202,24 +202,29 @@ namespace dpct
202202
// Version string has the following format:
203203
// a. OpenCL<space><major.minor><space><vendor-specific-information>
204204
// b. <major.minor>
205+
// c. <AmdGcnArchName> e.g gfx1030
205206
std::string ver;
206207
ver = dev.get_info<sycl::info::device::version>();
207208
std::string::size_type i = 0;
208-
while (i < ver.size())
209-
{
210-
if (isdigit(ver[i]))
211-
break;
212-
i++;
209+
while (i < ver.size()) {
210+
if (isdigit(ver[i]))
211+
break;
212+
i++;
213213
}
214214
major = std::stoi(&(ver[i]));
215-
while (i < ver.size())
216-
{
217-
if (ver[i] == '.')
218-
break;
219-
i++;
215+
while (i < ver.size()) {
216+
if (ver[i] == '.')
217+
break;
218+
i++;
219+
}
220+
if (i < ver.size()) {
221+
// a. and b.
222+
i++;
223+
minor = std::stoi(&(ver[i]));
224+
} else {
225+
// c.
226+
minor = 0;
220227
}
221-
i++;
222-
minor = std::stoi(&(ver[i]));
223228
}
224229

225230
template <typename tag, typename T>

0 commit comments

Comments
 (0)