Skip to content

Corrected behavior for DPCTL_ENABLE_L0_PROGRAM_CREATION=OFF #1039

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
Jan 22, 2023
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
3 changes: 1 addition & 2 deletions libsyclinterface/include/Config/dpctl_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
#pragma once

/* Defined when dpctl was built with level zero program creation enabled. */
#cmakedefine DPCTL_ENABLE_L0_PROGRAM_CREATION \
@DPCTL_ENABLE_L0_PROGRAM_CREATION@
#cmakedefine DPCTL_ENABLE_L0_PROGRAM @DPCTL_ENABLE_L0_PROGRAM_CREATION@

#define __SYCL_COMPILER_VERSION_REQUIRED 20221201L

Expand Down
19 changes: 12 additions & 7 deletions libsyclinterface/source/dpctl_sycl_kernel_bundle_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#endif
#include <sstream>

#ifdef DPCTL_ENABLE_L0_PROGRAM_CREATION
#ifdef DPCTL_ENABLE_L0_PROGRAM
// Note: include ze_api.h before level_zero.hpp. Make sure clang-format does
// not reorder the includes.
// clang-format off
Expand Down Expand Up @@ -332,7 +332,7 @@ _GetKernel_ocl_impl(const kernel_bundle<bundle_state::executable> &kb,
}
}

#ifdef DPCTL_ENABLE_L0_PROGRAM_CREATION
#ifdef DPCTL_ENABLE_L0_PROGRAM

#ifdef __linux__
static const char *zeLoaderName = DPCTL_LIBZE_LOADER_FILENAME;
Expand Down Expand Up @@ -579,7 +579,7 @@ bool _HasKernel_ze_impl(const kernel_bundle<bundle_state::executable> &kb,
return false;
}

#endif /* #ifdef DPCTL_ENABLE_L0_PROGRAM_CREATION */
#endif /* #ifdef DPCTL_ENABLE_L0_PROGRAM */

} /* end of anonymous namespace */

Expand Down Expand Up @@ -619,11 +619,11 @@ DPCTLKernelBundle_CreateFromSpirv(__dpctl_keep const DPCTLSyclContextRef CtxRef,
length, CompileOpts);
break;
case backend::ext_oneapi_level_zero:
#ifdef DPCTL_ENABLE_L0_PROGRAM_CREATION
#ifdef DPCTL_ENABLE_L0_PROGRAM
KBRef = _CreateKernelBundleWithIL_ze_impl(*SyclCtx, *SyclDev, IL,
length, CompileOpts);
#endif
break;
#endif
default:
error_handler("Backend " + std::to_string(static_cast<int>(BE)) +
" is not supported",
Expand Down Expand Up @@ -671,8 +671,9 @@ __dpctl_give DPCTLSyclKernelBundleRef DPCTLKernelBundle_CreateFromOCLSource(
}
break;
case backend::ext_oneapi_level_zero:
error_handler("CreateFromSource is not supported in Level Zero.",
__FILE__, __func__, __LINE__);
error_handler(
"CreateFromSource is not supported for Level Zero backend.",
__FILE__, __func__, __LINE__);
return nullptr;
default:
error_handler("CreateFromSource is not supported in unknown backend.",
Expand Down Expand Up @@ -700,7 +701,9 @@ DPCTLKernelBundle_GetKernel(__dpctl_keep DPCTLSyclKernelBundleRef KBRef,
case sycl::backend::opencl:
return _GetKernel_ocl_impl(*SyclKB, KernelName);
case sycl::backend::ext_oneapi_level_zero:
#ifdef DPCTL_ENABLE_L0_PROGRAM
return _GetKernel_ze_impl(*SyclKB, KernelName);
#endif
default:
error_handler("Backend " + std::to_string(static_cast<int>(be)) +
" is not supported.",
Expand Down Expand Up @@ -728,7 +731,9 @@ bool DPCTLKernelBundle_HasKernel(__dpctl_keep DPCTLSyclKernelBundleRef KBRef,
case sycl::backend::opencl:
return _HasKernel_ocl_impl(*SyclKB, KernelName);
case sycl::backend::ext_oneapi_level_zero:
#ifdef DPCTL_ENABLE_L0_PROGRAM
return _HasKernel_ze_impl(*SyclKB, KernelName);
#endif
default:
error_handler("Backend " + std::to_string(static_cast<int>(be)) +
" is not supported.",
Expand Down