diff --git a/python/compiler/aiecc/main.py b/python/compiler/aiecc/main.py index 7df9a9cf07..e1a325283d 100644 --- a/python/compiler/aiecc/main.py +++ b/python/compiler/aiecc/main.py @@ -21,6 +21,7 @@ import tempfile from textwrap import dedent import time +import uuid from aie.extras.runtime.passes import Pipeline @@ -207,7 +208,8 @@ def emit_partition(mlir_module_str, kernel_id="0x901", start_columns=None): else: start_columns = list(range(1, 6 - num_cols)) - uuid = random.randint(2222, 9999) + # Generate a uuid + pdi_uuid = uuid.uuid4() return { "aie_partition": { "name": "QoS", @@ -220,7 +222,7 @@ def emit_partition(mlir_module_str, kernel_id="0x901", start_columns=None): }, "PDIs": [ { - "uuid": "00000000-0000-0000-0000-00000000" + str(uuid), + "uuid": str(pdi_uuid), "file_name": "./design.pdi", "cdo_groups": [ { diff --git a/tools/aie2xclbin/CMakeLists.txt b/tools/aie2xclbin/CMakeLists.txt index b6056b18c9..1f30dee67d 100644 --- a/tools/aie2xclbin/CMakeLists.txt +++ b/tools/aie2xclbin/CMakeLists.txt @@ -21,6 +21,8 @@ get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) configure_file(configure.h.in configure.h) target_include_directories(aie2xclbin PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") +find_library (UUID uuid) + target_link_libraries(aie2xclbin ${dialect_libs} MLIRParser @@ -37,7 +39,8 @@ target_link_libraries(aie2xclbin AIEX AIEXTransforms MLIRAIEVecDialect - MLIRXLLVMDialect) + MLIRXLLVMDialect + ${UUID}) install(TARGETS aie2xclbin EXPORT AIE2XCLBIN diff --git a/tools/aie2xclbin/XCLBinGen.cpp b/tools/aie2xclbin/XCLBinGen.cpp index a45ea8bd07..77ba35f513 100644 --- a/tools/aie2xclbin/XCLBinGen.cpp +++ b/tools/aie2xclbin/XCLBinGen.cpp @@ -40,6 +40,8 @@ #include "llvm/Support/Program.h" #include "llvm/Support/ToolOutputFile.h" +#include + #include #include #include @@ -453,6 +455,11 @@ static LogicalResult generateXCLBin(MLIRContext *context, ModuleOp moduleOp, if (!aiePartitionJsonOut) return moduleOp.emitOpError(errorMessage); + uuid_t binuuid; + uuid_generate_random(binuuid); + char uuid[37]; + uuid_unparse_lower(binuuid, uuid); + std::string aie_partition_json_data = R"( { "aie_partition": { @@ -468,7 +475,7 @@ static LogicalResult generateXCLBin(MLIRContext *context, ModuleOp moduleOp, }, "PDIs": [ { - "uuid": "00000000-0000-0000-0000-000000008025", + "uuid": ")" + std::string(uuid) + R"(", "file_name": "./design.pdi", "cdo_groups": [ {