Skip to content

Commit

Permalink
fix the code formatting (indentation, trailing spaces), fix the diffe…
Browse files Browse the repository at this point in the history
…rence between gitub and perforce

Signed-off-by: xilinxfei <[email protected]>
  • Loading branch information
xilixnfei committed Aug 14, 2024
1 parent ae4a667 commit d437321
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 39 deletions.
62 changes: 34 additions & 28 deletions src/runtime_src/core/include/xclbin.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,20 @@
* limitations under the License.
*
* GPL license Verbiage:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with this program;
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#ifndef _XCLBIN_H_
Expand Down Expand Up @@ -184,8 +190,8 @@ extern "C" {
VENDER_METADATA = 31,
AIE_PARTITION = 32,
IP_METADATA = 33,
AIE_RESOURCES_BIN = 34,
AIE_TRACE_METADATA = 35,
AIE_RESOURCES_BIN = 34,
AIE_TRACE_METADATA = 35,
};

enum MEM_TYPE {
Expand Down Expand Up @@ -237,10 +243,10 @@ extern "C" {
uint16_t m_actionMask; /* Bit Mask */
unsigned char m_interface_uuid[16]; /* Interface uuid of this xclbin */
unsigned char m_platformVBNV[64]; /* e.g. xilinx:xil-accel-rd-ku115:4ddr-xpr:3.4: null terminated */
union {
char m_next_axlf[16]; /* Name of next xclbin file in the daisy chain */
xuid_t uuid; /* uuid of this xclbin*/
};
union {
char m_next_axlf[16]; /* Name of next xclbin file in the daisy chain */
xuid_t uuid; /* uuid of this xclbin*/
};
char m_debug_bin[16]; /* Name of binary with debug information */
uint32_t m_numSections; /* Number of section headers */
};
Expand Down Expand Up @@ -503,22 +509,22 @@ extern "C" {
struct aie_resources_bin { /* aie_resources_bin data section */
// Prefix Syntax:
// mpo - member, pointer, offset
// This variable represents a zero terminated string
// that is offseted from the beginning of the section.
//
// The pointer to access the string is initialized as follows:
// char * pCharString = (address_of_section) + (mpo value)
uint32_t mpo_name; // Name of the aie_resources_bin section
uint32_t m_image_offset; // Image offset
uint32_t m_image_size; // Image size
uint32_t mpo_version; // Version
uint32_t m_start_column; // Start column
uint32_t m_num_columns; // Number of columns
uint8_t padding[36]; // Reserved for future use
uint8_t reservedExt[16]; // Reserved for future extended data
// This variable represents a zero terminated string
// that is offseted from the beginning of the section.
//
// The pointer to access the string is initialized as follows:
// char * pCharString = (address_of_section) + (mpo value)
uint32_t mpo_name; // Name of the aie_resources_bin section
uint32_t m_image_offset; // Image offset
uint32_t m_image_size; // Image size
uint32_t mpo_version; // Version
uint32_t m_start_column; // Start column
uint32_t m_num_columns; // Number of columns
uint8_t padding[36]; // Reserved for future use
uint8_t reservedExt[16]; // Reserved for future extended data
};
XCLBIN_STATIC_ASSERT(sizeof(struct aie_resources_bin) == 76, "aie_resources_bin structure no longer is 76 bytes in size");

enum FLASH_TYPE
{
FLT_UNKNOWN = 0,
Expand Down Expand Up @@ -585,7 +591,7 @@ extern "C" {
struct cdo_group {
uint32_t mpo_name; // Name of the CDO group (Null terminated string)
uint8_t cdo_type; // CDO group type (CDO_Type)
uint8_t padding[3];
uint8_t padding[3];
uint64_t pdi_id; // PDI ID
struct array_offset dpu_kernel_ids; // Array of dpu_kernel_ids (uint64_t)
struct array_offset pre_cdo_groups; // Array of Pre CDO Group IDs (uint32_t)
Expand Down
23 changes: 12 additions & 11 deletions src/runtime_src/tools/xclbinutil/SectionAIEPartition.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <iostream>

namespace XUtil = XclBinUtilities;
namespace fs = std::filesystem;

// -------------------------------------------------------------------------

Expand Down Expand Up @@ -159,11 +160,11 @@ process_PDI_uuid(const boost::property_tree::ptree& ptPDI,

static void
read_file_into_buffer(const std::string& fileName,
const std::filesystem::path& fromRelativeDir,
const fs::path& fromRelativeDir,
std::vector<char>& buffer)
{
// Build the path to our file of interest
std::filesystem::path filePath = fileName;
fs::path filePath = fileName;

if (filePath.is_relative()) {
filePath = fromRelativeDir;
Expand Down Expand Up @@ -195,7 +196,7 @@ read_file_into_buffer(const std::string& fileName,

static void
process_PDI_file(const boost::property_tree::ptree& ptAIEPartitionPDI,
const std::filesystem::path& relativeFromDir,
const fs::path& relativeFromDir,
aie_pdi& aiePartitionPDI,
SectionHeap& heap)
{
Expand Down Expand Up @@ -314,7 +315,7 @@ process_PDI_cdo_groups(const boost::property_tree::ptree& ptAIEPartitionPDI,

static void
process_PDIs(const boost::property_tree::ptree& ptAIEPartition,
const std::filesystem::path& relativeFromDir,
const fs::path& relativeFromDir,
aie_partition& aiePartitionHdr,
SectionHeap& heap)
{
Expand Down Expand Up @@ -388,7 +389,7 @@ process_partition_info(const boost::property_tree::ptree& ptAIEPartition,

static void
createAIEPartitionImage(const std::string& sectionIndexName,
const std::filesystem::path& relativeFromDir,
const fs::path& relativeFromDir,
std::istream& iStream,
std::ostringstream& osBuffer)
{
Expand Down Expand Up @@ -461,7 +462,7 @@ SectionAIEPartition::readSubPayload(const char* pOrigDataSection,

// Get the JSON's file parent directory. This is used later to any
// relative PDI images that might need need to be read in.
std::filesystem::path p(getPathAndName());
fs::path p(getPathAndName());
const auto relativeFromDir = p.parent_path();

createAIEPartitionImage(getSectionIndexName(), relativeFromDir, iStream, buffer);
Expand Down Expand Up @@ -574,9 +575,9 @@ static void
write_pdi_image(const char* pBase,
const aie_pdi& aiePDI,
const std::string& fileName,
const std::filesystem::path& relativeToDir)
const fs::path& relativeToDir)
{
std::filesystem::path filePath = relativeToDir;
fs::path filePath = relativeToDir;
filePath /= fileName;

XUtil::TRACE(boost::format("Creating PDI Image: %s") % filePath.string());
Expand All @@ -594,7 +595,7 @@ write_pdi_image(const char* pBase,
// -------------------------------------------------------------------------
static void
populate_PDIs(const char* pBase,
const std::filesystem::path& relativeToDir,
const fs::path& relativeToDir,
const aie_partition& aiePartition,
boost::property_tree::ptree& ptAiePartition)
{
Expand Down Expand Up @@ -629,7 +630,7 @@ populate_PDIs(const char* pBase,
static void
writeAIEPartitionImage(const char* pBuffer,
unsigned int bufferSize,
const std::filesystem::path& relativeToDir,
const fs::path& relativeToDir,
std::ostream& oStream)
{
XUtil::TRACE("AIE_PARTITION : Creating JSON IMAGE");
Expand Down Expand Up @@ -701,7 +702,7 @@ SectionAIEPartition::writeSubPayload(const std::string& sSubSectionName,
throw std::runtime_error(errMsg);
}

std::filesystem::path p(getPathAndName());
fs::path p(getPathAndName());
const auto relativeToDir = p.parent_path();

writeAIEPartitionImage(m_pBuffer, m_bufferSize, relativeToDir, oStream);
Expand Down

0 comments on commit d437321

Please sign in to comment.