Skip to content

Commit

Permalink
DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
jserbedzijaTT committed Feb 3, 2025
1 parent 9587da0 commit c4d787f
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions runtime/lib/ttnn/operations/conv/conv2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,31 @@
#include "ttmlir/Target/TTNN/program_generated.h"
#include "ttnn/types.hpp"

#include "flatbuffers/flatbuffers.h"
#include <iostream>

// Assume `vec` is a pointer to ::flatbuffers::Vector<int32_t>
void PrintFlatBufferVector(const flatbuffers::Vector<int32_t> *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 <typename T, size_t N>
void PrintArray(const std::array<T, N> &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();
Expand All @@ -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(
Expand Down

0 comments on commit c4d787f

Please sign in to comment.