FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add missing opencl-arrayfire interop fns in unified backend by 9prady9 · Pull Request #2981 · arrayfire/arrayfire · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cpp  (1) .txt  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
1 change: 1 addition & 0 deletions src/api/unified/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ target_sources(af
${CMAKE_CURRENT_SOURCE_DIR}/memory.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ml.cpp
${CMAKE_CURRENT_SOURCE_DIR}/moments.cpp
${CMAKE_CURRENT_SOURCE_DIR}/opencl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/random.cpp
${CMAKE_CURRENT_SOURCE_DIR}/signal.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sparse.cpp
Expand Down
83 changes: 83 additions & 0 deletions src/api/unified/opencl.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*******************************************************
* Copyright (c) 2020, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/

#include <af/backend.h>
#include "symbol_manager.hpp"

#include <af/opencl.h>

af_err afcl_get_device_type(afcl_device_type* res) {
af_backend backend;
af_get_active_backend(&backend);
if (backend == AF_BACKEND_OPENCL) { CALL(afcl_get_device_type, res); }
return AF_ERR_NOT_SUPPORTED;
}

af_err afcl_get_platform(afcl_platform* res) {
af_backend backend;
af_get_active_backend(&backend);
if (backend == AF_BACKEND_OPENCL) { CALL(afcl_get_platform, res); }
return AF_ERR_NOT_SUPPORTED;
}

af_err afcl_get_context(cl_context* ctx, const bool retain) {
af_backend backend;
af_get_active_backend(&backend);
if (backend == AF_BACKEND_OPENCL) { CALL(afcl_get_context, ctx, retain); }
return AF_ERR_NOT_SUPPORTED;
}

af_err afcl_get_queue(cl_command_queue* queue, const bool retain) {
af_backend backend;
af_get_active_backend(&backend);
if (backend == AF_BACKEND_OPENCL) { CALL(afcl_get_queue, queue, retain); }
return AF_ERR_NOT_SUPPORTED;
}

af_err afcl_get_device_id(cl_device_id* id) {
af_backend backend;
af_get_active_backend(&backend);
if (backend == AF_BACKEND_OPENCL) { CALL(afcl_get_device_id, id); }
return AF_ERR_NOT_SUPPORTED;
}

af_err afcl_set_device_id(cl_device_id id) {
af_backend backend;
af_get_active_backend(&backend);
if (backend == AF_BACKEND_OPENCL) { CALL(afcl_set_device_id, id); }
return AF_ERR_NOT_SUPPORTED;
}

af_err afcl_add_device_context(cl_device_id dev, cl_context ctx,
cl_command_queue que) {
af_backend backend;
af_get_active_backend(&backend);
if (backend == AF_BACKEND_OPENCL) {
CALL(afcl_add_device_context, dev, ctx, que);
}
return AF_ERR_NOT_SUPPORTED;
}

af_err afcl_set_device_context(cl_device_id dev, cl_context ctx) {
af_backend backend;
af_get_active_backend(&backend);
if (backend == AF_BACKEND_OPENCL) {
CALL(afcl_set_device_context, dev, ctx);
}
return AF_ERR_NOT_SUPPORTED;
}

af_err afcl_delete_device_context(cl_device_id dev, cl_context ctx) {
af_backend backend;
af_get_active_backend(&backend);
if (backend == AF_BACKEND_OPENCL) {
CALL(afcl_delete_device_context, dev, ctx);
}
return AF_ERR_NOT_SUPPORTED;
}

Back | FazBrowse Home | New Git URL