Updated docs and renamig kp::Constants
Signed-off-by: Alejandro Saucedo <axsauze@gmail.com>
This commit is contained in:
parent
990ccd5f3b
commit
932620091c
14 changed files with 162 additions and 47 deletions
|
|
@ -89,9 +89,9 @@ void kompute(const std::string& shader) {
|
|||
|
||||
// 3. Create algorithm based on shader (supports buffers & push/spec constants)
|
||||
kp::Workgroup workgroup({3, 1, 1});
|
||||
kp::Constants specConsts({ 2 });
|
||||
kp::Constants pushConstsA({ 2.0 });
|
||||
kp::Constants pushConstsB({ 3.0 });
|
||||
std::vector<float> specConsts({ 2 });
|
||||
std::vector<float> pushConstsA({ 2.0 });
|
||||
std::vector<float> pushConstsB({ 3.0 });
|
||||
|
||||
auto algorithm = mgr.algorithm(params,
|
||||
// See documentation shader section for compileSource
|
||||
|
|
|
|||
|
|
@ -38,9 +38,10 @@ Documentation Index (as per sidebar)
|
|||
|
||||
.. toctree::
|
||||
:titlesonly:
|
||||
:caption: Concepts & Deep Dives:
|
||||
:caption: Advanced Concepts & Deep Dives:
|
||||
|
||||
CI, Docker Images Docs & Tests <overview/ci-tests.rst>
|
||||
CI, Docker Images Docs & Tests <overview/ci-tests>
|
||||
Variable Types for Tensors, and Push/Spec Constants <overview/variable-types>
|
||||
Asynchronous & Parallel Operations <overview/async-parallel>
|
||||
Mobile App Integration (Android) <overview/mobile-android>
|
||||
Game Engine Integration (Godot Engine) <overview/game-engine-godot>
|
||||
|
|
|
|||
|
|
@ -71,13 +71,13 @@ The example below shows how you can enable the "VK_EXT_shader_atomic_float" exte
|
|||
sq = mgr.sequence()
|
||||
->record<kp::OpTensorSyncDevice>({ tensor })
|
||||
->record<kp::OpAlgoDispatch>(algo,
|
||||
kp::Constants{ 0.1, 0.2, 0.3 })
|
||||
std::vector<float>{ 0.1, 0.2, 0.3 })
|
||||
->record<kp::OpAlgoDispatch>(algo,
|
||||
kp::Constants{ 0.3, 0.2, 0.1 })
|
||||
std::vector<float>{ 0.3, 0.2, 0.1 })
|
||||
->record<kp::OpTensorSyncLocal>({ tensor })
|
||||
->eval();
|
||||
|
||||
EXPECT_EQ(tensor->data(), kp::Constants({ 0.4, 0.4, 0.4 }));
|
||||
EXPECT_EQ(tensor->data(), std::vector<float>({ 0.4, 0.4, 0.4 }));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
92
docs/overview/variable-types.rst
Normal file
92
docs/overview/variable-types.rst
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
|
||||
Variable Types for Tensors and Constants
|
||||
=============
|
||||
|
||||
By default the initial interfaces you may interact with, will be primarily using float values by default, which is enough to get through the basic conceptual examples. However as real world applications are being developed, more specialized types may be required for kp::Tensor, as well as for SpecializationConstants and PushConstants.
|
||||
|
||||
Before diving into the practical classes and interfaces that can be used to take advantage of the variable type support of Kompute, we want to provide some high level intution on what each of these components are.
|
||||
|
||||
Variable Tensor Types
|
||||
------
|
||||
|
||||
For the kp::Tensor class, Kompute provides under the hood an interface to have more seamless interaction with multiple different underlying data types. This is done through the introduction of the class kp::TensorT<type> and parent class kp::Tensor, however you as a developer you will be primarily interacting with the top level kp::Tensor class, as this is what is provided through the high level kp::Manager class.
|
||||
|
||||
The kp::Tensor class does provide an "integrated" experience, which allows users to "seamlessly" retrieve the underlying data through the `data()` and `vector()` functions. This is done by leveraging C++ templates, as well as limiting the types that can be used, which are namely:
|
||||
|
||||
* float
|
||||
* uint32
|
||||
* int32
|
||||
* double
|
||||
* bool
|
||||
|
||||
Any other data type provided would result in an error, and for the time being Kompute will focus on primarily provide support for these classes.
|
||||
|
||||
The tests under `TestTensor.cpp` and `test_tensor_types.py` provide an overview of how users can take advantage of these features using std::vector for C++ and numpy array for Python.
|
||||
|
||||
C++ Tensor Types Usage
|
||||
^^^^^^^
|
||||
|
||||
Below you can see how it is possible to define different types in C++.
|
||||
|
||||
.. literalinclude:: ../../test/TestTensor.cpp
|
||||
:language: cpp
|
||||
:lines: 21-
|
||||
|
||||
Python Tensor Types Usage
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. literalinclude:: ../../python/test/test_tensor_types.py
|
||||
:language: python
|
||||
:lines: 26-46
|
||||
|
||||
Variable Push Constants
|
||||
----
|
||||
|
||||
Push constants are a relatively non-expensive way to provide dynamic data to a GPU Algorithm (shader) as further CPU compute is performed. Although Push Constants are a more efficient way to provide data, it is also a limited manner as there is a memory limit for push constants.
|
||||
|
||||
Push constants with Kompute are flexible as it is possible to pass user-defined structs in C++. In Python it is limited to providing numpy arrays with multiple elements of the same type.
|
||||
|
||||
C++ Push Consts Types Usage
|
||||
^^^^^^^
|
||||
|
||||
As mentioned above, this test under `TestPushConstants.cpp` shows how it is possible to use user-defined structs for multiple elements from different types, which is not possible for specialized constants or tensors.
|
||||
|
||||
These are defined in the `algorithm` function of the `kp::Manager`, and once it push constant is set, all other push constants provided have to consist of the same types and element size.
|
||||
|
||||
More specifically, when passing a custom struct it is possible to pass a single element, or alternatively passing multiple scalar values as part of the vector, and access them as outlined in the rest of the tests.
|
||||
|
||||
.. literalinclude:: ../../test/TestPushConstant.cpp
|
||||
:language: cpp
|
||||
:lines: 182-231
|
||||
|
||||
|
||||
Python Push Consts Types Usage
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
In python the push constants are limited to a single list of elements of the same type. These are provided by passing a numpy array to the `algorithm` function or the `kp::OpAlgoDispatch` operation.
|
||||
|
||||
.. literalinclude:: ../../python/test/test_tensor_types.py
|
||||
:language: python
|
||||
:lines: 207-242
|
||||
|
||||
Variable Specialization Constants
|
||||
------
|
||||
|
||||
Specialization constants are analogous to push constants, but these are not dynamic, can only be set on initialization or rebuild of `kp::Algorithm` and cannot be changed unless a `rebuild` is carried out.
|
||||
|
||||
The usage of specailization constants is very similar to the push constants, but the only limitation are:
|
||||
|
||||
* These are defined using the constant_id in the glsl shader
|
||||
* Spec constants do not support complex types (i.e. user defined struct)
|
||||
* Kompute supports an array of elements of same type for specialization constants
|
||||
|
||||
C++ Push Consts Types Usage
|
||||
^^^^
|
||||
|
||||
The specialization constant example shows how it is possible to define as a std::vector.
|
||||
|
||||
.. literalinclude:: ../../test/TestSpecializationConstant.cpp
|
||||
:language: cpp
|
||||
:lines: 57-
|
||||
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ void KomputeModelML::train(std::vector<float> yData, std::vector<float> xIData,
|
|||
+ kp::shader_data::shaders_glsl_logisticregression_comp_spv_len));
|
||||
|
||||
std::shared_ptr<kp::Algorithm> algo =
|
||||
mgr.algorithm(params, spirv, kp::Workgroup({ 5 }), kp::Constants({ 5.0 }));
|
||||
mgr.algorithm(params, spirv, kp::Workgroup({ 5 }), std::vector<float>({ 5.0 }));
|
||||
|
||||
mgr.sequence()->eval<kp::OpTensorSyncDevice>(params);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ int main()
|
|||
+ kp::shader_data::shaders_glsl_logisticregression_comp_spv_len));
|
||||
|
||||
std::shared_ptr<kp::Algorithm> algo = mgr.algorithm(
|
||||
params, spirv, kp::Workgroup({ 5 }), kp::Constants({ 5.0 }));
|
||||
params, spirv, kp::Workgroup({ 5 }), std::vector<float>({ 5.0 }));
|
||||
|
||||
mgr.sequence()->eval<kp::OpTensorSyncDevice>(params);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ tensors (optional) The tensors to use to create the descriptor
|
|||
resources @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
|
||||
not set. @param specializationConstants (optional) The std::vector<float>
|
||||
to use to initialize the specialization constants which cannot be
|
||||
changed once set. @param pushConstants (optional) The kp::Constants to
|
||||
changed once set. @param pushConstants (optional) The std::vector<float> to
|
||||
use 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.)doc";
|
||||
|
|
@ -54,12 +54,12 @@ static const char *__doc_kp_Algorithm_destroy = R"doc()doc";
|
|||
static const char *__doc_kp_Algorithm_getPush =
|
||||
R"doc(Gets the specialization constants of the current algorithm.
|
||||
|
||||
@returns The kp::Constants currently set for push constants)doc";
|
||||
@returns The std::vector<float> currently set for push constants)doc";
|
||||
|
||||
static const char *__doc_kp_Algorithm_getSpecializationConstants =
|
||||
R"doc(Gets the specialization constants of the current algorithm.
|
||||
|
||||
@returns The kp::Constants currently set for specialization constants)doc";
|
||||
@returns The std::vector<float> currently set for specialization constants)doc";
|
||||
|
||||
static const char *__doc_kp_Algorithm_getTensors =
|
||||
R"doc(Gets the current tensors that are used in the algorithm.
|
||||
|
|
@ -127,9 +127,9 @@ parameters to create the underlying resources.
|
|||
@param spirv 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
|
||||
specializationConstants (optional) The std::vector<float> to use to
|
||||
initialize the specialization constants which cannot be changed once
|
||||
set. @param pushConstants (optional) The kp::Constants to use when
|
||||
set. @param pushConstants (optional) The std::vector<float> to use 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.)doc";
|
||||
|
|
|
|||
|
|
@ -74,9 +74,9 @@ PYBIND11_MODULE(kp, m) {
|
|||
|
||||
py::class_<kp::OpAlgoDispatch, std::shared_ptr<kp::OpAlgoDispatch>>(
|
||||
m, "OpAlgoDispatch", py::base<kp::OpBase>(), DOC(kp, OpAlgoDispatch))
|
||||
.def(py::init<const std::shared_ptr<kp::Algorithm>&,const kp::Constants&>(),
|
||||
.def(py::init<const std::shared_ptr<kp::Algorithm>&,const std::vector<float>&>(),
|
||||
DOC(kp, OpAlgoDispatch, OpAlgoDispatch),
|
||||
py::arg("algorithm"), py::arg("push_consts") = kp::Constants())
|
||||
py::arg("algorithm"), py::arg("push_consts") = std::vector<float>())
|
||||
.def(py::init(&opAlgoDispatchPyInit),
|
||||
DOC(kp, OpAlgoDispatch, OpAlgoDispatch),
|
||||
py::arg("algorithm"), py::arg("push_consts"));
|
||||
|
|
|
|||
|
|
@ -1087,12 +1087,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<typename S = float, typename P = float>
|
||||
Algorithm(std::shared_ptr<vk::Device> device,
|
||||
|
|
@ -1127,9 +1127,9 @@ class Algorithm
|
|||
* @param spirv 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 std::vector<float> to use to
|
||||
* initialize the specialization constants which cannot be changed once set.
|
||||
* @param pushConstants (optional) The kp::Constants to use when
|
||||
* @param pushConstants (optional) The std::vector<float> to use 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.
|
||||
|
|
@ -1239,7 +1239,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.
|
||||
*/
|
||||
|
|
@ -1252,6 +1252,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;
|
||||
|
|
@ -1285,7 +1293,7 @@ class Algorithm
|
|||
/**
|
||||
* Gets the specialization constants of the current algorithm.
|
||||
*
|
||||
* @returns The kp::Constants currently set for specialization constants
|
||||
* @returns The std::vector<float> currently set for specialization constants
|
||||
*/
|
||||
template<typename T>
|
||||
const std::vector<T> getSpecializationConstants()
|
||||
|
|
@ -1296,7 +1304,7 @@ class Algorithm
|
|||
/**
|
||||
* Gets the specialization constants of the current algorithm.
|
||||
*
|
||||
* @returns The kp::Constants currently set for push constants
|
||||
* @returns The std::vector<float> currently set for push constants
|
||||
*/
|
||||
template<typename T>
|
||||
const std::vector<T> getPushConstants()
|
||||
|
|
@ -2206,6 +2214,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> algorithm(
|
||||
const std::vector<std::shared_ptr<Tensor>>& tensors = {},
|
||||
const std::vector<uint32_t>& spirv = {},
|
||||
|
|
@ -2224,9 +2246,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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -64,9 +64,9 @@ class Algorithm
|
|||
* @param spirv 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 std::vector<float> to use to
|
||||
* initialize the specialization constants which cannot be changed once set.
|
||||
* @param pushConstants (optional) The kp::Constants to use when
|
||||
* @param pushConstants (optional) The std::vector<float> to use 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.
|
||||
|
|
@ -230,7 +230,7 @@ class Algorithm
|
|||
/**
|
||||
* Gets the specialization constants of the current algorithm.
|
||||
*
|
||||
* @returns The kp::Constants currently set for specialization constants
|
||||
* @returns The std::vector<float> currently set for specialization constants
|
||||
*/
|
||||
template<typename T>
|
||||
const std::vector<T> getSpecializationConstants()
|
||||
|
|
@ -241,7 +241,7 @@ class Algorithm
|
|||
/**
|
||||
* Gets the specialization constants of the current algorithm.
|
||||
*
|
||||
* @returns The kp::Constants currently set for push constants
|
||||
* @returns The std::vector<float> currently set for push constants
|
||||
*/
|
||||
template<typename T>
|
||||
const std::vector<T> getPushConstants()
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ TEST(TestLogisticRegression, TestMainLogisticRegression)
|
|||
test_shaders_glsl_test_logistic_regression_comp_spv_len));
|
||||
|
||||
std::shared_ptr<kp::Algorithm> algorithm = mgr.algorithm(
|
||||
params, spirv, kp::Workgroup({ 5 }), kp::Constants({ 5.0 }));
|
||||
params, spirv, kp::Workgroup({ 5 }), std::vector<float>({ 5.0 }));
|
||||
|
||||
std::shared_ptr<kp::Sequence> sq =
|
||||
mgr.sequence()
|
||||
|
|
@ -127,7 +127,7 @@ TEST(TestLogisticRegression, TestMainLogisticRegressionManualCopy)
|
|||
shaders_glsl_logisticregression_comp_spv_len));
|
||||
|
||||
std::shared_ptr<kp::Algorithm> algorithm =
|
||||
mgr.algorithm(params, spirv, kp::Workgroup(), kp::Constants({ 5.0 }));
|
||||
mgr.algorithm(params, spirv, kp::Workgroup(), std::vector<float>({ 5.0 }));
|
||||
|
||||
std::shared_ptr<kp::Sequence> sq =
|
||||
mgr.sequence()
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ TEST(TestMultipleAlgoExecutions, TestEndToEndFunctionality)
|
|||
};
|
||||
|
||||
kp::Workgroup workgroup({ 3, 1, 1 });
|
||||
kp::Constants specConsts({ 2 });
|
||||
kp::Constants pushConstsA({ 2.0 });
|
||||
kp::Constants pushConstsB({ 3.0 });
|
||||
std::vector<float> specConsts({ 2 });
|
||||
std::vector<float> pushConstsA({ 2.0 });
|
||||
std::vector<float> pushConstsB({ 3.0 });
|
||||
|
||||
auto algorithm = mgr.algorithm(params,
|
||||
compileSource(shader),
|
||||
|
|
@ -263,8 +263,8 @@ TEST(TestMultipleAlgoExecutions, TestAlgorithmUtilFunctions)
|
|||
};
|
||||
|
||||
kp::Workgroup workgroup({ 3, 1, 1 });
|
||||
kp::Constants specConsts({ 2 });
|
||||
kp::Constants pushConsts({ 2.0 });
|
||||
std::vector<float> specConsts({ 2 });
|
||||
std::vector<float> pushConsts({ 2.0 });
|
||||
|
||||
auto algorithm = mgr.algorithm(params,
|
||||
compileSource(shader),
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@ TEST(TestPushConstants, TestConstantsAlgoDispatchOverride)
|
|||
// We need to run this in sequence to avoid race condition
|
||||
// We can't use atomicAdd as swiftshader doesn't support it for
|
||||
// float
|
||||
sq->eval<kp::OpAlgoDispatch>(algo, kp::Constants{ 0.1, 0.2, 0.3 });
|
||||
sq->eval<kp::OpAlgoDispatch>(algo, kp::Constants{ 0.3, 0.2, 0.1 });
|
||||
sq->eval<kp::OpAlgoDispatch>(algo, std::vector<float>{ 0.1, 0.2, 0.3 });
|
||||
sq->eval<kp::OpAlgoDispatch>(algo, std::vector<float>{ 0.3, 0.2, 0.1 });
|
||||
sq->eval<kp::OpTensorSyncLocal>({ tensor });
|
||||
|
||||
EXPECT_EQ(tensor->vector(), kp::Constants({ 0.4, 0.4, 0.4 }));
|
||||
EXPECT_EQ(tensor->vector(), std::vector<float>({ 0.4, 0.4, 0.4 }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -90,10 +90,10 @@ TEST(TestPushConstants, TestConstantsAlgoDispatchNoOverride)
|
|||
// We can't use atomicAdd as swiftshader doesn't support it for
|
||||
// float
|
||||
sq->eval<kp::OpAlgoDispatch>(algo);
|
||||
sq->eval<kp::OpAlgoDispatch>(algo, kp::Constants{ 0.3, 0.2, 0.1 });
|
||||
sq->eval<kp::OpAlgoDispatch>(algo, std::vector<float>{ 0.3, 0.2, 0.1 });
|
||||
sq->eval<kp::OpTensorSyncLocal>({ tensor });
|
||||
|
||||
EXPECT_EQ(tensor->vector(), kp::Constants({ 0.4, 0.4, 0.4 }));
|
||||
EXPECT_EQ(tensor->vector(), std::vector<float>({ 0.4, 0.4, 0.4 }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -132,7 +132,7 @@ TEST(TestPushConstants, TestConstantsWrongSize)
|
|||
sq = mgr.sequence()->record<kp::OpTensorSyncDevice>({ tensor });
|
||||
|
||||
EXPECT_THROW(sq->record<kp::OpAlgoDispatch>(
|
||||
algo, kp::Constants{ 0.1, 0.2, 0.3 }),
|
||||
algo, std::vector<float>{ 0.1, 0.2, 0.3 }),
|
||||
std::runtime_error);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ TEST(TestSpecializationConstants, TestTwoConstants)
|
|||
std::vector<std::shared_ptr<kp::Tensor>> params = { tensorA,
|
||||
tensorB };
|
||||
|
||||
kp::Constants spec = kp::Constants({ 5.0, 0.3 });
|
||||
std::vector<float> spec = std::vector<float>({ 5.0, 0.3 });
|
||||
|
||||
std::shared_ptr<kp::Algorithm> algo =
|
||||
mgr.algorithm(params, spirv, {}, spec);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue