First Vulkan Relise

This commit is contained in:
2026-05-01 01:33:53 +07:00
parent e214ce10ed
commit 05875d8aa2
8 changed files with 300 additions and 352 deletions
+25 -2
View File
@@ -36,6 +36,30 @@ private:
double sigmoid(double x) { return 1.0 / (1.0 + exp(-x)); }
double sigmoidDeriv(double x) { return x * (1.0 - x); }
struct TrainParams {
uint32_t prevLayerSize;
uint32_t nextLayerSize;
uint32_t weightOffset;
uint32_t biasOffset;
uint32_t outOffset;
uint32_t errOffset;
float lr;
};
vk::Buffer gpuW, gpuB, gpuO, gpuE;
vk::DeviceMemory memW, memB, memO, memE;
vk::DescriptorPool descriptorPool;
vk::DescriptorSet descriptorSet;
vk::DescriptorSetLayout dsLayout;
vk::PipelineLayout pipeLayout;
vk::Pipeline pipeline;
vk::ShaderModule shaderModule;
bool vulkanResourcesInitialized = false;
void initVulkanResources(); // Метод для разовой инициализации
void cleanupVulkanResources();
public:
int cpu_count = 1;
@@ -49,8 +73,7 @@ public:
std::vector<double> feedForward(const std::vector<double>& input);
double train(const std::vector<double>& input, const std::vector<double>& target, double lr);
// Наш тест Vulkan
double trainVulkan();
double trainVulkan(const std::vector<double>& input, const std::vector<double>& target, double lr);
};
#endif