diff --git a/.github/workflows/ur-source-checks.yml b/.github/workflows/ur-source-checks.yml index b35a047773325..ebf6985ab1a21 100644 --- a/.github/workflows/ur-source-checks.yml +++ b/.github/workflows/ur-source-checks.yml @@ -43,20 +43,8 @@ jobs: Expand-Archive -Path "$WorkingDir\doxygen.zip" Add-Content $env:GITHUB_PATH "$WorkingDir\doxygen" - - name: "[Lin] Install hwloc" - working-directory: ${{github.workspace}}/unified-runtime - if: matrix.os == 'ubuntu-22.04' - run: .github/scripts/install_hwloc.sh - - - name: "[Win] Install hwloc" - working-directory: ${{github.workspace}}/unified-runtime - if: matrix.os == 'windows-2022' - run: vcpkg install hwloc:x64-windows - - name: Configure Unified Runtime project working-directory: ${{github.workspace}}/unified-runtime - env: - VCPKG_PATH: "C:/vcpkg/packages/hwloc_x64-windows" run: > cmake -B${{github.workspace}}/build @@ -65,6 +53,7 @@ jobs: -DCMAKE_BUILD_TYPE=Debug -DUR_BUILD_TESTS=OFF -DUR_FORMAT_CPP_STYLE=ON + -DUMF_DISABLE_HWLOC=ON # Verifying license should be enough on a single OS - name: Verify that each source file contains a license diff --git a/unified-runtime/CMakeLists.txt b/unified-runtime/CMakeLists.txt index 9d802a713581f..720f1f8fd38db 100644 --- a/unified-runtime/CMakeLists.txt +++ b/unified-runtime/CMakeLists.txt @@ -384,7 +384,10 @@ if(UR_FORMAT_CPP_STYLE) --api-json ${API_JSON_FILE} --clang-format=${CLANG_FORMAT} $<$:--fast-mode> - COMMAND ${Python3_EXECUTABLE} json2src.py --api-json ${API_JSON_FILE} ${PROJECT_SOURCE_DIR} + COMMAND ${Python3_EXECUTABLE} json2src.py + --api-json ${API_JSON_FILE} + --clang-format=${CLANG_FORMAT} + ${PROJECT_SOURCE_DIR} ) # Generate and format source from the specification @@ -397,7 +400,7 @@ if(UR_FORMAT_CPP_STYLE) add_custom_target(check-generated WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND git diff --exit-code - DEPENDS generate + DEPENDS generate-code ) else() message(STATUS " UR_FORMAT_CPP_STYLE not set. Targets: 'generate' and 'check-generated' are not available") diff --git a/unified-runtime/include/ur_api_funcs.def b/unified-runtime/include/ur_api_funcs.def index 8c25dde67f466..e0420779629dd 100644 --- a/unified-runtime/include/ur_api_funcs.def +++ b/unified-runtime/include/ur_api_funcs.def @@ -15,7 +15,7 @@ * */ - // Auto-generated file, do not edit. +// Auto-generated file, do not edit. _UR_API(urPlatformGet) _UR_API(urPlatformGetInfo) diff --git a/unified-runtime/scripts/json2src.py b/unified-runtime/scripts/json2src.py index f5f7698baba1d..056cedd8f389c 100755 --- a/unified-runtime/scripts/json2src.py +++ b/unified-runtime/scripts/json2src.py @@ -59,6 +59,13 @@ def add_argument(parser, name, help, default=False): default=sys.stdin, help="JSON file containing the API specification, by default read from stdin", ) + parser.add_argument( + "--clang-format", + type=str, + default="clang-format", + required=False, + help="path to clang-format executable", + ) parser.add_argument("out_dir", type=str, help="Root of the loader repository.") args = parser.parse_args() @@ -154,6 +161,7 @@ def add_argument(parser, name, help, default=False): input["meta"], ) + util.formatGeneratedFiles(args.clang_format) if args.debug: util.makoFileListWrite("generated.json") diff --git a/unified-runtime/scripts/run.py b/unified-runtime/scripts/run.py index c81dcac24fda0..5345d8a8ebb13 100755 --- a/unified-runtime/scripts/run.py +++ b/unified-runtime/scripts/run.py @@ -232,17 +232,6 @@ def main(): input["meta"], ) - # clang-format ur_api.h - proc = subprocess.run( - [args["clang_format"], "--style=file", "-i", "ur_api.h"], - stderr=subprocess.PIPE, - cwd=incpath, - ) - if proc.returncode != 0: - print("-- clang-format failed with non-zero return code. --") - print(proc.stderr.decode()) - raise Exception("Failed to format ur_api.h") - if args["rst"]: generate_docs.generate_rst( docpath, @@ -272,6 +261,8 @@ def main(): print("\nBuild failed, stopping execution!") return + util.formatGeneratedFiles(args["clang_format"]) + # phase 5: prep for publication of html or pdf if args["html"] or args["pdf"]: generate_docs.generate_common( diff --git a/unified-runtime/scripts/util.py b/unified-runtime/scripts/util.py index 0d8b5bb53ffcb..7f60cf95279e3 100644 --- a/unified-runtime/scripts/util.py +++ b/unified-runtime/scripts/util.py @@ -14,6 +14,7 @@ import glob import json import yaml +import subprocess from mako.template import Template from mako import exceptions @@ -210,6 +211,21 @@ def makoFileListWrite(outpath): jsonWrite(outpath, makoFileList) +def formatGeneratedFiles(clang_format): + for file in makoFileList: + if re.search(r"(\.h|\.hpp|\.c|\.cpp|\.def)$", file) is None: + continue + print("Formatting {}".format(file)) + proc = subprocess.run( + [clang_format, "--style=file", "-i", file], + stderr=subprocess.PIPE, + ) + if proc.returncode != 0: + print("-- clang-format failed with non-zero return code. --") + print(proc.stderr.decode()) + raise Exception("Failed to format {}".format(file)) + + def makeErrorCount(): return len(makoErrorList) diff --git a/unified-runtime/source/common/stype_map_helpers.def b/unified-runtime/source/common/stype_map_helpers.def index ec2856e60d513..89fcb1ae96688 100644 --- a/unified-runtime/source/common/stype_map_helpers.def +++ b/unified-runtime/source/common/stype_map_helpers.def @@ -1,104 +1,158 @@ -// This file is autogenerated from the template at templates/stype_map_helpers.hpp.mako +// This file is autogenerated from the template at +// templates/stype_map_helpers.hpp.mako template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> struct stype_map : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl< + UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC> {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl< + UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG_DESC> {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl< + UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_POINTER_ARG_DESC> {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl< + UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC> {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl {}; template <> -struct stype_map : stype_map_impl {}; +struct stype_map + : stype_map_impl { +}; template <> -struct stype_map : stype_map_impl {}; - +struct stype_map + : stype_map_impl {};