Skip to content

Commit

Permalink
Delete deprecated streaming / qdma APIs from OpenCL (Xilinx#5939)
Browse files Browse the repository at this point in the history
This PR removes the OpenCL APIs that support now obsolete qdma
platforms. Any host code using these old streaming APIs must move to
host memory for equivalent functionality.

The streaing APIs were first introduced in xrt-2.2.0 to support QDMA
platforms.

There are no risks associated with this PR since it only removes already
deprecated APIs and corresponding implementation code.

Testing has been done running old OpenCL HW regression suite.
  • Loading branch information
stsoe authored Oct 19, 2021
1 parent 0373ec1 commit d254020
Show file tree
Hide file tree
Showing 28 changed files with 12 additions and 1,624 deletions.
217 changes: 12 additions & 205 deletions src/include/1_2/CL/cl_ext_xilinx.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
# include <../include/CL/cl_ext.h>
#endif

#include "xstream.h"

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -171,204 +169,6 @@ xclGetMemObjectFromFd(cl_context context,
int fd,
cl_mem* mem);


/*----
*
* DOC: OpenCL Stream APIs
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* These structs and functions are used for the new DMA engine QDMA.
*/

/**
* cl_stream_flags. Type of the stream , eg set to XCL_STREAM_READ_ONLY for
* read only. Used in clCreateStream()
*
* This flag specifies that the stream object is a read-only stream
* object when used inside a kernel. Writing to a buffer or image object
* created with CL_STREAM_READ_ONLY inside a kernel is undefined.
*/
typedef uint64_t cl_stream_flags;
#ifdef __GNUC__
# define CL_STREAM_READ_ONLY _Pragma ("GCC warning \"CL_STREAM_READ_ONLY deprecated, please use XCL_STREAM_WRITE_ONLY\"") (1 << 0)
# define CL_STREAM_WRITE_ONLY _Pragma ("GCC warning \"CL_STREAM_WRITE_ONLY deprecated, please use XCL_STREAM_READ_ONLY\"") (1 << 1)
# define CL_STREAM_POLLING _Pragma ("GCC warning \"CL_STREAM_POLLING deprecated, please use XCL_STREAM_POLLING\"") (1 << 2)
#else
# define CL_STREAM_READ_ONLY (1 << 0)
# define CL_STREAM_WRITE_ONLY (1 << 1)
# define CL_STREAM_POLLING (1 << 2)
#endif

/**
* This flag specifies that the stream object is a read-only stream
* object when used inside a kernel. Writing to a stream
* created with CL_STREAM_READ_ONLY inside a kernel is undefined.
*/
#define XCL_STREAM_READ_ONLY (1 << 1)

/**
* This flag specifies that the stream object will be written but not
* read by a kernel. Reading from a stream object created with
* CL_STREAM_WRITE_ONLY inside a kernel is undefined.
*/
#define XCL_STREAM_WRITE_ONLY (1 << 0)

/**
* Unused
*/
#define XCL_STREAM_POLLING (1 << 2)

/**
* cl_stream_attributes. eg set it to CL_STREAM for stream mode. Used
* in clCreateStream()
*/
typedef uint32_t cl_stream_attributes;
#define CL_STREAM (1 << 0)
#define CL_PACKET (1 << 1)

/**
* cl_stream_attributes.
* eg set it to CL_STREAM_CDH for Customer Defined Header.
* Used in clReadStream() and clWriteStream()
*/

#define CL_STREAM_EOT (1 << 0)
#define CL_STREAM_CDH (1 << 1)
#define CL_STREAM_NONBLOCKING (1 << 2)
#define CL_STREAM_SILENT (1 << 3)

typedef stream_opt_type cl_stream_opt_type;
typedef stream_xfer_req_type cl_stream_xfer_req_type;
typedef streams_poll_req_completions cl_streams_poll_req_completions;
typedef stream_xfer_req cl_stream_xfer_req;
typedef struct _cl_stream * cl_stream;
typedef struct _cl_stream_mem * cl_stream_mem;

/**
* clCreateStream - create the stream for reading or writing.
* @device_id : The device handle on which stream is to be created.
* @flags : The cl_stream_flags
* @attributes : The attributes of the requested stream.
* @ext : The extension for kernel and argument matching.
* @errcode_ret : The return value eg CL_SUCCESS
*/
extern CL_API_ENTRY cl_stream CL_API_CALL
clCreateStream(cl_device_id /* device_id */,
cl_stream_flags /* flags */,
cl_stream_attributes /* attributes*/,
cl_mem_ext_ptr_t* /* ext */,
cl_int* /*errcode_ret*/) CL_API_SUFFIX__VERSION_1_0;

/**
* clReleaseStream - Once done with the stream, release it and its associated
* objects
* @stream: The stream to be released.
* Return a cl_int
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clReleaseStream(cl_stream /*stream*/) CL_API_SUFFIX__VERSION_1_0;

