From c4d787fd4f2c4a03b81d88c2c28f37ba5fe8941d Mon Sep 17 00:00:00 2001 From: jserbedzija Date: Mon, 3 Feb 2025 14:50:03 +0000 Subject: [PATCH] DEBUG --- runtime/lib/ttnn/operations/conv/conv2d.cpp | 57 +++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/runtime/lib/ttnn/operations/conv/conv2d.cpp b/runtime/lib/ttnn/operations/conv/conv2d.cpp index 74a579f070..4fc5b769ce 100644 --- a/runtime/lib/ttnn/operations/conv/conv2d.cpp +++ b/runtime/lib/ttnn/operations/conv/conv2d.cpp @@ -10,6 +10,31 @@ #include "ttmlir/Target/TTNN/program_generated.h" #include "ttnn/types.hpp" +#include "flatbuffers/flatbuffers.h" +#include + +// Assume `vec` is a pointer to ::flatbuffers::Vector +void PrintFlatBufferVector(const flatbuffers::Vector *vec) { + if (!vec) { + std::cout << "Vector is null." << std::endl; + return; + } + + std::cout << "Vector elements: ["; + for (size_t i = 0; i < vec->size(); ++i) { + std::cout << vec->Get(i); + if (i < vec->size() - 1) { + std::cout << ", "; + } + } + std::cout << "]" << std::endl; +} + +template +void PrintArray(const std::array &arr, const std::string &name) { + std::cout << name << ": [" << arr[0] << ", " << arr[1] << "]" << std::endl; +} + namespace tt::runtime::ttnn::operations::conv { void run(const ::tt::target::ttnn::Conv2dOp *op, ProgramContext &context) { ProgramTensorPool &tensorPool = context.getTensorPool(); @@ -29,6 +54,38 @@ void run(const ::tt::target::ttnn::Conv2dOp *op, ProgramContext &context) { std::copy(op->padding()->begin(), op->padding()->end(), padding.begin()); std::copy(op->dilation()->begin(), op->dilation()->end(), dilation.begin()); + std::cout << "In channels: " << op->in_channels() << std::endl; + std::cout << "Out channels: " << op->out_channels() << std::endl; + std::cout << "Batch size: " << op->batch_size() << std::endl; + std::cout << "Input height: " << op->input_height() << std::endl; + std::cout << "Input width: " << op->input_width() << std::endl; + + std::cout << "Kernel size: "; + PrintFlatBufferVector(op->kernel_size()); + + std::cout << "Stride: "; + PrintFlatBufferVector(op->stride()); + + std::cout << "Padding: "; + PrintFlatBufferVector(op->padding()); + + std::cout << "Dilation: "; + PrintFlatBufferVector(op->dilation()); + + std::cout << "Moj Kernel: " << kernelSize[0] << ", " << kernelSize[1] + << std::endl; + PrintArray(stride, "Stride"); + std::cout + << "***************************** TEST TEST ************************" + << std::endl; + std::cout + << "***************************** TEST1 TEST ************************" + << std::endl; + std::cout << "Moj Padding: " << padding[0] << ", " << padding[1] << std::endl; + std::cout << "Moj Dilation: " << dilation[0] << ", " << dilation[1] + << std::endl; + std::cout << "Groups: " << op->groups() << std::endl; + std::optional<::ttnn::operations::conv::Conv2dConfig> conv2dConfig = op->conv2d_config() ? std::make_optional(