Skip to content
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

VITIS-13807 : Use opencl icd dispatcher instead of ocl icd for embedded flows #8686

Merged
merged 2 commits into from
Jan 13, 2025
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
8 changes: 7 additions & 1 deletion src/runtime_src/xocl/api/icd/ocl_icd_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// populated, trailing 0s don't matter.
//static_assert(sizeof(_cl_icd_dispatch)==178*sizeof(void*),"Fix dispatch table");

const _cl_icd_dispatch cl_icd_dispatch = {
const cl_icd_dispatch cl_icd_dispatch_obj = {
clGetPlatformIDs,
clGetPlatformInfo,
clGetDeviceIDs,
Expand Down Expand Up @@ -170,6 +170,11 @@ const _cl_icd_dispatch cl_icd_dispatch = {
0, //clSetProgramReleaseCallback,
0, //clSetProgramSpecializationConstant,
#ifndef _WIN32
#if (defined (__aarch64__) || defined (__arm__)) && defined (OPENCL_ICD_LOADER)
0, //clCreateBufferWithProperties
0, //clCreateImageWithProperties
0, //clSetContextDestructorCallback
#else
0,
0,
0,
Expand Down Expand Up @@ -203,4 +208,5 @@ const _cl_icd_dispatch cl_icd_dispatch = {
0,
0
#endif
#endif
};
14 changes: 12 additions & 2 deletions src/runtime_src/xocl/api/icd/ocl_icd_bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,20 @@
#ifdef _WIN32
# define NOMINMAX
# include "windows/icd_dispatch.h"
using _cl_icd_dispatch = KHRicdVendorDispatchRec;
using cl_icd_dispatch = KHRicdVendorDispatchRec;
#else
#if (defined (__aarch64__) || defined (__arm__)) && defined (OPENCL_ICD_LOADER)
// In Yocto ocl icd dispatcher is deprecated and
// opencl icd dispatcher is the recommended one.
// Using opencl icd dispatcher for embedded flows.
# include <CL/cl_icd.h>
#else
// All x86 linux distros doesn't have opencl icd dispatcher
// support so using ocl icd dispatcher for x86 flows.
# include <ocl_icd.h>
using cl_icd_dispatch = _cl_icd_dispatch;
#endif
#endif
extern const _cl_icd_dispatch cl_icd_dispatch;
extern const cl_icd_dispatch cl_icd_dispatch_obj;

#endif
5 changes: 3 additions & 2 deletions src/runtime_src/xocl/core/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ class stream_mem;
template <typename XOCLTYPE, typename CLTYPE>
class object
{
const _cl_icd_dispatch* m_dispatch;
const cl_icd_dispatch* m_dispatch;


public:
typedef XOCLTYPE xocl_type;
typedef CLTYPE cl_type;

object() : m_dispatch(&cl_icd_dispatch) {}
object() : m_dispatch(&cl_icd_dispatch_obj) {}
};

namespace detail {
Expand Down
Loading