/**
* clWriteStream - write data to stream
* @stream : The stream
* @ptr : The ptr to write from.
* @size : The number of bytes to write.
* @req_type : The write request type.
* errcode_ret: The return value eg CL_SUCCESS
* Return a cl_int
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clWriteStream(cl_stream /* stream*/,
const void * /* ptr */,
size_t /* size */,
cl_stream_xfer_req* /* attributes */,
cl_int* /* errcode_ret*/) CL_API_SUFFIX__VERSION_1_0;

/**
* clReadStream - write data to stream
* @stream : The stream
* @ptr : The ptr to write from.
* @size : The number of bytes to write.
* @req_type : The read request type.
* errcode_ret: The return value eg CL_SUCCESS
* Return a cl_int.
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clReadStream(cl_stream /* stream*/,
void * /* ptr */,
size_t /* size */,
cl_stream_xfer_req* /* attributes */,
cl_int* /* errcode_ret*/) CL_API_SUFFIX__VERSION_1_0;


/* clCreateStreamBuffer - Alloc buffer used for read and write.
* @size : The size of the buffer
* errcode_ret : The return value, eg CL_SUCCESS
* Returns cl_stream_mem
*/
extern CL_API_ENTRY cl_stream_mem CL_API_CALL
clCreateStreamBuffer(cl_device_id device,
size_t /* size*/,
cl_int * /* errcode_ret*/) CL_API_SUFFIX__VERSION_1_0;

/* clReleaseStreamBuffer - Release the buffer created.
* @cl_stream_mem : The stream memory to be released.
* Return a cl_int
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clReleaseStreamBuffer(cl_stream_mem /*stream memobj */) CL_API_SUFFIX__VERSION_1_0;

/* clPollStreams - Poll streams on a device for completion.
* @device_id : The device
* @completions : Completions array
* @min_num_completions : Minimum number of completions requested
* @max_num_completions : Maximum number of completions requested
* @actual_num_completions: Actual number of completions returned.
* @timeout : Timeout in milliseconds (ms)
* @errcode_ret : : The return value eg CL_SUCCESS
* Return a cl_int.
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clPollStreams(cl_device_id /*device*/,
cl_streams_poll_req_completions* /*completions*/,
cl_int /*min_num_completion*/,
cl_int /*max_num_completion*/,
cl_int* /*actual num_completion*/,
cl_int /*timeout in ms*/,
cl_int * /*errcode_ret*/) CL_API_SUFFIX__VERSION_1_0;

/* clPollStream - Poll a single stream on a device for completion.
* @stream : The stream
* @completions : Completions array
* @min_num_completions : Minimum number of completions requested
* @max_num_completions : Maximum number of completions requested
* @actual_num_completions: Actual number of completions returned.
* @timeout : Timeout in milliseconds (ms)
* @errcode_ret : : The return value eg CL_SUCCESS
* Return a cl_int.
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clPollStream(cl_stream /* stream*/,
cl_streams_poll_req_completions* /*completions*/,
cl_int /*min_num_completion*/,
cl_int /*max_num_completion*/,
cl_int* /*actual num_completion*/,
cl_int /*timeout in ms*/,
cl_int * /*errcode_ret*/) CL_API_SUFFIX__VERSION_1_0;

