From 990ccd5f3b8ada4e7744e14ac1658b1f6f8124d5 Mon Sep 17 00:00:00 2001 From: Alejandro Saucedo Date: Sun, 12 Sep 2021 16:06:49 +0100 Subject: [PATCH] Added docstrings for new functions Signed-off-by: Alejandro Saucedo --- src/include/kompute/Algorithm.hpp | 18 +++++++++++++----- src/include/kompute/Manager.hpp | 18 ++++++++++++++++-- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/include/kompute/Algorithm.hpp b/src/include/kompute/Algorithm.hpp index 9dd70b1b5..cd9d913f0 100644 --- a/src/include/kompute/Algorithm.hpp +++ b/src/include/kompute/Algorithm.hpp @@ -24,12 +24,12 @@ class Algorithm * @param spirv (optional) The spirv code to use to create the algorithm * @param workgroup (optional) The kp::Workgroup to use for the dispatch * which defaults to kp::Workgroup(tensor[0].size(), 1, 1) if not set. - * @param specializationConstants (optional) The kp::Constants to use to + * @param specializationConstants (optional) The templatable param is to be used to * initialize the specialization constants which cannot be changed once set. - * @param pushConstants (optional) The kp::Constants to use when + * @param pushConstants (optional) This templatable param is to be used when * initializing the pipeline, which set the size of the push constants - - * these can be modified but all new values must have the same vector size - * as this initial value. + * these can be modified but all new values must have the same data type and length + * as otherwise it will result in errors. */ template Algorithm(std::shared_ptr device, @@ -176,7 +176,7 @@ class Algorithm * Sets the push constants to the new value provided to use in the next * bindPush() * - * @param The kp::Constant to use to set the push constants to use in the + * @param pushConstants The templatable vector is to be used to set the push constants to use in the * next bindPush(...) calls. The constants provided must be of the same size * as the ones created during initialization. */ @@ -189,6 +189,14 @@ class Algorithm this->setPushConstants(pushConstants.data(), size, memorySize); } + /** + * Sets the push constants to the new value provided to use in the next + * bindPush() with the raw memory block location and memory size to be used. + * + * @param data The raw data point to copy the data from, without modifying the pointer. + * @param size The number of data elements provided in the data + * @param memorySize The memory size of each of the data elements in bytes. + */ void setPushConstants(void* data, uint32_t size, uint32_t memorySize) { uint32_t totalSize = memorySize * size; diff --git a/src/include/kompute/Manager.hpp b/src/include/kompute/Manager.hpp index 8a4244a2b..d9b850efd 100644 --- a/src/include/kompute/Manager.hpp +++ b/src/include/kompute/Manager.hpp @@ -123,6 +123,20 @@ class Manager return tensor; } + /** + * Default non-template function that can be used to create algorithm objects + * which provides default types to the push and spec constants as floats. + * + * @param tensors (optional) The tensors to initialise the algorithm with + * @param spirv (optional) The SPIRV bytes for the algorithm to dispatch + * @param workgroup (optional) kp::Workgroup for algorithm to use, and + * defaults to (tensor[0].size(), 1, 1) + * @param specializationConstants (optional) float vector to use for + * specialization constants, and defaults to an empty constant + * @param pushConstants (optional) float vector to use for push constants, + * and defaults to an empty constant + * @returns Shared pointer with initialised algorithm + */ std::shared_ptr algorithm( const std::vector>& tensors = {}, const std::vector& spirv = {}, @@ -141,9 +155,9 @@ class Manager * @param spirv (optional) The SPIRV bytes for the algorithm to dispatch * @param workgroup (optional) kp::Workgroup for algorithm to use, and * defaults to (tensor[0].size(), 1, 1) - * @param specializationConstants (optional) kp::Constant to use for + * @param specializationConstants (optional) templatable vector parameter to use for * specialization constants, and defaults to an empty constant - * @param pushConstants (optional) kp::Constant to use for push constants, + * @param pushConstants (optional) templatable vector parameter to use for push constants, * and defaults to an empty constant * @returns Shared pointer with initialised algorithm */