Skip to content

Commit

Permalink
Streamline CDO generation (Xilinx#184)
Browse files Browse the repository at this point in the history
* [CDO] skip common step and clean files

* Remove commented code

* [CDO] use simplified flow

* Update buildAndTest.yml
  • Loading branch information
jgmelber authored and GitHub Enterprise committed Sep 19, 2023
1 parent f06b0b6 commit b1bc0c6
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/buildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
# cache.
build-llvm:
name: Build pynqMLIR-AIE
runs-on: xrlabs-xsj
runs-on: xrlabs-xco
steps:
# - name: Configure Environment
# run: echo "$GITHUB_WORKSPACE/llvm/install/bin" >> $GITHUB_PATH
Expand Down
3 changes: 1 addition & 2 deletions data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
# (c) Copyright 2023, Advanced Micro Devices, Inc.

set(DATA_FILES
libadf.a
simnow_base.xclbin
dev0.xclbin
generated-source/gen_cdo.h
generated-source/gen_cdo.cpp
generated-source/cdo_main.cpp
Expand Down
Binary file added data/dev0.xclbin
Binary file not shown.
59 changes: 0 additions & 59 deletions data/generated-source/gen_cdo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,10 @@ void addCoreEnableToCDO(){
ppgraph_core_enable();
}

//void addDbgHaltToCDO(){
// ppgraph_core_debug_halt();
//}
//
//void addResetConfigToCDO(){
// resetPartition();
//}

void addErrorHandlingToCDO(){
enableErrorHandling();
}

//void addClockGatingToCDO(){
// enableClockGating();
//}
//
//void addMemClearingConfigToCDO(){
// clearPartitionMems();
//}

void addAieElfsToCDO(const std::string &workDirPath){
std::vector<std::string> elfInfoPath;
if(!ppgraph_load_elf(workDirPath, elfInfoPath))
Expand All @@ -50,36 +34,6 @@ void addAieElfsToCDO(const std::string &workDirPath){

void generateCDOBinariesSeparately(const std::string &workDirPath, bool AXIdebug) {

//// aie_cdo_reset.bin
//const std::string resetCDOFilePath = workDirPath + "aie_cdo_reset.bin";
//if(AXIdebug) std::cout << "START: Reset Configuration\n";
//startCDOFileStream(resetCDOFilePath.c_str());
//FileHeader();
//addResetConfigToCDO();
//configureHeader();
//endCurrentCDOFileStream();
//if(AXIdebug) std::cout << "DONE: Reset Configuration\n\n";

//// aie_cdo_clock_gating.bin
//const std::string clockGatingCDOFilePath = workDirPath + "aie_cdo_clock_gating.bin";
//if(AXIdebug) std::cout << "START: Clock Gating Configuration\n";
//startCDOFileStream(clockGatingCDOFilePath.c_str());
//FileHeader();
//addClockGatingToCDO();
//configureHeader();
//endCurrentCDOFileStream();
//if(AXIdebug) std::cout << "DONE: Clock Gating Configuration\n\n";

//// aie_cdo_mem_clear.bin
//const std::string memClearingCDOFilePath = workDirPath + "aie_cdo_mem_clear.bin";
//if(AXIdebug) std::cout << "START: Memory Clearing Configuration\n";
//startCDOFileStream(memClearingCDOFilePath.c_str());
//FileHeader();
//addMemClearingConfigToCDO();
//configureHeader();
//endCurrentCDOFileStream();
//if(AXIdebug) std::cout << "DONE: Memory Clearing Configuration\n\n";

// aie_cdo_error_handling.bin
const std::string errorHandlingCDOFilePath = workDirPath + "aie_cdo_error_handling.bin";
if(AXIdebug) std::cout << "START: Error Handling Configuration\n";
Expand Down Expand Up @@ -120,17 +74,4 @@ void generateCDOBinariesSeparately(const std::string &workDirPath, bool AXIdebug
endCurrentCDOFileStream();
if(AXIdebug) std::cout << "DONE: Core Enable Configuration\n\n";

//// aie_cdo_debug.bin
//const std::string dbgHaltCDOFilePath = workDirPath + "aie_cdo_debug.bin";
//if(AXIdebug) std::cout << "START: Core Debug Halt Configuration\n";
//startCDOFileStream(dbgHaltCDOFilePath.c_str());
//FileHeader();
//addDbgHaltToCDO();
//configureHeader();
//endCurrentCDOFileStream();
//if(AXIdebug) std::cout << "DONE: Core Debug Halt Configuration\n\n";

//// aie_resources.bin
//const std::string aieRscsFilePath = workDirPath + "/config/aie_resources.bin";
//dumpAllocatedRscsToFile(aieRscsFilePath);
}
Binary file removed data/libadf.a
Binary file not shown.
Binary file removed data/simnow_base.xclbin
Binary file not shown.
25 changes: 4 additions & 21 deletions python/aie/compiler/aiecc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,29 +377,12 @@ async def process_xclbin_gen(self):
'-image', os.path.join(self.tmpdirname,'design.bif'),
'-o', os.path.join(self.tmpdirname,'design.pdi'),
'-w'])
await self.do_call(task, ['v++','-p','-f','/opt/platforms/xilinx_vck190_base_202220_1/xilinx_vck190_base_202220_1.xpfm',
'-t','hw_emu',
os.path.join(self.tmpdirname,'simnow_base.xclbin'),
os.path.join(self.tmpdirname,'libadf.a'),
'-o',os.path.join(self.tmpdirname,'dev0.xclbin'),
'--advanced.param','package.generateAieIpu=true'])
xclbinutil = "/opt/xilinx/xrt/bin/xclbinutil"
await self.do_call(task, [xclbinutil,
'--replace-section',
'PDI:raw:'+os.path.join(self.tmpdirname,'design.pdi'),
'-i',os.path.join(self.tmpdirname,'dev0.xclbin'),
'-o',os.path.join(self.tmpdirname,'dev1.xclbin'),
'--force'])
await self.do_call(task, [xclbinutil,
'--input', os.path.join(self.tmpdirname,'dev1.xclbin'),
await self.do_call(task, ['xclbinutil',
'--input' , os.path.join(self.tmpdirname,'dev0.xclbin'),
'--add-kernel', os.path.join(self.tmpdirname,'kernels.json'),
'--output',os.path.join(self.tmpdirname,'dev2.xclbin'),
'--force'])
await self.do_call(task, [xclbinutil,
'--input' , os.path.join(self.tmpdirname,'dev2.xclbin'),
'--add-section',
'AIE_PARTITION[]:JSON:'+os.path.join(self.tmpdirname,'aie_partition.json'),
'--output', opts.xclbin_name, '--force'])
'AIE_PARTITION:JSON:'+os.path.join(self.tmpdirname,'aie_partition.json'),
'--output', opts.xclbin_name])


async def process_host_cgen(self):
Expand Down

0 comments on commit b1bc0c6

Please sign in to comment.