Skip to content

Commit

Permalink
fix the formatting issues
Browse files Browse the repository at this point in the history
Signed-off-by: xilinxfei <[email protected]>
  • Loading branch information
xilixnfei committed Feb 11, 2025
1 parent f02de26 commit 4a6b601
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 180 deletions.
22 changes: 11 additions & 11 deletions src/runtime_src/core/include/xrt/detail/xclbin.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ extern "C" {

enum ACTION_MASK {
AM_LOAD_AIE = 0x1, /* Indicates to the driver to load the AIE PID section */
AM_LOAD_PDI = 0x2, /* Indicates to the driver to program the PDI */
AM_LOAD_PDI = 0x2, /* Indicates to the driver to program the PDI */
};

struct axlf_section_header {
Expand Down Expand Up @@ -262,9 +262,9 @@ extern "C" {
uint64_t m_uniqueId; /* axlf's uniqueId, use it to skip redownload etc */
struct axlf_header m_header; /* Inline header */
#if defined(__linux__) && defined(__KERNEL__)
struct axlf_section_header m_sections[]; // One or more section headers follow. Flexible array size suitable for kernel space.
struct axlf_section_header m_sections[]; // One or more section headers follow. Flexible array size suitable for kernel space.
#else
struct axlf_section_header m_sections[1]; /* One or more section headers follow */
struct axlf_section_header m_sections[1]; /* One or more section headers follow */
#endif
};

Expand Down Expand Up @@ -369,7 +369,7 @@ extern "C" {
// m_interrupt_id : Bits - 0x0000_00FE;
// m_ip_control : Bits = 0x0000_FF00;
// properties is also used for ps kernel (i.e. -add-pskernel)

// PS Kernels
// m_type: IP_PS_KERNEL
struct {
Expand Down Expand Up @@ -461,7 +461,7 @@ extern "C" {
#if defined(__linux__) && defined(__KERNEL__)
struct clock_freq m_clock_freq[]; // Clock array. Flexible array size suitable for kernel space.
#else
struct clock_freq m_clock_freq[1]; /* Clock array */
struct clock_freq m_clock_freq[1]; /* Clock array */
#endif
};

Expand Down Expand Up @@ -630,15 +630,15 @@ extern "C" {
uint8_t reserved[72]; // Reserved
};
XCLBIN_STATIC_ASSERT(sizeof(struct aie_partition_info) == 88, "partition_info structure no longer is 88 bytes in size");

struct aie_partition {
uint8_t schema_version; // Group schema version (default 0)
uint8_t padding0[3]; // Byte alignment
uint32_t mpo_name; // Name of the aie_partition
uint8_t padding0[3]; // Byte alignment
uint32_t mpo_name; // Name of the aie_partition
uint32_t operations_per_cycle; // Operations per cycle. Used later to create TOPS (operations_per_cycle * <AIE Clock Frequency>)
uint8_t padding[4];
uint64_t inference_fingerprint; // The unique hash value of the inference function
uint64_t pre_post_fingerprint; // The unique hash value of pre post
uint64_t pre_post_fingerprint; // The unique hash value of pre post
struct aie_partition_info info; // Partition information
struct array_offset aie_pdi; // PDI Array (aie_partition_info)
// kernel_commit_id is modeled after mpo_name
Expand All @@ -647,15 +647,15 @@ extern "C" {
//
// The pointer to access the string is initialized as follows:
// char * pCharString = (address_of_section) + (mpo value)
uint32_t kernel_commit_id; // The git repo commit id for DPU_PHX_KERNEL
uint32_t kernel_commit_id; // The git repo commit id for DPU_PHX_KERNEL
uint8_t reserved[52]; // Reserved
};
XCLBIN_STATIC_ASSERT(sizeof(struct aie_partition) == 184, "aie_partition structure no longer is 184 bytes in size");
XCLBIN_STATIC_ASSERT(sizeof(struct aie_partition) % sizeof(uint64_t) == 0, "aie_partition structure needs to be 64-bit word aligned");

/**** END : Xilinx internal section *****/

# if defined(__cplusplus) && !defined(__KERNEL__) && !defined(_KERNEL_MODE)
# if defined(__cplusplus) && !defined(__KERNEL__) && !defined(_KERNEL_MODE)
namespace xclbin {
inline const axlf_section_header*
get_axlf_section(const axlf* top, axlf_section_kind kind)
Expand Down
13 changes: 7 additions & 6 deletions src/runtime_src/tools/xclbinutil/ElfUtilities.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@


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

static
auto findExecutablePath(const std::string& executable)
{
std::filesystem::path executablePath;
fs::path executablePath;

#if 0 // Only enabled for the Vitis version of xclbinutil
// -- Check to see if XILINX_VITIS has been set
Expand All @@ -46,7 +47,7 @@ auto findExecutablePath(const std::string& executable)
executablePath = xilinxVitisEnv;
executablePath = executablePath / "aietools" / "tps" / "lnx64" / "gcc" / "bin" / executable;
XUtil::TRACE("Step 1: Looking for executable at: '" + executablePath.string() + "'");
if (!std::filesystem::exists(executablePath)) {
if (!fs::exists(executablePath)) {
executablePath = ""; // Executable doesn't exist
XUtil::TRACE("Not found");
}
Expand All @@ -59,15 +60,15 @@ auto findExecutablePath(const std::string& executable)
XUtil::TRACE("Step 2: Looking for executable path");
auto path = boost::process::search_path(executable);
executablePath = path.string();
if (!std::filesystem::exists(executablePath))
if (!fs::exists(executablePath))
XUtil::TRACE("Not found");

}
#endif

// -- Default path /usr/bin
if (executablePath.string().empty())
executablePath = std::filesystem::path("/usr") / "bin" / executable;
executablePath = fs::path("/usr") / "bin" / executable;

return executablePath;
}
Expand Down Expand Up @@ -875,10 +876,10 @@ drcCheckExportedFunctions(const std::vector<std::string> exportedFunctions)
// Report all of the mangled functions
if (!mangledFunctions.empty()) {
std::sort(mangledFunctions.begin(), mangledFunctions.end());

auto errMsg = boost::str(boost::format("ERROR: C++ mangled functions are not supported, please export the function. \nOffending function(s):\n"));

for (const auto& entry : mangledFunctions)
for (const auto& entry : mangledFunctions)
errMsg += boost::str(boost::format(" %s\n") % entry);

throw std::runtime_error(errMsg);
Expand Down
12 changes: 6 additions & 6 deletions src/runtime_src/tools/xclbinutil/KernelUtilities.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ void buildXMLKernelEntry(const boost::property_tree::ptree& ptKernel,
// but xml only taks numeric value
// we need to conver string to correponding nemeric
auto sFunctional = ptExtendedData.get<std::string>("functional", "");
sFunctional = SectionIPLayout::getFunctionalEnumStr(sFunctional);
sFunctional = SectionIPLayout::getFunctionalEnumStr(sFunctional);
ptExtendedData.put("functional", sFunctional);

auto sSubType = ptExtendedData.get<std::string>("subtype", "");
sSubType = SectionIPLayout::getSubTypeEnumStr(sSubType);
sSubType = SectionIPLayout::getSubTypeEnumStr(sSubType);
ptExtendedData.put("subtype", sSubType);

boost::property_tree::ptree ptEntry;
ptEntry.add_child("<xmlattr>", ptExtendedData);
ptKernelXML.add_child("extended-data", ptEntry);
Expand Down Expand Up @@ -297,7 +297,7 @@ void addArgsToMemoryConnections(const unsigned int ipLayoutIndexID,
// if memory-connection is not empty
// 1. for --add-pskernel, user can specify the memory bank indices in
// the value
// 2. for --add-kernel, user can specify the memory bank tag in the
// 2. for --add-kernel, user can specify the memory bank tag in the
// input file
if (memoryConnection == NOT_DEFINED) {
++argIndexID;
Expand Down Expand Up @@ -355,7 +355,7 @@ void addArgsToMemoryConnections(const unsigned int ipLayoutIndexID,
}
else
{
const auto errMsg = boost::format("Specified memory bank (%d) is invalid. Valid ranges are from 0 to %d.") % memBankIndex % memTopology.size();
const auto errMsg = boost::format("Specified memory bank (%d) is invalid. Valid ranges are from 0 to %d.") % memBankIndex % memTopology.size();
throw std::runtime_error(errMsg.str());
}
}
Expand Down Expand Up @@ -465,7 +465,7 @@ XclBinUtilities::addKernel(const boost::property_tree::ptree& ptKernel,
// "fundtional": "0"
// "subtype": "1"
// "dpu_kernel_id": "0x101"
// }
// }
boost::optional< const boost::property_tree::ptree& > boExtendedData = ptKernel.get_child_optional("extended-data");
if (boExtendedData) {
const boost::property_tree::ptree& ptExtendedData = boExtendedData.get();
Expand Down
6 changes: 3 additions & 3 deletions src/runtime_src/tools/xclbinutil/SectionAIEPartition.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ populate_cdo_groups(const char* pBase,
boost::property_tree::ptree ptElement;

// Name
auto sName = reinterpret_cast<const char*>(pBase + element.mpo_name);
auto sName = reinterpret_cast<const char*>(pBase + element.mpo_name);
ptElement.put("name", sName);
XUtil::TRACE("Populating CDO group: " + std::string(sName));

Expand Down Expand Up @@ -657,7 +657,7 @@ writeAIEPartitionImage(const char* pBuffer,
// kernel_commit_id, we should make sure the offset is NOT 0
auto sKernelCommitId = "";
if (pHdr->kernel_commit_id != 0) {
sKernelCommitId = reinterpret_cast<const char*>(pBuffer + pHdr->kernel_commit_id);
sKernelCommitId = reinterpret_cast<const char*>(pBuffer + pHdr->kernel_commit_id);
} else {
XUtil::TRACE(boost::format("Open an existing xclbin: kernel_commit_id is 0x%lx") % pHdr->kernel_commit_id);
}
Expand Down Expand Up @@ -720,7 +720,7 @@ SectionAIEPartition::readXclBinBinary(std::istream& iStream,

// Do we have enough room to overlay the header structure
if (m_bufferSize < sizeof(aie_partition)) {
auto errMsg = boost::format("ERROR: Segment size (%d) is smaller than the size of the aie_partition structure (%d)")
auto errMsg = boost::format("ERROR: Segment size (%d) is smaller than the size of the aie_partition structure (%d)")
% m_bufferSize % sizeof(aie_partition);
throw std::runtime_error(boost::str(errMsg));
}
Expand Down
16 changes: 8 additions & 8 deletions src/runtime_src/tools/xclbinutil/SectionAIEResourcesBin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ SectionAIEResourcesBin::subSectionExists(const std::string& _sSubSectionName) co

ss.write((char*)sBuffer.c_str(), sBuffer.size());
boost::property_tree::ptree pt;
// Create a property tree and determine if the variables are all default values
// Create a property tree and determine if the variables are all default values
try{
boost::property_tree::read_json(ss, pt);
boost::property_tree::read_json(ss, pt);
}
catch (const boost::property_tree::json_parser_error& e) {
(void)e;
(void)e;
auto errMsg = boost::format("ERROR: Unable to parse metadata file of section '%s'") % getSectionIndexName();
throw std::runtime_error(errMsg.str());
}
Expand Down Expand Up @@ -194,18 +194,18 @@ SectionAIEResourcesBin::copyBufferUpdateMetadata(const char* _pOrigDataSection,
// Convert JSON memory image into a boost property tree
std::stringstream ss;
ss.write((char*)memBuffer.get(), fileSize);

boost::property_tree::ptree pt;

try{
boost::property_tree::read_json(ss, pt);
}

catch (const boost::property_tree::json_parser_error& e) {
(void)e;
(void)e;
auto errMsg = boost::format("ERROR: Unable to parse metadata file of section '%s'") % getSectionIndexName();
throw std::runtime_error(errMsg.str());
}
}
// ----------------------

// Extract and update the data
Expand Down Expand Up @@ -506,13 +506,13 @@ SectionAIEResourcesBin::readXclBinBinary(std::istream& _istream, const axlf_sect

// Create a property tree and determine if the variables are all default values
boost::property_tree::ptree pt;

try {
boost::property_tree::read_json(ss, pt);
}

catch (const boost::property_tree::json_parser_error& e) {
(void)e;
(void)e;
auto errMsg = boost::format("ERROR: Unable to parse metadata file of section '%s'") % getSectionIndexName();
throw std::runtime_error(errMsg.str());
}
Expand Down
4 changes: 2 additions & 2 deletions src/runtime_src/tools/xclbinutil/SectionSmartNic.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ SectionSmartNic::marshalFromJSON(const boost::property_tree::ptree& _ptSection,

/**
* Compares two given property trees to validate that they are the same.
*
*
* @param primary - Primary property tree
* @param secondary - Secondary property tree
*/
Expand Down Expand Up @@ -325,7 +325,7 @@ using NodeCallBackFuncs = std::map<std::string, node_sig_ptr>;

/**
* Used to traverse a node array.
*
*
* @param nodeName The primary node name of the array
* @param key Optional key value that is used to determine array item uniqueness
* @param ptParent Parent property_tree
Expand Down
Loading

0 comments on commit 4a6b601

Please sign in to comment.