/* clSetStreamOpt -Set stream options.
* @stream : The stream
* @option : the option type
* @val : the option value
* @errcode_ret : : The return value eg CL_SUCCESS
* Return a cl_int.
*/
extern CL_API_ENTRY cl_int CL_API_CALL
clSetStreamOpt(cl_stream /* stream*/,
cl_stream_opt_type /*option_type*/,
cl_int /*option_value*/,
cl_int * /*errcode_ret*/) CL_API_SUFFIX__VERSION_1_0;
//End QDMA APIs

// incorrectly placed in cl.h
typedef struct _cl_image_filler_xilinx {
cl_uint t0;
Expand Down Expand Up @@ -534,11 +334,18 @@ typedef cl_uint cl_program_target_type;
#define CL_PROGRAM_TARGET_TYPE_SW_EMU 0x2
#define CL_PROGRAM_TARGET_TYPE_HW_EMU 0x4

// K2K kernel argument sentinel
// XCL_HW_STREAM is a global sentinel value that XRT knows to
// represent an argument transferred via a hardware stream connection.
// Such arguments require no direct software intervention.
#define XCL_HW_STREAM NULL
////////////////////////////////////////////////////////////////
// DEPRECATED UNUSABLE STREAMING APIs
// Decl is required for internal test code (xcl2.hpp)
// Function cannot be used as they are not defined.
extern void clCreateStream();
extern void clReleaseStream();
extern void clWriteStream();
extern void clReadStream();
extern void clCreateStreamBuffer();
extern void clReleaseStreamBuffer();
extern void clPollStreams();
////////////////////////////////////////////////////////////////

#ifdef __cplusplus
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@
namespace xocl {

static const std::map<const std::string, void *> extensionFunctionTable = {
std::pair<const std::string, void *>("clCreateStream", (void *)clCreateStream),
std::pair<const std::string, void *>("clReleaseStream", (void *)clReleaseStream),
std::pair<const std::string, void *>("clWriteStream", (void *)clWriteStream),
std::pair<const std::string, void *>("clReadStream", (void *)clReadStream),
std::pair<const std::string, void *>("clCreateStreamBuffer", (void *)clCreateStreamBuffer),
std::pair<const std::string, void *>("clReleaseStreamBuffer", (void *)clReleaseStreamBuffer),
std::pair<const std::string, void *>("clPollStreams", (void *)clPollStreams),
std::pair<const std::string, void *>("clPollStream", (void *)clPollStream),
std::pair<const std::string, void *>("clSetStreamOpt", (void *)clSetStreamOpt),
std::pair<const std::string, void *>("xclGetMemObjectFd", (void *)xclGetMemObjectFd),
std::pair<const std::string, void *>("xclGetMemObjectFromFd", (void *)xclGetMemObjectFromFd),
std::pair<const std::string, void *>("xclGetXrtDevice", (void *)xclGetXrtDevice),
Expand Down
7 changes: 0 additions & 7 deletions src/runtime_src/xocl/api/icd/windows/xilinxopencl.def
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,5 @@ EXPORTS
xclGetMemObjDeviceAddress
xclGetMemObjectFd
xclGetMemObjectFromFd
clCreateStream
clReleaseStream
clWriteStream
clReadStream
clCreateStreamBuffer
clReleaseStreamBuffer
clPollStreams
xclGetXrtDevice
xclGetComputeUnitInfo
80 changes: 0 additions & 80 deletions src/runtime_src/xocl/api/xlnx/clCreateStream.cpp

This file was deleted.

Loading

0 comments on commit d254020

Please sign in to comment.