Skip to content

[SYCL] Fix Kernel Compiler OpenCLC_Supports_Extension #14959

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 3 commits into from
Aug 6, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,12 @@ bool OpenCLC_Supports_Extension(
"trouble parsing query returned from CL_DEVICE_EXTENSIONS_WITH_VERSION "
"- extension not followed by colon (:)");
}

// Note that VersionPtr is an optional parameter in
// ext_oneapi_supports_cl_extension().
if (!VersionPtr)
return true;

colon++; // move it forward

size_t space = ExtensionByVersionLog.find(' ', colon); // could be npos
Expand All @@ -360,7 +366,6 @@ bool OpenCLC_Supports_Extension(
VersionPtr->major = std::stoi(versionVec[0]);
VersionPtr->minor = std::stoi(versionVec[1]);
VersionPtr->patch = std::stoi(versionVec[2]);

return true;
}

Expand Down
20 changes: 20 additions & 0 deletions sycl/test-e2e/KernelCompiler/opencl_queries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ int main() {
"version not updated");
}

// test without version pointer
bool has_bf16_conversion =
d.ext_oneapi_supports_cl_extension("cl_intel_bf16_conversion");
std::cout << "has_bf16_conversion: " << has_bf16_conversion << std::endl;
bool has_subgroup_matrix_multiply_accumulate =
d.ext_oneapi_supports_cl_extension(
"cl_intel_subgroup_matrix_multiply_accumulate");
std::cout << "has_subgroup_matrix_multiply_accumulate: "
<< has_subgroup_matrix_multiply_accumulate << std::endl;
bool has_subgroup_matrix_multiply_accumulate_tensor_float32 =
d.ext_oneapi_supports_cl_extension(
"cl_intel_subgroup_matrix_multiply_accumulate_tensor_float32");
std::cout << "has_subgroup_matrix_multiply_accumulate_tensor_float32: "
<< has_subgroup_matrix_multiply_accumulate_tensor_float32
<< std::endl;
bool has_subgroup_2d_block_io =
d.ext_oneapi_supports_cl_extension("cl_intel_subgroup_2d_block_io");
std::cout << "has_subgroup_2d_block_io: " << has_subgroup_2d_block_io
<< std::endl;

// no supported devices support EMBEDDED_PROFILE at this time.
assert(d.ext_oneapi_cl_profile() == "FULL_PROFILE" &&
"unexpected cl_profile");
Expand Down
Loading