Skip to content

Commit

Permalink
Fix variable casing
Browse files Browse the repository at this point in the history
  • Loading branch information
andresovela committed Jul 22, 2024
1 parent 440a054 commit e724673
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions xformer/Utils/FileIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,45 +42,45 @@ writeTileServerDataToFile(const std::string &filename,
auto tileHeader = utils::tileRamHeader();
tensorsVec.insert(tensorsVec.begin(), tileHeader);

std::ostringstream c_out;
c_out << R"(#include <stdint.h>)";
std::ostringstream cOut;
cOut << R"(#include <stdint.h>)";

if (placeInExternalMemory) {
c_out << "\n\n" << R"(__attribute__ ((section(".ExtMem.data"))))" << "\n";
cOut << "\n\n" << R"(__attribute__ ((section(".ExtMem.data"))))" << "\n";
}

c_out << "const int8_t tile_server_weights[] = {\n";
cOut << "const int8_t tile_server_weights[] = {\n";
int lineEnding = 0;
int weightsSize = 0;
for (auto const &tensor : tensorsVec) {
for (auto const &i : tensor) {
c_out << (int)i << ", ";
cOut << (int)i << ", ";
lineEnding++;
weightsSize++;
if (lineEnding > 80) {
c_out << "\n";
cOut << "\n";
lineEnding = 0;
}
}
}

c_out << R"(};
cOut << R"(};
)";

if (failed(utils::writeDataToFile(filename + ".c", c_out.str()))) {
if (failed(utils::writeDataToFile(filename + ".c", cOut.str()))) {
return failure();
}

std::ostringstream h_out;
h_out << R"(#ifndef TILESERVERGEN_H
std::ostringstream hOut;
hOut << R"(#ifndef TILESERVERGEN_H
#define TILESERVERGEN_H
#define TILE_SERVER_WEIGHTS_SIZE ()" << weightsSize << R"(U)
#endif // TILESERVERGEN_H
)";

return utils::writeDataToFile(filename + ".h", h_out.str());
return utils::writeDataToFile(filename + ".h", hOut.str());
}

LogicalResult getFlatBufferStringFromMLIR(
Expand Down

0 comments on commit e724673

Please sign in to comment.