diff options
author | David Sorber <david.sorber@blacklynx.tech> | 2021-07-29 11:34:37 -0400 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2021-10-25 11:27:01 -0400 |
commit | f3c558d88bc68d865f823c31e7d9aa78b3feab59 (patch) | |
tree | 026d8ff5568bc2c5ab731df29d87901cf1177e00 /gnuradio-runtime/python | |
parent | 788827ae116bef871e144abd39b1e4482208eabe (diff) |
runtime: Custom Buffer/Accelerator Device Support - Milestone 2
Completion of custom buffer/accelerator device support changes:
* Improved custom buffer interface by removing awkward memory
allocation functions from the block class
* Increased flexibility for creating custom buffers by allowing
creation of buffer_single_mapped subclasses
* Fully incorporated data movement abstraction into the custom
buffer interface and the runtime itself; accelerated blocks are no
longer directly responsible for their own data movement
* Zero copy back-to-back accelerated blocks are now supported (data
no longer needs to be moved back to the host between each block)
Signed-off-by: David Sorber <david.sorber@blacklynx.tech>
Signed-off-by: Mike Mason <mike.mason@blacklynx.tech>
Diffstat (limited to 'gnuradio-runtime/python')
8 files changed, 87 insertions, 5 deletions
diff --git a/gnuradio-runtime/python/gnuradio/gr/bindings/CMakeLists.txt b/gnuradio-runtime/python/gnuradio/gr/bindings/CMakeLists.txt index dbc74b0529..2623bcf9c3 100644 --- a/gnuradio-runtime/python/gnuradio/gr/bindings/CMakeLists.txt +++ b/gnuradio-runtime/python/gnuradio/gr/bindings/CMakeLists.txt @@ -18,6 +18,7 @@ messages/msg_queue_python.cc # block_registry_python.cc buffer_python.cc buffer_reader_python.cc + buffer_type_python.cc constants_python.cc endianness_python.cc expj_python.cc diff --git a/gnuradio-runtime/python/gnuradio/gr/bindings/block_python.cc b/gnuradio-runtime/python/gnuradio/gr/bindings/block_python.cc index 9660a7f245..4ba7742b15 100644 --- a/gnuradio-runtime/python/gnuradio/gr/bindings/block_python.cc +++ b/gnuradio-runtime/python/gnuradio/gr/bindings/block_python.cc @@ -14,7 +14,7 @@ /* BINDTOOL_GEN_AUTOMATIC(0) */ /* BINDTOOL_USE_PYGCCXML(0) */ /* BINDTOOL_HEADER_FILE(block.h) */ -/* BINDTOOL_HEADER_FILE_HASH(238d129ad018daa3146ff1d8867dc356) */ +/* BINDTOOL_HEADER_FILE_HASH(23fce54cc3292f62ca2551fb3f409f77) */ /***********************************************************************************/ #include <pybind11/complex.h> diff --git a/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_python.cc b/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_python.cc index de7d4edf1c..4a991397be 100644 --- a/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_python.cc +++ b/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_python.cc @@ -14,7 +14,7 @@ /* BINDTOOL_GEN_AUTOMATIC(0) */ /* BINDTOOL_USE_PYGCCXML(0) */ /* BINDTOOL_HEADER_FILE(buffer.h) */ -/* BINDTOOL_HEADER_FILE_HASH(e5247f4fe5b5873c66eed72880194981) */ +/* BINDTOOL_HEADER_FILE_HASH(e34c34f70f65bbc7dfbc45adcadf7796) */ /***********************************************************************************/ #include <pybind11/complex.h> diff --git a/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_reader_python.cc b/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_reader_python.cc index 23e2f39d10..2c86dd9fe6 100644 --- a/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_reader_python.cc +++ b/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_reader_python.cc @@ -14,7 +14,7 @@ /* BINDTOOL_GEN_AUTOMATIC(0) */ /* BINDTOOL_USE_PYGCCXML(0) */ /* BINDTOOL_HEADER_FILE(buffer_reader.h) */ -/* BINDTOOL_HEADER_FILE_HASH(451fcbd61f40b7d17a151474869aad75) */ +/* BINDTOOL_HEADER_FILE_HASH(5a48682a66afd451d2f145b352c95a7e) */ /***********************************************************************************/ #include <pybind11/complex.h> diff --git a/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_type_python.cc b/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_type_python.cc new file mode 100644 index 0000000000..28bfcfac3c --- /dev/null +++ b/gnuradio-runtime/python/gnuradio/gr/bindings/buffer_type_python.cc @@ -0,0 +1,41 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(buffer_type.h) */ +/* BINDTOOL_HEADER_FILE_HASH(0b679f644e232dd519bb812b93c8c0e3) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/buffer_type.h> +// pydoc.h is automatically generated in the build directory +#include <buffer_type_pydoc.h> + +// NOTE: buffer_type is really a typedef of const buffer_type_base& so +// buffer_type_base is used below because that's the type we really care about +void bind_buffer_type(py::module& m) +{ + + using buffer_type_base = ::gr::buffer_type_base; + + + py::class_<buffer_type_base>(m, "buffer_type_base", D(buffer_type_base)) + + .def("name", &buffer_type_base::name, D(buffer_type_base, name)); +}
\ No newline at end of file diff --git a/gnuradio-runtime/python/gnuradio/gr/bindings/docstrings/buffer_type_pydoc_template.h b/gnuradio-runtime/python/gnuradio/gr/bindings/docstrings/buffer_type_pydoc_template.h new file mode 100644 index 0000000000..cad9363030 --- /dev/null +++ b/gnuradio-runtime/python/gnuradio/gr/bindings/docstrings/buffer_type_pydoc_template.h @@ -0,0 +1,21 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_buffer_type_base = R"doc()doc"; + + +static const char* __doc_gr_buffer_type_base_name = R"doc()doc"; diff --git a/gnuradio-runtime/python/gnuradio/gr/bindings/io_signature_python.cc b/gnuradio-runtime/python/gnuradio/gr/bindings/io_signature_python.cc index 56ed5c2fe5..d6ddf570dd 100644 --- a/gnuradio-runtime/python/gnuradio/gr/bindings/io_signature_python.cc +++ b/gnuradio-runtime/python/gnuradio/gr/bindings/io_signature_python.cc @@ -14,7 +14,7 @@ /* BINDTOOL_GEN_AUTOMATIC(0) */ /* BINDTOOL_USE_PYGCCXML(0) */ /* BINDTOOL_HEADER_FILE(io_signature.h) */ -/* BINDTOOL_HEADER_FILE_HASH(aa246441b45c1a5b872509ed410615ae) */ +/* BINDTOOL_HEADER_FILE_HASH(baf27e696237b6542ec62a4c5627ea1d) */ /***********************************************************************************/ #include <pybind11/complex.h> @@ -40,6 +40,7 @@ void bind_io_signature(py::module& m) py::arg("min_streams"), py::arg("max_streams"), py::arg("sizeof_stream_item"), + py::arg("buftype") = gr::buffer_double_mapped::type, D(io_signature, make)) @@ -49,6 +50,8 @@ void bind_io_signature(py::module& m) py::arg("max_streams"), py::arg("sizeof_stream_item1"), py::arg("sizeof_stream_item2"), + py::arg("buftype1") = gr::buffer_double_mapped::type, + py::arg("buftype2") = gr::buffer_double_mapped::type, D(io_signature, make2)) @@ -59,14 +62,28 @@ void bind_io_signature(py::module& m) py::arg("sizeof_stream_item1"), py::arg("sizeof_stream_item2"), py::arg("sizeof_stream_item3"), + py::arg("buftype1") = gr::buffer_double_mapped::type, + py::arg("buftype2") = gr::buffer_double_mapped::type, + py::arg("buftype3") = gr::buffer_double_mapped::type, D(io_signature, make3)) + .def_static( + "makev", + py::overload_cast<int, int, const std::vector<int>&>(&io_signature::makev), + py::arg("min_streams"), + py::arg("max_streams"), + py::arg("sizeof_stream_items"), + D(io_signature, makev)) .def_static("makev", - &io_signature::makev, + py::overload_cast<int, + int, + const std::vector<int>&, + gr::gr_vector_buffer_type>(&io_signature::makev), py::arg("min_streams"), py::arg("max_streams"), py::arg("sizeof_stream_items"), + py::arg("buftypes"), D(io_signature, makev)) diff --git a/gnuradio-runtime/python/gnuradio/gr/bindings/python_bindings.cc b/gnuradio-runtime/python/gnuradio/gr/bindings/python_bindings.cc index 1f39775f81..760578254d 100644 --- a/gnuradio-runtime/python/gnuradio/gr/bindings/python_bindings.cc +++ b/gnuradio-runtime/python/gnuradio/gr/bindings/python_bindings.cc @@ -29,6 +29,7 @@ void bind_block_detail(py::module&); void bind_block_gateway(py::module&); // void bind_block_registry(py::module&); void bind_buffer(py::module&); +void bind_buffer_type(py::module& m); void bind_constants(py::module&); void bind_endianness(py::module&); void bind_expj(py::module&); @@ -121,6 +122,7 @@ PYBIND11_MODULE(gr_python, m) bind_msg_handler(m); bind_msg_queue(m); + bind_buffer_type(m); bind_io_signature(m); // // bind_attributes(m); bind_basic_block(m); |