From 1c549e44d979123fb76238e5cca303a8f861d723 Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Fri, 28 Feb 2025 16:23:30 -0800 Subject: [PATCH] Move files to reduce levels aiebu/src/cpp/aiebu/src/* -> aiebu/src/cpp/* Wrap legacy headers to include from new location, which is now aiebu/src/cpp/include/aiebu/*. This extra aieby level is so that end-user exported files can be added under include/aiebu rather than directly under include. Ensure that clients including legacy top-level headers can still build when including from legacy location when using aiebu as a submodule. Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com> Move headers Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com> --- CMakeLists.txt | 2 +- src/cpp/{aiebu => }/.dir-locals.el | 0 src/cpp/{aiebu/src => }/CMakeLists.txt | 10 +- src/cpp/aiebu/CMakeLists.txt | 4 - src/cpp/aiebu/src/.clang-tidy | 304 ------------------ src/cpp/aiebu/src/include/aiebu.h | 90 +----- src/cpp/aiebu/src/include/aiebu_assembler.h | 121 +------ src/cpp/aiebu/src/include/aiebu_error.h | 60 +--- src/cpp/{aiebu/src => }/analyzer/reporter.cpp | 0 src/cpp/{aiebu/src => }/analyzer/reporter.h | 0 .../{aiebu/src => }/analyzer/transaction.cpp | 0 .../{aiebu/src => }/analyzer/transaction.hpp | 0 .../src => }/assembler/aiebu_assembler.cpp | 0 .../{aiebu/src => }/assembler/assembler.cpp | 0 src/cpp/{aiebu/src => }/assembler/assembler.h | 0 .../{aiebu/src => }/common/aiebu_error.cpp | 0 .../src => }/common/assembler_state.cpp | 0 .../{aiebu/src => }/common/assembler_state.h | 0 src/cpp/{aiebu/src => }/common/code_section.h | 0 .../{aiebu/src => }/common/linux/uid_md5.h | 0 src/cpp/{aiebu/src => }/common/symbol.h | 0 src/cpp/{aiebu/src => }/common/uid_md5.h | 0 src/cpp/{aiebu/src => }/common/utils.cpp | 0 src/cpp/{aiebu/src => }/common/utils.h | 0 .../src => }/common/windows/uid_md5.cpp | 0 .../{aiebu/src => }/common/windows/uid_md5.h | 0 src/cpp/{aiebu/src => }/common/writer.cpp | 0 src/cpp/{aiebu/src => }/common/writer.h | 0 .../src => }/elf/aie2/aie2_blob_elfwriter.h | 0 .../src => }/elf/aie2ps/aie2ps_elfwriter.h | 0 src/cpp/{aiebu/src => }/elf/elfwriter.cpp | 0 src/cpp/{aiebu/src => }/elf/elfwriter.h | 0 .../src => }/encoder/aie2/aie2_blob_encoder.h | 0 .../encoder/aie2ps/aie2ps_encoder.cpp | 0 .../src => }/encoder/aie2ps/aie2ps_encoder.h | 0 src/cpp/{aiebu/src => }/encoder/encoder.h | 0 src/cpp/include/aiebu/aiebu.h | 88 +++++ src/cpp/include/aiebu/aiebu_assembler.h | 119 +++++++ src/cpp/include/aiebu/aiebu_error.h | 58 ++++ src/cpp/{aiebu/src => }/ops/oparg.h | 0 src/cpp/{aiebu/src => }/ops/ops.cpp | 0 src/cpp/{aiebu/src => }/ops/ops.h | 0 .../preprocessor/aie2/aie2_asm_preprocessor.h | 0 .../aie2/aie2_asm_preprocessor_input.cpp | 0 .../aie2/aie2_blob_preprocessed_output.h | 0 .../aie2/aie2_blob_preprocessor.h | 0 .../aie2/aie2_blob_preprocessor_input.cpp | 0 .../aie2/aie2_blob_preprocessor_input.h | 0 .../aie2ps/aie2ps_preprocessed_output.h | 0 .../preprocessor/aie2ps/aie2ps_preprocessor.h | 0 .../aie2ps/aie2ps_preprocessor_input.cpp | 0 .../aie2ps/aie2ps_preprocessor_input.h | 0 .../src => }/preprocessor/asm/asm_parser.cpp | 0 .../src => }/preprocessor/asm/asm_parser.h | 0 .../{aiebu/src => }/preprocessor/asm/page.h | 0 .../src => }/preprocessor/asm/pager.cpp | 0 .../{aiebu/src => }/preprocessor/asm/pager.h | 0 .../preprocessor/preprocessed_output.h | 0 .../src => }/preprocessor/preprocessor.h | 0 .../preprocessor/preprocessor_input.h | 0 src/cpp/{aiebu => }/utils/CMakeLists.txt | 0 src/cpp/{aiebu => }/utils/asm/CMakeLists.txt | 12 +- src/cpp/{aiebu => }/utils/asm/asm.cpp | 0 src/cpp/{aiebu => }/utils/target/target.cpp | 0 src/cpp/{aiebu => }/utils/target/target.h | 0 65 files changed, 287 insertions(+), 581 deletions(-) rename src/cpp/{aiebu => }/.dir-locals.el (100%) rename src/cpp/{aiebu/src => }/CMakeLists.txt (94%) delete mode 100644 src/cpp/aiebu/CMakeLists.txt delete mode 100644 src/cpp/aiebu/src/.clang-tidy rename src/cpp/{aiebu/src => }/analyzer/reporter.cpp (100%) rename src/cpp/{aiebu/src => }/analyzer/reporter.h (100%) rename src/cpp/{aiebu/src => }/analyzer/transaction.cpp (100%) rename src/cpp/{aiebu/src => }/analyzer/transaction.hpp (100%) rename src/cpp/{aiebu/src => }/assembler/aiebu_assembler.cpp (100%) rename src/cpp/{aiebu/src => }/assembler/assembler.cpp (100%) rename src/cpp/{aiebu/src => }/assembler/assembler.h (100%) rename src/cpp/{aiebu/src => }/common/aiebu_error.cpp (100%) rename src/cpp/{aiebu/src => }/common/assembler_state.cpp (100%) rename src/cpp/{aiebu/src => }/common/assembler_state.h (100%) rename src/cpp/{aiebu/src => }/common/code_section.h (100%) rename src/cpp/{aiebu/src => }/common/linux/uid_md5.h (100%) rename src/cpp/{aiebu/src => }/common/symbol.h (100%) rename src/cpp/{aiebu/src => }/common/uid_md5.h (100%) rename src/cpp/{aiebu/src => }/common/utils.cpp (100%) rename src/cpp/{aiebu/src => }/common/utils.h (100%) rename src/cpp/{aiebu/src => }/common/windows/uid_md5.cpp (100%) rename src/cpp/{aiebu/src => }/common/windows/uid_md5.h (100%) rename src/cpp/{aiebu/src => }/common/writer.cpp (100%) rename src/cpp/{aiebu/src => }/common/writer.h (100%) rename src/cpp/{aiebu/src => }/elf/aie2/aie2_blob_elfwriter.h (100%) rename src/cpp/{aiebu/src => }/elf/aie2ps/aie2ps_elfwriter.h (100%) rename src/cpp/{aiebu/src => }/elf/elfwriter.cpp (100%) rename src/cpp/{aiebu/src => }/elf/elfwriter.h (100%) rename src/cpp/{aiebu/src => }/encoder/aie2/aie2_blob_encoder.h (100%) rename src/cpp/{aiebu/src => }/encoder/aie2ps/aie2ps_encoder.cpp (100%) rename src/cpp/{aiebu/src => }/encoder/aie2ps/aie2ps_encoder.h (100%) rename src/cpp/{aiebu/src => }/encoder/encoder.h (100%) create mode 100644 src/cpp/include/aiebu/aiebu.h create mode 100644 src/cpp/include/aiebu/aiebu_assembler.h create mode 100644 src/cpp/include/aiebu/aiebu_error.h rename src/cpp/{aiebu/src => }/ops/oparg.h (100%) rename src/cpp/{aiebu/src => }/ops/ops.cpp (100%) rename src/cpp/{aiebu/src => }/ops/ops.h (100%) rename src/cpp/{aiebu/src => }/preprocessor/aie2/aie2_asm_preprocessor.h (100%) rename src/cpp/{aiebu/src => }/preprocessor/aie2/aie2_asm_preprocessor_input.cpp (100%) rename src/cpp/{aiebu/src => }/preprocessor/aie2/aie2_blob_preprocessed_output.h (100%) rename src/cpp/{aiebu/src => }/preprocessor/aie2/aie2_blob_preprocessor.h (100%) rename src/cpp/{aiebu/src => }/preprocessor/aie2/aie2_blob_preprocessor_input.cpp (100%) rename src/cpp/{aiebu/src => }/preprocessor/aie2/aie2_blob_preprocessor_input.h (100%) rename src/cpp/{aiebu/src => }/preprocessor/aie2ps/aie2ps_preprocessed_output.h (100%) rename src/cpp/{aiebu/src => }/preprocessor/aie2ps/aie2ps_preprocessor.h (100%) rename src/cpp/{aiebu/src => }/preprocessor/aie2ps/aie2ps_preprocessor_input.cpp (100%) rename src/cpp/{aiebu/src => }/preprocessor/aie2ps/aie2ps_preprocessor_input.h (100%) rename src/cpp/{aiebu/src => }/preprocessor/asm/asm_parser.cpp (100%) rename src/cpp/{aiebu/src => }/preprocessor/asm/asm_parser.h (100%) rename src/cpp/{aiebu/src => }/preprocessor/asm/page.h (100%) rename src/cpp/{aiebu/src => }/preprocessor/asm/pager.cpp (100%) rename src/cpp/{aiebu/src => }/preprocessor/asm/pager.h (100%) rename src/cpp/{aiebu/src => }/preprocessor/preprocessed_output.h (100%) rename src/cpp/{aiebu/src => }/preprocessor/preprocessor.h (100%) rename src/cpp/{aiebu/src => }/preprocessor/preprocessor_input.h (100%) rename src/cpp/{aiebu => }/utils/CMakeLists.txt (100%) rename src/cpp/{aiebu => }/utils/asm/CMakeLists.txt (84%) rename src/cpp/{aiebu => }/utils/asm/asm.cpp (100%) rename src/cpp/{aiebu => }/utils/target/target.cpp (100%) rename src/cpp/{aiebu => }/utils/target/target.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 599608d..5696a67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ project(AIEBU HOMEPAGE_URL https://github.com/Xilinx/aiebu VERSION 1.0) include(cmake/settings.cmake) -add_subdirectory(src/cpp/aiebu) +add_subdirectory(src/cpp) add_subdirectory(specification) diff --git a/src/cpp/aiebu/.dir-locals.el b/src/cpp/.dir-locals.el similarity index 100% rename from src/cpp/aiebu/.dir-locals.el rename to src/cpp/.dir-locals.el diff --git a/src/cpp/aiebu/src/CMakeLists.txt b/src/cpp/CMakeLists.txt similarity index 94% rename from src/cpp/aiebu/src/CMakeLists.txt rename to src/cpp/CMakeLists.txt index 148c638..0b3dc26 100644 --- a/src/cpp/aiebu/src/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -1,5 +1,7 @@ # SPDX-License-Identifier: MIT # Copyright (C) 2024-2025, Advanced Micro Devices, Inc. All rights reserved. +add_subdirectory(utils) + add_library(aiebu_library_objects OBJECT analyzer/reporter.cpp analyzer/transaction.cpp @@ -26,7 +28,7 @@ target_include_directories(aiebu_library_objects ${AIEBU_SOURCE_DIR}/src/cpp/ELFIO # The following should be spelled out in code - ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_CURRENT_SOURCE_DIR}/include/aiebu ${CMAKE_CURRENT_SOURCE_DIR}/preprocessor ${CMAKE_CURRENT_SOURCE_DIR}/preprocessor/aie2 ${CMAKE_CURRENT_SOURCE_DIR}/encoder @@ -87,9 +89,9 @@ install (TARGETS aiebu aiebu_static ) install(FILES - include/aiebu.h - include/aiebu_assembler.h - include/aiebu_error.h + include/aiebu/aiebu.h + include/aiebu/aiebu_assembler.h + include/aiebu/aiebu_error.h DESTINATION ${AIEBU_INSTALL_INCLUDE_DIR} CONFIGURATIONS Debug Release COMPONENT Runtime ) diff --git a/src/cpp/aiebu/CMakeLists.txt b/src/cpp/aiebu/CMakeLists.txt deleted file mode 100644 index 177c039..0000000 --- a/src/cpp/aiebu/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# SPDX-License-Identifier: MIT -# Copyright (C) 2024-2025 Advanced Micro Devices, Inc. All rights reserved. -add_subdirectory(src) -add_subdirectory(utils) diff --git a/src/cpp/aiebu/src/.clang-tidy b/src/cpp/aiebu/src/.clang-tidy deleted file mode 100644 index 712c360..0000000 --- a/src/cpp/aiebu/src/.clang-tidy +++ /dev/null @@ -1,304 +0,0 @@ -# SPDX-License-Identifier: MIT -# Copyright (C) 2024-2025 Advanced Micro Devices, Inc. All rights reserved. ---- -# The following configuration was generated with --dump-config and then manually tweaked to suit XRT coding style. -# The command line used to generate the global src/.clang-tidy is: -# clang-tidy "-checks=cert-*,bugprone-*,clang-analyzer-*,concurrency-*,cppcoreguidelines-*,hicpp-*,modernize-*" --dump-config -# clang-tidy looks for .clang-tidy file walking up the source directory structure to identify which checks to run -# One can customize checks in specific source directories by placing custom .clang-tidy in those source directories -Checks: ' -clang-diagnostic-*, -clang-analyzer-*, -cert-*, -bugprone-*, -clang-analyzer-*, -concurrency-*, -cppcoreguidelines-*, -hicpp-*, --hicpp-no-array-decay, --hicpp-signed-bitwise, -modernize-*, --modernize-use-trailing-return-type, --cppcoreguidelines-pro-bounds-pointer-arithmetic, --cppcoreguidelines-pro-type-union-access, --cppcoreguidelines-pro-bounds-array-to-pointer-decay, --cppcoreguidelines-pro-type-reinterpret-cast, --cppcoreguidelines-pro-bounds-constant-array-index, -' - -WarningsAsErrors: '' -HeaderFilterRegex: '' -FormatStyle: none -User: sonals -CheckOptions: - - key: bugprone-argument-comment.CommentBoolLiterals - value: '0' - - key: bugprone-argument-comment.CommentCharacterLiterals - value: '0' - - key: bugprone-argument-comment.CommentFloatLiterals - value: '0' - - key: bugprone-argument-comment.CommentIntegerLiterals - value: '0' - - key: bugprone-argument-comment.CommentNullPtrs - value: '0' - - key: bugprone-argument-comment.CommentStringLiterals - value: '0' - - key: bugprone-argument-comment.CommentUserDefinedLiterals - value: '0' - - key: bugprone-argument-comment.IgnoreSingleArgument - value: '0' - - key: bugprone-argument-comment.StrictMode - value: '0' - - key: bugprone-assert-side-effect.AssertMacros - value: assert - - key: bugprone-assert-side-effect.CheckFunctionCalls - value: '0' - - key: bugprone-dangling-handle.HandleClasses - value: 'std::basic_string_view;std::experimental::basic_string_view' - - key: bugprone-dynamic-static-initializers.HeaderFileExtensions - value: ',h,hh,hpp,hxx' - - key: bugprone-exception-escape.FunctionsThatShouldNotThrow - value: '' - - key: bugprone-exception-escape.IgnoredExceptions - value: '' - - key: bugprone-misplaced-widening-cast.CheckImplicitCasts - value: '0' - - key: bugprone-not-null-terminated-result.WantToUseSafeFunctions - value: '1' - - key: bugprone-signed-char-misuse.CharTypdefsToIgnore - value: '' - - key: bugprone-sizeof-expression.WarnOnSizeOfCompareToConstant - value: '1' - - key: bugprone-sizeof-expression.WarnOnSizeOfConstant - value: '1' - - key: bugprone-sizeof-expression.WarnOnSizeOfIntegerExpression - value: '0' - - key: bugprone-sizeof-expression.WarnOnSizeOfThis - value: '1' - - key: bugprone-string-constructor.LargeLengthThreshold - value: '8388608' - - key: bugprone-string-constructor.WarnOnLargeLength - value: '1' - - key: bugprone-suspicious-enum-usage.StrictMode - value: '0' - - key: bugprone-suspicious-missing-comma.MaxConcatenatedTokens - value: '5' - - key: bugprone-suspicious-missing-comma.RatioThreshold - value: '0.200000' - - key: bugprone-suspicious-missing-comma.SizeThreshold - value: '5' - - key: bugprone-suspicious-string-compare.StringCompareLikeFunctions - value: '' - - key: bugprone-suspicious-string-compare.WarnOnImplicitComparison - value: '1' - - key: bugprone-suspicious-string-compare.WarnOnLogicalNotComparison - value: '0' - - key: bugprone-too-small-loop-variable.MagnitudeBitsUpperLimit - value: '16' - - key: bugprone-unhandled-self-assignment.WarnOnlyIfThisHasSuspiciousField - value: '1' - - key: bugprone-unused-return-value.CheckedFunctions - value: '::std::async;::std::launder;::std::remove;::std::remove_if;::std::unique;::std::unique_ptr::release;::std::basic_string::empty;::std::vector::empty' - - key: cert-dcl16-c.IgnoreMacros - value: '1' - - key: cert-dcl16-c.NewSuffixes - value: 'L;LL;LU;LLU' - - key: cert-dcl59-cpp.HeaderFileExtensions - value: ',h,hh,hpp,hxx' - - key: cert-err09-cpp.CheckThrowTemporaries - value: '1' - - key: cert-err61-cpp.CheckThrowTemporaries - value: '1' - - key: cert-msc32-c.DisallowedSeedTypes - value: 'time_t,std::time_t' - - key: cert-msc51-cpp.DisallowedSeedTypes - value: 'time_t,std::time_t' - - key: cert-oop11-cpp.IncludeStyle - value: llvm - - key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField - value: '0' - - key: cppcoreguidelines-avoid-magic-numbers.IgnoredFloatingPointValues - value: '1.0;100.0;' - - key: cppcoreguidelines-avoid-magic-numbers.IgnoredIntegerValues - value: '1;2;3;4;' - - key: cppcoreguidelines-explicit-virtual-functions.AllowOverrideAndFinal - value: '0' - - key: cppcoreguidelines-explicit-virtual-functions.FinalSpelling - value: final - - key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors - value: '1' - - key: cppcoreguidelines-explicit-virtual-functions.OverrideSpelling - value: override - - key: cppcoreguidelines-macro-usage.AllowedRegexp - value: '^DEBUG_*' - - key: cppcoreguidelines-macro-usage.CheckCapsOnly - value: '0' - - key: cppcoreguidelines-macro-usage.IgnoreCommandLineMacros - value: '1' - - key: cppcoreguidelines-no-malloc.Allocations - value: '::malloc;::calloc' - - key: cppcoreguidelines-no-malloc.Deallocations - value: '::free' - - key: cppcoreguidelines-no-malloc.Reallocations - value: '::realloc' - - key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic - value: '1' - - key: cppcoreguidelines-owning-memory.LegacyResourceConsumers - value: '::free;::realloc;::freopen;::fclose' - - key: cppcoreguidelines-owning-memory.LegacyResourceProducers - value: '::malloc;::aligned_alloc;::realloc;::calloc;::fopen;::freopen;::tmpfile' - - key: cppcoreguidelines-pro-type-member-init.IgnoreArrays - value: '0' - - key: cppcoreguidelines-pro-type-member-init.UseAssignment - value: '0' - - key: cppcoreguidelines-special-member-functions.AllowMissingMoveFunctions - value: '0' - - key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor - value: '0' - - key: google-readability-braces-around-statements.ShortStatementLines - value: '1' - - key: google-readability-function-size.StatementThreshold - value: '800' - - key: google-readability-namespace-comments.ShortNamespaceLines - value: '10' - - key: google-readability-namespace-comments.SpacesBeforeComments - value: '2' - - key: hicpp-braces-around-statements.ShortStatementLines - value: '4' - - key: hicpp-function-size.BranchThreshold - value: '4294967295' - - key: hicpp-function-size.LineThreshold - value: '4294967295' - - key: hicpp-function-size.NestingThreshold - value: '4294967295' - - key: hicpp-function-size.ParameterThreshold - value: '4294967295' - - key: hicpp-function-size.StatementThreshold - value: '800' - - key: hicpp-function-size.VariableThreshold - value: '4294967295' - - key: hicpp-member-init.IgnoreArrays - value: '0' - - key: hicpp-member-init.UseAssignment - value: '0' - - key: hicpp-move-const-arg.CheckTriviallyCopyableMove - value: '1' - - key: hicpp-multiway-paths-covered.WarnOnMissingElse - value: '0' - - key: hicpp-named-parameter.IgnoreFailedSplit - value: '0' - - key: hicpp-no-malloc.Allocations - value: '::malloc;::calloc' - - key: hicpp-no-malloc.Deallocations - value: '::free' - - key: hicpp-no-malloc.Reallocations - value: '::realloc' - - key: hicpp-signed-bitwise.IgnorePositiveIntegerLiterals - value: '1' - - key: hicpp-special-member-functions.AllowMissingMoveFunctions - value: '0' - - key: hicpp-special-member-functions.AllowSoleDefaultDtor - value: '0' - - key: hicpp-uppercase-literal-suffix.IgnoreMacros - value: '1' - - key: hicpp-uppercase-literal-suffix.NewSuffixes - value: '' - - key: hicpp-use-auto.MinTypeNameLength - value: '5' - - key: hicpp-use-auto.RemoveStars - value: '0' - - key: hicpp-use-emplace.ContainersWithPushBack - value: '::std::vector;::std::list;::std::deque' - - key: hicpp-use-emplace.SmartPointers - value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr' - - key: hicpp-use-emplace.TupleMakeFunctions - value: '::std::make_pair;::std::make_tuple' - - key: hicpp-use-emplace.TupleTypes - value: '::std::pair;::std::tuple' - - key: hicpp-use-equals-default.IgnoreMacros - value: '1' - - key: hicpp-use-equals-delete.IgnoreMacros - value: '1' - - key: hicpp-use-noexcept.ReplacementString - value: '' - - key: hicpp-use-noexcept.UseNoexceptFalse - value: '1' - - key: hicpp-use-nullptr.NullMacros - value: '' - - key: hicpp-use-override.AllowOverrideAndFinal - value: '0' - - key: hicpp-use-override.FinalSpelling - value: final - - key: hicpp-use-override.IgnoreDestructors - value: '0' - - key: hicpp-use-override.OverrideSpelling - value: override - - key: modernize-loop-convert.MaxCopySize - value: '16' - - key: modernize-loop-convert.MinConfidence - value: reasonable - - key: modernize-loop-convert.NamingStyle - value: CamelCase - - key: modernize-make-shared.IgnoreMacros - value: '1' - - key: modernize-make-shared.MakeSmartPtrFunction - value: 'std::make_shared' - - key: modernize-make-shared.MakeSmartPtrFunctionHeader - value: memory - - key: modernize-make-unique.IgnoreMacros - value: '1' - - key: modernize-make-unique.MakeSmartPtrFunction - value: 'std::make_unique' - - key: modernize-make-unique.MakeSmartPtrFunctionHeader - value: memory - - key: modernize-pass-by-value.IncludeStyle - value: llvm - - key: modernize-pass-by-value.ValuesOnly - value: '0' - - key: modernize-raw-string-literal.ReplaceShorterLiterals - value: '0' - - key: modernize-replace-auto-ptr.IncludeStyle - value: llvm - - key: modernize-replace-random-shuffle.IncludeStyle - value: llvm - - key: modernize-use-auto.MinTypeNameLength - value: '5' - - key: modernize-use-auto.RemoveStars - value: '0' - - key: modernize-use-default-member-init.IgnoreMacros - value: '1' - - key: modernize-use-default-member-init.UseAssignment - value: '0' - - key: modernize-use-emplace.ContainersWithPushBack - value: '::std::vector;::std::list;::std::deque' - - key: modernize-use-emplace.SmartPointers - value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr' - - key: modernize-use-emplace.TupleMakeFunctions - value: '::std::make_pair;::std::make_tuple' - - key: modernize-use-emplace.TupleTypes - value: '::std::pair;::std::tuple' - - key: modernize-use-equals-default.IgnoreMacros - value: '1' - - key: modernize-use-equals-delete.IgnoreMacros - value: '1' - - key: modernize-use-nodiscard.ReplacementString - value: '[[nodiscard]]' - - key: modernize-use-noexcept.ReplacementString - value: '' - - key: modernize-use-noexcept.UseNoexceptFalse - value: '1' - - key: modernize-use-nullptr.NullMacros - value: 'NULL' - - key: modernize-use-override.AllowOverrideAndFinal - value: '0' - - key: modernize-use-override.FinalSpelling - value: final - - key: modernize-use-override.IgnoreDestructors - value: '0' - - key: modernize-use-override.OverrideSpelling - value: override - - key: modernize-use-transparent-functors.SafeMode - value: '0' - - key: modernize-use-using.IgnoreMacros - value: '1' -... diff --git a/src/cpp/aiebu/src/include/aiebu.h b/src/cpp/aiebu/src/include/aiebu.h index 9909cbb..ff06e7f 100644 --- a/src/cpp/aiebu/src/include/aiebu.h +++ b/src/cpp/aiebu/src/include/aiebu.h @@ -1,88 +1,4 @@ // SPDX-License-Identifier: MIT -// Copyright (C) 2024, Advanced Micro Devices, Inc. All rights reserved. - -#ifndef _AIEBU_H_ -#define _AIEBU_H_ - -#ifdef __cplusplus -extern "C" { -#include -#endif - -#include - -#if defined(_WIN32) -#define DRIVER_DLLESPEC __declspec(dllexport) -#else -#define DRIVER_DLLESPEC __attribute__((visibility("default"))) -#endif - -enum aiebu_error_code { - aiebu_invalid_asm = 1, - aiebu_invalid_patch_schema, - aiebu_invalid_batch_buffer_type, - aiebu_invalid_buffer_type, - aiebu_invalid_offset, - aiebu_invalid_internal_error -}; - -enum aiebu_assembler_buffer_type { - aiebu_assembler_buffer_type_blob_instr_dpu, - aiebu_assembler_buffer_type_blob_instr_prepost, - aiebu_assembler_buffer_type_blob_instr_transaction, - aiebu_assembler_buffer_type_blob_control_packet, - aiebu_assembler_buffer_type_asm_aie2ps -}; - -struct pm_ctrlpkt { - uint32_t pm_id; - const char* pm_buffer; - size_t pm_buffer_size; -}; - -/* - * This API takes buffer type, 2 buffers, their sizes and external_buffer_id json - * it also allocate elf_buf and It fill elf content in it. - * return, on success return return elf size, else posix error(negative). - * User may pass any combination like - * 1. type as aiebu_assembler_buffer_type_blob_instr_transaction, buffer1 as instruction buffer - * and buffer2 as control_packet: in this case it will package buffers in text and data - * section of elf respectively. - * 2. type as aiebu_assembler_buffer_type_blob_instr_transaction, buffer1 as instruction buffer - * and buffer2 as null: in this case it will package buffer in text section. - * 3. type as aiebu_assembler_buffer_type_asm_aie2ps, buffer1 as asm buffer and buffer2 - * as null: in this case it will assemble the asm code and package in elf. - * - * @type buffer type - * @instr_buf first buffer - * @instr_buf_size first buffer size - * @control_buf second buffer - * @control_buf_size second buffer size - * @elf_buf elf buffer - * @patch_json external_buffer_id_json buffer. - * @patch_json_size patch_json array size - * @libs libs to be included, ";" separated. - * @libpaths paths to search for libs, ";" separated. - * @ctrlpkt array of pm_ctrlpkt holding pm buffer and id - * @ctrlpkt_size size of ctrlpkt array - */ -DRIVER_DLLESPEC -int -aiebu_assembler_get_elf(enum aiebu_assembler_buffer_type type, - const char* buffer1, - size_t buffer1_size, - const char* buffer2, - size_t buffer2_size, - void** elf_buf, - const char* patch_json, - size_t patch_json_size, - const char* libs, - const char* libpaths, - struct pm_ctrlpkt* pm_ctrlpkts, - size_t pm_ctrlpkt_size); - -#ifdef __cplusplus -} -#endif - -#endif +// Copyright (C) 2025, Advanced Micro Devices, Inc. All rights reserved. +#pragma message("please replace src/cpp/aiebu/src/include/aiebu.h with src/cpp/include/aiebu/aiebu.h") +#include "../../../include/aiebu/aiebu.h" diff --git a/src/cpp/aiebu/src/include/aiebu_assembler.h b/src/cpp/aiebu/src/include/aiebu_assembler.h index 5c94752..ef682f1 100644 --- a/src/cpp/aiebu/src/include/aiebu_assembler.h +++ b/src/cpp/aiebu/src/include/aiebu_assembler.h @@ -1,119 +1,4 @@ // SPDX-License-Identifier: MIT -// Copyright (C) 2024, Advanced Micro Devices, Inc. All rights reserved. - -#ifndef _AIEBU_ASSEMBLER_H_ -#define _AIEBU_ASSEMBLER_H_ - -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#define DRIVER_DLLESPEC __declspec(dllexport) -#else -#define DRIVER_DLLESPEC __attribute__((visibility("default"))) -#endif - -namespace aiebu { - -// Assembler Class - -class aiebu_assembler { - std::vector elf_data; - - public: - - enum class buffer_type { - blob_instr_dpu, - blob_instr_prepost, - blob_instr_transaction, - blob_control_packet, - asm_aie2ps, - asm_aie2 - }; - - private: - const buffer_type _type; - - public: - /* - * Constructor takes buffer type , 2 buffer and a vector of symbols with - * external_buffer_id json as argument. - * its throws aiebu::error object. - * User may pass any combination like - * 1. type as blob_instr_transaction, buffer1 as instruction buffer - * and buffer2 as control_packet and pm_ctrlpkt as map of - * : in this case it will package buffers in text section, data section and - * ctrlpkt_pm_N section of elf respectively. - * 2. type as blob_instr_transaction, buffer1 as instruction buffer - * and buffer2 as empty and and pm_ctrlpkt as map of - * : in this case it will package buffer in text section and ctrlpkt_pm_N section of elf respectively. - * 3. type as asm_aie2ps, buffer1 as asm buffer and buffer2 - * as empty: in this case it will assemble the asm code and package in elf. - * - * @type buffer type - * @instr_buf first buffer - * @constrol_buf second buffer - * @patch_json external_buffer_id json - * @libs libs to include in elf - * @libpaths paths to search for libs - * @ctrlpkt map of pm id and pm control packet buffer - */ - DRIVER_DLLESPEC - aiebu_assembler(buffer_type type, - const std::vector& buffer1, - const std::vector& buffer2, - const std::vector& patch_json, - const std::vector& libs = {}, - const std::vector& libpaths = {}, - const std::map >& pm_ctrlpkt = {}); - - /* - * Constructor takes buffer type, buffer, - * and a vector of symbols with their patching information as argument. - * its throws aiebu::error object. - * - * @type buffer type - * @instr_buf first buffer - * @libs libs to include in elf - * @libpaths paths to search for libs - * @patch_json external_buffer_id json - */ - DRIVER_DLLESPEC - aiebu_assembler(buffer_type type, - const std::vector& buffer, - const std::vector& libs = {}, - const std::vector& libpaths = {}, - const std::vector& patch_json = {}); - - /* - * This function return vector with elf content. - * - * Inside elf for IPU, instr_buf will be placed in .text section and control_buf will - * be placed in .data section. There are other dynamic sections in the elf - * containing the relocatable information. With this elf, at runtime, XRT - * will patch the symbols (value or address based on the schema) into their - * instruction buffer and control buffer before sending the buffer to device. - * - * return: vector of char with elf content - */ - [[nodiscard]] - DRIVER_DLLESPEC - std::vector - get_elf() const; - - void - DRIVER_DLLESPEC - get_report(std::ostream &stream) const; - - void - DRIVER_DLLESPEC - disassemble(const std::filesystem::path &root) const; -}; - -} //namespace aiebu - -#endif // _AIEBU_ASSEMBLER_H_ +// Copyright (C) 2025, Advanced Micro Devices, Inc. All rights reserved. +#pragma message("please replace src/cpp/aiebu/src/include/aiebu_assembler.h with src/cpp/include/aiebu/aiebu_assembler.h") +#include "../../../include/aiebu/aiebu_assembler.h" diff --git a/src/cpp/aiebu/src/include/aiebu_error.h b/src/cpp/aiebu/src/include/aiebu_error.h index c220679..67cc364 100644 --- a/src/cpp/aiebu/src/include/aiebu_error.h +++ b/src/cpp/aiebu/src/include/aiebu_error.h @@ -1,58 +1,4 @@ // SPDX-License-Identifier: MIT -// Copyright (C) 2024, Advanced Micro Devices, Inc. All rights reserved. - -#ifndef _AIEBU_ERROR_H_ -#define _AIEBU_ERROR_H_ - -#include -#include "aiebu.h" - -#if defined(_WIN32) -#define DRIVER_DLLESPEC __declspec(dllexport) -#else -#define DRIVER_DLLESPEC __attribute__((visibility("default"))) -#endif - -namespace aiebu { - -class error : public std::system_error -{ -public: - - enum class DRIVER_DLLESPEC error_code : int - { - invalid_asm = aiebu_invalid_asm, - invalid_patch_schema = aiebu_invalid_patch_schema, - invalid_patch_buffer_type = aiebu_invalid_batch_buffer_type, - invalid_buffer_type = aiebu_invalid_buffer_type, - invalid_offset = aiebu_invalid_offset, - internal_error = aiebu_invalid_internal_error - }; - - DRIVER_DLLESPEC - error(error_code ec, const std::error_category& cat, const std::string& what = ""); - - explicit - DRIVER_DLLESPEC - error(error_code ec, const std::string& what = ""); - - // Retrive underlying code for return plain error code - [[nodiscard]] - DRIVER_DLLESPEC - int - value() const; - - [[nodiscard]] - DRIVER_DLLESPEC - int - get() const; - - [[nodiscard]] - DRIVER_DLLESPEC - int - get_code() const; -}; - -} - -#endif //_AIEBU_ERROR_H_ +// Copyright (C) 2025, Advanced Micro Devices, Inc. All rights reserved. +#pragma message("please replace src/cpp/aiebu/src/include/aiebu_error.h with src/cpp/include/aiebu/aiebu_error.h") +#include "../../../include/aiebu/aiebu_error.h" diff --git a/src/cpp/aiebu/src/analyzer/reporter.cpp b/src/cpp/analyzer/reporter.cpp similarity index 100% rename from src/cpp/aiebu/src/analyzer/reporter.cpp rename to src/cpp/analyzer/reporter.cpp diff --git a/src/cpp/aiebu/src/analyzer/reporter.h b/src/cpp/analyzer/reporter.h similarity index 100% rename from src/cpp/aiebu/src/analyzer/reporter.h rename to src/cpp/analyzer/reporter.h diff --git a/src/cpp/aiebu/src/analyzer/transaction.cpp b/src/cpp/analyzer/transaction.cpp similarity index 100% rename from src/cpp/aiebu/src/analyzer/transaction.cpp rename to src/cpp/analyzer/transaction.cpp diff --git a/src/cpp/aiebu/src/analyzer/transaction.hpp b/src/cpp/analyzer/transaction.hpp similarity index 100% rename from src/cpp/aiebu/src/analyzer/transaction.hpp rename to src/cpp/analyzer/transaction.hpp diff --git a/src/cpp/aiebu/src/assembler/aiebu_assembler.cpp b/src/cpp/assembler/aiebu_assembler.cpp similarity index 100% rename from src/cpp/aiebu/src/assembler/aiebu_assembler.cpp rename to src/cpp/assembler/aiebu_assembler.cpp diff --git a/src/cpp/aiebu/src/assembler/assembler.cpp b/src/cpp/assembler/assembler.cpp similarity index 100% rename from src/cpp/aiebu/src/assembler/assembler.cpp rename to src/cpp/assembler/assembler.cpp diff --git a/src/cpp/aiebu/src/assembler/assembler.h b/src/cpp/assembler/assembler.h similarity index 100% rename from src/cpp/aiebu/src/assembler/assembler.h rename to src/cpp/assembler/assembler.h diff --git a/src/cpp/aiebu/src/common/aiebu_error.cpp b/src/cpp/common/aiebu_error.cpp similarity index 100% rename from src/cpp/aiebu/src/common/aiebu_error.cpp rename to src/cpp/common/aiebu_error.cpp diff --git a/src/cpp/aiebu/src/common/assembler_state.cpp b/src/cpp/common/assembler_state.cpp similarity index 100% rename from src/cpp/aiebu/src/common/assembler_state.cpp rename to src/cpp/common/assembler_state.cpp diff --git a/src/cpp/aiebu/src/common/assembler_state.h b/src/cpp/common/assembler_state.h similarity index 100% rename from src/cpp/aiebu/src/common/assembler_state.h rename to src/cpp/common/assembler_state.h diff --git a/src/cpp/aiebu/src/common/code_section.h b/src/cpp/common/code_section.h similarity index 100% rename from src/cpp/aiebu/src/common/code_section.h rename to src/cpp/common/code_section.h diff --git a/src/cpp/aiebu/src/common/linux/uid_md5.h b/src/cpp/common/linux/uid_md5.h similarity index 100% rename from src/cpp/aiebu/src/common/linux/uid_md5.h rename to src/cpp/common/linux/uid_md5.h diff --git a/src/cpp/aiebu/src/common/symbol.h b/src/cpp/common/symbol.h similarity index 100% rename from src/cpp/aiebu/src/common/symbol.h rename to src/cpp/common/symbol.h diff --git a/src/cpp/aiebu/src/common/uid_md5.h b/src/cpp/common/uid_md5.h similarity index 100% rename from src/cpp/aiebu/src/common/uid_md5.h rename to src/cpp/common/uid_md5.h diff --git a/src/cpp/aiebu/src/common/utils.cpp b/src/cpp/common/utils.cpp similarity index 100% rename from src/cpp/aiebu/src/common/utils.cpp rename to src/cpp/common/utils.cpp diff --git a/src/cpp/aiebu/src/common/utils.h b/src/cpp/common/utils.h similarity index 100% rename from src/cpp/aiebu/src/common/utils.h rename to src/cpp/common/utils.h diff --git a/src/cpp/aiebu/src/common/windows/uid_md5.cpp b/src/cpp/common/windows/uid_md5.cpp similarity index 100% rename from src/cpp/aiebu/src/common/windows/uid_md5.cpp rename to src/cpp/common/windows/uid_md5.cpp diff --git a/src/cpp/aiebu/src/common/windows/uid_md5.h b/src/cpp/common/windows/uid_md5.h similarity index 100% rename from src/cpp/aiebu/src/common/windows/uid_md5.h rename to src/cpp/common/windows/uid_md5.h diff --git a/src/cpp/aiebu/src/common/writer.cpp b/src/cpp/common/writer.cpp similarity index 100% rename from src/cpp/aiebu/src/common/writer.cpp rename to src/cpp/common/writer.cpp diff --git a/src/cpp/aiebu/src/common/writer.h b/src/cpp/common/writer.h similarity index 100% rename from src/cpp/aiebu/src/common/writer.h rename to src/cpp/common/writer.h diff --git a/src/cpp/aiebu/src/elf/aie2/aie2_blob_elfwriter.h b/src/cpp/elf/aie2/aie2_blob_elfwriter.h similarity index 100% rename from src/cpp/aiebu/src/elf/aie2/aie2_blob_elfwriter.h rename to src/cpp/elf/aie2/aie2_blob_elfwriter.h diff --git a/src/cpp/aiebu/src/elf/aie2ps/aie2ps_elfwriter.h b/src/cpp/elf/aie2ps/aie2ps_elfwriter.h similarity index 100% rename from src/cpp/aiebu/src/elf/aie2ps/aie2ps_elfwriter.h rename to src/cpp/elf/aie2ps/aie2ps_elfwriter.h diff --git a/src/cpp/aiebu/src/elf/elfwriter.cpp b/src/cpp/elf/elfwriter.cpp similarity index 100% rename from src/cpp/aiebu/src/elf/elfwriter.cpp rename to src/cpp/elf/elfwriter.cpp diff --git a/src/cpp/aiebu/src/elf/elfwriter.h b/src/cpp/elf/elfwriter.h similarity index 100% rename from src/cpp/aiebu/src/elf/elfwriter.h rename to src/cpp/elf/elfwriter.h diff --git a/src/cpp/aiebu/src/encoder/aie2/aie2_blob_encoder.h b/src/cpp/encoder/aie2/aie2_blob_encoder.h similarity index 100% rename from src/cpp/aiebu/src/encoder/aie2/aie2_blob_encoder.h rename to src/cpp/encoder/aie2/aie2_blob_encoder.h diff --git a/src/cpp/aiebu/src/encoder/aie2ps/aie2ps_encoder.cpp b/src/cpp/encoder/aie2ps/aie2ps_encoder.cpp similarity index 100% rename from src/cpp/aiebu/src/encoder/aie2ps/aie2ps_encoder.cpp rename to src/cpp/encoder/aie2ps/aie2ps_encoder.cpp diff --git a/src/cpp/aiebu/src/encoder/aie2ps/aie2ps_encoder.h b/src/cpp/encoder/aie2ps/aie2ps_encoder.h similarity index 100% rename from src/cpp/aiebu/src/encoder/aie2ps/aie2ps_encoder.h rename to src/cpp/encoder/aie2ps/aie2ps_encoder.h diff --git a/src/cpp/aiebu/src/encoder/encoder.h b/src/cpp/encoder/encoder.h similarity index 100% rename from src/cpp/aiebu/src/encoder/encoder.h rename to src/cpp/encoder/encoder.h diff --git a/src/cpp/include/aiebu/aiebu.h b/src/cpp/include/aiebu/aiebu.h new file mode 100644 index 0000000..9909cbb --- /dev/null +++ b/src/cpp/include/aiebu/aiebu.h @@ -0,0 +1,88 @@ +// SPDX-License-Identifier: MIT +// Copyright (C) 2024, Advanced Micro Devices, Inc. All rights reserved. + +#ifndef _AIEBU_H_ +#define _AIEBU_H_ + +#ifdef __cplusplus +extern "C" { +#include +#endif + +#include + +#if defined(_WIN32) +#define DRIVER_DLLESPEC __declspec(dllexport) +#else +#define DRIVER_DLLESPEC __attribute__((visibility("default"))) +#endif + +enum aiebu_error_code { + aiebu_invalid_asm = 1, + aiebu_invalid_patch_schema, + aiebu_invalid_batch_buffer_type, + aiebu_invalid_buffer_type, + aiebu_invalid_offset, + aiebu_invalid_internal_error +}; + +enum aiebu_assembler_buffer_type { + aiebu_assembler_buffer_type_blob_instr_dpu, + aiebu_assembler_buffer_type_blob_instr_prepost, + aiebu_assembler_buffer_type_blob_instr_transaction, + aiebu_assembler_buffer_type_blob_control_packet, + aiebu_assembler_buffer_type_asm_aie2ps +}; + +struct pm_ctrlpkt { + uint32_t pm_id; + const char* pm_buffer; + size_t pm_buffer_size; +}; + +/* + * This API takes buffer type, 2 buffers, their sizes and external_buffer_id json + * it also allocate elf_buf and It fill elf content in it. + * return, on success return return elf size, else posix error(negative). + * User may pass any combination like + * 1. type as aiebu_assembler_buffer_type_blob_instr_transaction, buffer1 as instruction buffer + * and buffer2 as control_packet: in this case it will package buffers in text and data + * section of elf respectively. + * 2. type as aiebu_assembler_buffer_type_blob_instr_transaction, buffer1 as instruction buffer + * and buffer2 as null: in this case it will package buffer in text section. + * 3. type as aiebu_assembler_buffer_type_asm_aie2ps, buffer1 as asm buffer and buffer2 + * as null: in this case it will assemble the asm code and package in elf. + * + * @type buffer type + * @instr_buf first buffer + * @instr_buf_size first buffer size + * @control_buf second buffer + * @control_buf_size second buffer size + * @elf_buf elf buffer + * @patch_json external_buffer_id_json buffer. + * @patch_json_size patch_json array size + * @libs libs to be included, ";" separated. + * @libpaths paths to search for libs, ";" separated. + * @ctrlpkt array of pm_ctrlpkt holding pm buffer and id + * @ctrlpkt_size size of ctrlpkt array + */ +DRIVER_DLLESPEC +int +aiebu_assembler_get_elf(enum aiebu_assembler_buffer_type type, + const char* buffer1, + size_t buffer1_size, + const char* buffer2, + size_t buffer2_size, + void** elf_buf, + const char* patch_json, + size_t patch_json_size, + const char* libs, + const char* libpaths, + struct pm_ctrlpkt* pm_ctrlpkts, + size_t pm_ctrlpkt_size); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/cpp/include/aiebu/aiebu_assembler.h b/src/cpp/include/aiebu/aiebu_assembler.h new file mode 100644 index 0000000..5c94752 --- /dev/null +++ b/src/cpp/include/aiebu/aiebu_assembler.h @@ -0,0 +1,119 @@ +// SPDX-License-Identifier: MIT +// Copyright (C) 2024, Advanced Micro Devices, Inc. All rights reserved. + +#ifndef _AIEBU_ASSEMBLER_H_ +#define _AIEBU_ASSEMBLER_H_ + +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) +#define DRIVER_DLLESPEC __declspec(dllexport) +#else +#define DRIVER_DLLESPEC __attribute__((visibility("default"))) +#endif + +namespace aiebu { + +// Assembler Class + +class aiebu_assembler { + std::vector elf_data; + + public: + + enum class buffer_type { + blob_instr_dpu, + blob_instr_prepost, + blob_instr_transaction, + blob_control_packet, + asm_aie2ps, + asm_aie2 + }; + + private: + const buffer_type _type; + + public: + /* + * Constructor takes buffer type , 2 buffer and a vector of symbols with + * external_buffer_id json as argument. + * its throws aiebu::error object. + * User may pass any combination like + * 1. type as blob_instr_transaction, buffer1 as instruction buffer + * and buffer2 as control_packet and pm_ctrlpkt as map of + * : in this case it will package buffers in text section, data section and + * ctrlpkt_pm_N section of elf respectively. + * 2. type as blob_instr_transaction, buffer1 as instruction buffer + * and buffer2 as empty and and pm_ctrlpkt as map of + * : in this case it will package buffer in text section and ctrlpkt_pm_N section of elf respectively. + * 3. type as asm_aie2ps, buffer1 as asm buffer and buffer2 + * as empty: in this case it will assemble the asm code and package in elf. + * + * @type buffer type + * @instr_buf first buffer + * @constrol_buf second buffer + * @patch_json external_buffer_id json + * @libs libs to include in elf + * @libpaths paths to search for libs + * @ctrlpkt map of pm id and pm control packet buffer + */ + DRIVER_DLLESPEC + aiebu_assembler(buffer_type type, + const std::vector& buffer1, + const std::vector& buffer2, + const std::vector& patch_json, + const std::vector& libs = {}, + const std::vector& libpaths = {}, + const std::map >& pm_ctrlpkt = {}); + + /* + * Constructor takes buffer type, buffer, + * and a vector of symbols with their patching information as argument. + * its throws aiebu::error object. + * + * @type buffer type + * @instr_buf first buffer + * @libs libs to include in elf + * @libpaths paths to search for libs + * @patch_json external_buffer_id json + */ + DRIVER_DLLESPEC + aiebu_assembler(buffer_type type, + const std::vector& buffer, + const std::vector& libs = {}, + const std::vector& libpaths = {}, + const std::vector& patch_json = {}); + + /* + * This function return vector with elf content. + * + * Inside elf for IPU, instr_buf will be placed in .text section and control_buf will + * be placed in .data section. There are other dynamic sections in the elf + * containing the relocatable information. With this elf, at runtime, XRT + * will patch the symbols (value or address based on the schema) into their + * instruction buffer and control buffer before sending the buffer to device. + * + * return: vector of char with elf content + */ + [[nodiscard]] + DRIVER_DLLESPEC + std::vector + get_elf() const; + + void + DRIVER_DLLESPEC + get_report(std::ostream &stream) const; + + void + DRIVER_DLLESPEC + disassemble(const std::filesystem::path &root) const; +}; + +} //namespace aiebu + +#endif // _AIEBU_ASSEMBLER_H_ diff --git a/src/cpp/include/aiebu/aiebu_error.h b/src/cpp/include/aiebu/aiebu_error.h new file mode 100644 index 0000000..c220679 --- /dev/null +++ b/src/cpp/include/aiebu/aiebu_error.h @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: MIT +// Copyright (C) 2024, Advanced Micro Devices, Inc. All rights reserved. + +#ifndef _AIEBU_ERROR_H_ +#define _AIEBU_ERROR_H_ + +#include +#include "aiebu.h" + +#if defined(_WIN32) +#define DRIVER_DLLESPEC __declspec(dllexport) +#else +#define DRIVER_DLLESPEC __attribute__((visibility("default"))) +#endif + +namespace aiebu { + +class error : public std::system_error +{ +public: + + enum class DRIVER_DLLESPEC error_code : int + { + invalid_asm = aiebu_invalid_asm, + invalid_patch_schema = aiebu_invalid_patch_schema, + invalid_patch_buffer_type = aiebu_invalid_batch_buffer_type, + invalid_buffer_type = aiebu_invalid_buffer_type, + invalid_offset = aiebu_invalid_offset, + internal_error = aiebu_invalid_internal_error + }; + + DRIVER_DLLESPEC + error(error_code ec, const std::error_category& cat, const std::string& what = ""); + + explicit + DRIVER_DLLESPEC + error(error_code ec, const std::string& what = ""); + + // Retrive underlying code for return plain error code + [[nodiscard]] + DRIVER_DLLESPEC + int + value() const; + + [[nodiscard]] + DRIVER_DLLESPEC + int + get() const; + + [[nodiscard]] + DRIVER_DLLESPEC + int + get_code() const; +}; + +} + +#endif //_AIEBU_ERROR_H_ diff --git a/src/cpp/aiebu/src/ops/oparg.h b/src/cpp/ops/oparg.h similarity index 100% rename from src/cpp/aiebu/src/ops/oparg.h rename to src/cpp/ops/oparg.h diff --git a/src/cpp/aiebu/src/ops/ops.cpp b/src/cpp/ops/ops.cpp similarity index 100% rename from src/cpp/aiebu/src/ops/ops.cpp rename to src/cpp/ops/ops.cpp diff --git a/src/cpp/aiebu/src/ops/ops.h b/src/cpp/ops/ops.h similarity index 100% rename from src/cpp/aiebu/src/ops/ops.h rename to src/cpp/ops/ops.h diff --git a/src/cpp/aiebu/src/preprocessor/aie2/aie2_asm_preprocessor.h b/src/cpp/preprocessor/aie2/aie2_asm_preprocessor.h similarity index 100% rename from src/cpp/aiebu/src/preprocessor/aie2/aie2_asm_preprocessor.h rename to src/cpp/preprocessor/aie2/aie2_asm_preprocessor.h diff --git a/src/cpp/aiebu/src/preprocessor/aie2/aie2_asm_preprocessor_input.cpp b/src/cpp/preprocessor/aie2/aie2_asm_preprocessor_input.cpp similarity index 100% rename from src/cpp/aiebu/src/preprocessor/aie2/aie2_asm_preprocessor_input.cpp rename to src/cpp/preprocessor/aie2/aie2_asm_preprocessor_input.cpp diff --git a/src/cpp/aiebu/src/preprocessor/aie2/aie2_blob_preprocessed_output.h b/src/cpp/preprocessor/aie2/aie2_blob_preprocessed_output.h similarity index 100% rename from src/cpp/aiebu/src/preprocessor/aie2/aie2_blob_preprocessed_output.h rename to src/cpp/preprocessor/aie2/aie2_blob_preprocessed_output.h diff --git a/src/cpp/aiebu/src/preprocessor/aie2/aie2_blob_preprocessor.h b/src/cpp/preprocessor/aie2/aie2_blob_preprocessor.h similarity index 100% rename from src/cpp/aiebu/src/preprocessor/aie2/aie2_blob_preprocessor.h rename to src/cpp/preprocessor/aie2/aie2_blob_preprocessor.h diff --git a/src/cpp/aiebu/src/preprocessor/aie2/aie2_blob_preprocessor_input.cpp b/src/cpp/preprocessor/aie2/aie2_blob_preprocessor_input.cpp similarity index 100% rename from src/cpp/aiebu/src/preprocessor/aie2/aie2_blob_preprocessor_input.cpp rename to src/cpp/preprocessor/aie2/aie2_blob_preprocessor_input.cpp diff --git a/src/cpp/aiebu/src/preprocessor/aie2/aie2_blob_preprocessor_input.h b/src/cpp/preprocessor/aie2/aie2_blob_preprocessor_input.h similarity index 100% rename from src/cpp/aiebu/src/preprocessor/aie2/aie2_blob_preprocessor_input.h rename to src/cpp/preprocessor/aie2/aie2_blob_preprocessor_input.h diff --git a/src/cpp/aiebu/src/preprocessor/aie2ps/aie2ps_preprocessed_output.h b/src/cpp/preprocessor/aie2ps/aie2ps_preprocessed_output.h similarity index 100% rename from src/cpp/aiebu/src/preprocessor/aie2ps/aie2ps_preprocessed_output.h rename to src/cpp/preprocessor/aie2ps/aie2ps_preprocessed_output.h diff --git a/src/cpp/aiebu/src/preprocessor/aie2ps/aie2ps_preprocessor.h b/src/cpp/preprocessor/aie2ps/aie2ps_preprocessor.h similarity index 100% rename from src/cpp/aiebu/src/preprocessor/aie2ps/aie2ps_preprocessor.h rename to src/cpp/preprocessor/aie2ps/aie2ps_preprocessor.h diff --git a/src/cpp/aiebu/src/preprocessor/aie2ps/aie2ps_preprocessor_input.cpp b/src/cpp/preprocessor/aie2ps/aie2ps_preprocessor_input.cpp similarity index 100% rename from src/cpp/aiebu/src/preprocessor/aie2ps/aie2ps_preprocessor_input.cpp rename to src/cpp/preprocessor/aie2ps/aie2ps_preprocessor_input.cpp diff --git a/src/cpp/aiebu/src/preprocessor/aie2ps/aie2ps_preprocessor_input.h b/src/cpp/preprocessor/aie2ps/aie2ps_preprocessor_input.h similarity index 100% rename from src/cpp/aiebu/src/preprocessor/aie2ps/aie2ps_preprocessor_input.h rename to src/cpp/preprocessor/aie2ps/aie2ps_preprocessor_input.h diff --git a/src/cpp/aiebu/src/preprocessor/asm/asm_parser.cpp b/src/cpp/preprocessor/asm/asm_parser.cpp similarity index 100% rename from src/cpp/aiebu/src/preprocessor/asm/asm_parser.cpp rename to src/cpp/preprocessor/asm/asm_parser.cpp diff --git a/src/cpp/aiebu/src/preprocessor/asm/asm_parser.h b/src/cpp/preprocessor/asm/asm_parser.h similarity index 100% rename from src/cpp/aiebu/src/preprocessor/asm/asm_parser.h rename to src/cpp/preprocessor/asm/asm_parser.h diff --git a/src/cpp/aiebu/src/preprocessor/asm/page.h b/src/cpp/preprocessor/asm/page.h similarity index 100% rename from src/cpp/aiebu/src/preprocessor/asm/page.h rename to src/cpp/preprocessor/asm/page.h diff --git a/src/cpp/aiebu/src/preprocessor/asm/pager.cpp b/src/cpp/preprocessor/asm/pager.cpp similarity index 100% rename from src/cpp/aiebu/src/preprocessor/asm/pager.cpp rename to src/cpp/preprocessor/asm/pager.cpp diff --git a/src/cpp/aiebu/src/preprocessor/asm/pager.h b/src/cpp/preprocessor/asm/pager.h similarity index 100% rename from src/cpp/aiebu/src/preprocessor/asm/pager.h rename to src/cpp/preprocessor/asm/pager.h diff --git a/src/cpp/aiebu/src/preprocessor/preprocessed_output.h b/src/cpp/preprocessor/preprocessed_output.h similarity index 100% rename from src/cpp/aiebu/src/preprocessor/preprocessed_output.h rename to src/cpp/preprocessor/preprocessed_output.h diff --git a/src/cpp/aiebu/src/preprocessor/preprocessor.h b/src/cpp/preprocessor/preprocessor.h similarity index 100% rename from src/cpp/aiebu/src/preprocessor/preprocessor.h rename to src/cpp/preprocessor/preprocessor.h diff --git a/src/cpp/aiebu/src/preprocessor/preprocessor_input.h b/src/cpp/preprocessor/preprocessor_input.h similarity index 100% rename from src/cpp/aiebu/src/preprocessor/preprocessor_input.h rename to src/cpp/preprocessor/preprocessor_input.h diff --git a/src/cpp/aiebu/utils/CMakeLists.txt b/src/cpp/utils/CMakeLists.txt similarity index 100% rename from src/cpp/aiebu/utils/CMakeLists.txt rename to src/cpp/utils/CMakeLists.txt diff --git a/src/cpp/aiebu/utils/asm/CMakeLists.txt b/src/cpp/utils/asm/CMakeLists.txt similarity index 84% rename from src/cpp/aiebu/utils/asm/CMakeLists.txt rename to src/cpp/utils/asm/CMakeLists.txt index 1793639..d905065 100644 --- a/src/cpp/aiebu/utils/asm/CMakeLists.txt +++ b/src/cpp/utils/asm/CMakeLists.txt @@ -2,19 +2,19 @@ # Copyright (C) 2024-2025 Advanced Micro Devices, Inc. All rights reserved. add_library(aiebu_asm_objects OBJECT asm.cpp - ${AIEBU_SOURCE_DIR}/src/cpp/aiebu/utils/target/target.cpp + ${AIEBU_SOURCE_DIR}/src/cpp/utils/target/target.cpp ) target_include_directories(aiebu_asm_objects PRIVATE - ${AIEBU_SOURCE_DIR}/src/cpp/aiebu/src + ${AIEBU_SOURCE_DIR}/src/cpp ${Boost_INCLUDE_DIRS} # these should be spelled out in source code - ${AIEBU_SOURCE_DIR}/src/cpp/aiebu/src/include - ${AIEBU_SOURCE_DIR}/src/cpp/aiebu/src/assembler - ${AIEBU_SOURCE_DIR}/src/cpp/aiebu/src/common - ${AIEBU_SOURCE_DIR}/src/cpp/aiebu/utils/target + ${AIEBU_SOURCE_DIR}/src/cpp/include/aiebu + ${AIEBU_SOURCE_DIR}/src/cpp/assembler + ${AIEBU_SOURCE_DIR}/src/cpp/common + ${AIEBU_SOURCE_DIR}/src/cpp/utils/target ${AIEBU_SOURCE_DIR}/src/cpp/cxxopts/include ) diff --git a/src/cpp/aiebu/utils/asm/asm.cpp b/src/cpp/utils/asm/asm.cpp similarity index 100% rename from src/cpp/aiebu/utils/asm/asm.cpp rename to src/cpp/utils/asm/asm.cpp diff --git a/src/cpp/aiebu/utils/target/target.cpp b/src/cpp/utils/target/target.cpp similarity index 100% rename from src/cpp/aiebu/utils/target/target.cpp rename to src/cpp/utils/target/target.cpp diff --git a/src/cpp/aiebu/utils/target/target.h b/src/cpp/utils/target/target.h similarity index 100% rename from src/cpp/aiebu/utils/target/target.h rename to src/cpp/utils/target/target.h