| 36 | */ |
| 37 | template<typename S = float, typename P = float> |
| 38 | Algorithm(std::shared_ptr<vk::Device> device, |
| 39 | const std::vector<std::shared_ptr<Tensor>>& tensors = {}, |
| 40 | const std::vector<uint32_t>& spirv = {}, |
| 41 | const Workgroup& workgroup = {}, |
| 42 | const std::vector<S>& specializationConstants = {}, |
| 43 | const std::vector<P>& pushConstants = {}) |
| 44 | { |
| 45 | KP_LOG_DEBUG("Kompute Algorithm Constructor with device"); |
| 46 | |
| 47 | this->mDevice = device; |
| 48 | |
| 49 | if (tensors.size() && spirv.size()) { |
| 50 | KP_LOG_INFO( |
| 51 | "Kompute Algorithm initialising with tensor size: {} and " |
| 52 | "spirv size: {}", |
| 53 | tensors.size(), |
| 54 | spirv.size()); |
| 55 | this->rebuild(tensors, |
| 56 | spirv, |
| 57 | workgroup, |
| 58 | specializationConstants, |
| 59 | pushConstants); |
| 60 | } else { |
| 61 | KP_LOG_INFO( |
| 62 | "Kompute Algorithm constructor with empty tensors and or " |
| 63 | "spirv so not rebuilding vulkan components"); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Rebuild function to reconstruct algorithm with configuration parameters |