From c0f99169b14b2684876686023b3002916ebc627d Mon Sep 17 00:00:00 2001 From: Colin Davidson Date: Tue, 18 Jul 2023 09:17:04 +0100 Subject: [PATCH] Added clang-tidy testing --- .github/workflows/run_pr_tests.yml | 127 ++++++++++++------ .../compiler/utils/source/pass_functions.cpp | 4 +- 2 files changed, 86 insertions(+), 45 deletions(-) diff --git a/.github/workflows/run_pr_tests.yml b/.github/workflows/run_pr_tests.yml index 8c01025fd..fc8b46ee2 100644 --- a/.github/workflows/run_pr_tests.yml +++ b/.github/workflows/run_pr_tests.yml @@ -12,6 +12,7 @@ on: - 'hal/**' - '.github/actions/do_build_ock/**' - '.github/actions/setup_ubuntu_build/**' + - '.github/workflows/run_pr_tests.yml' # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -19,55 +20,82 @@ on: jobs: # build and run host x86_64, execute UnitCL and lit tests and build and run offline - run_host_x86_64: - runs-on: ubuntu-22.04 + # run_host_x86_64: + # runs-on: ubuntu-22.04 - steps: - - name: Checkout repo - uses: actions/checkout@v3 + # steps: + # - name: Checkout repo + # uses: actions/checkout@v3 - # installs tools, ninja, installs llvm and sets up sccahe - - name: setup-ubuntu - uses: ./.github/actions/setup_ubuntu_build - with: - llvm_version: 16 - llvm_build_type: RelAssert + # # installs tools, ninja, installs llvm and sets up sccahe + # - name: setup-ubuntu + # uses: ./.github/actions/setup_ubuntu_build + # with: + # llvm_version: 16 + # llvm_build_type: RelAssert - # These need to match the configurations of build_pr_cache to use the cache effectively - - name: build host x86_64 online release - uses: ./.github/actions/do_build_ock - with: - build_type: Release + # # These need to match the configurations of build_pr_cache to use the cache effectively + # - name: build host x86_64 online release + # uses: ./.github/actions/do_build_ock + # with: + # build_type: Release - - name: run just online lit - run: - ninja -C build check-all-lit + # - name: run just online lit + # run: + # ninja -C build check-all-lit - - name: run host online check - run: - ninja -C build check-UnitCL + # - name: run host online check + # run: + # ninja -C build check-UnitCL - # use the previous build for online to get clc - - name: build host x86_64 offline release - uses: ./.github/actions/do_build_ock - with: - build_type: Release - extra_flags: -DCA_RUNTIME_COMPILER_ENABLED=OFF -DCA_EXTERNAL_CLC=${{ github.workspace }}/build/bin/clc - build_dir: build_offline - build_targets: UnitCL - assemble_spirv_ll_lit_test_offline: ON + # # use the previous build for online to get clc + # - name: build host x86_64 offline release + # uses: ./.github/actions/do_build_ock + # with: + # build_type: Release + # extra_flags: -DCA_RUNTIME_COMPILER_ENABLED=OFF -DCA_EXTERNAL_CLC=${{ github.workspace }}/build/bin/clc + # build_dir: build_offline + # build_targets: UnitCL + # assemble_spirv_ll_lit_test_offline: ON - - name: run host x86_64 offline - run: - ninja -C build_offline check-UnitCL + # - name: run host x86_64 offline + # run: + # ninja -C build_offline check-UnitCL + + # # build and run riscv m1, execute UnitCL and lit tests + # run_riscv_m1: + + # runs-on: ubuntu-22.04 + + # steps: + # - name: Checkout repo + # uses: actions/checkout@v3 + + # # installs tools, ninja, installs llvm and sets up sccahe + # - name: setup-ubuntu + # uses: ./.github/actions/setup_ubuntu_build + # with: + # llvm_version: 16 + # llvm_build_type: RelAssert + + # - name: build riscv M1 + # uses: ./.github/actions/do_build_ock/do_build_m1 - # build and run riscv m1, execute UnitCL and lit tests - run_riscv_m1: + # - name: run riscv M1 lit + # run: + # ninja -C build check-all-lit + + # - name: run riscv M1 UnitCL tests + # run: + # ninja -C build check-UnitCL + + # build and run clang-tidy + run_clang_tidy_changes: runs-on: ubuntu-22.04 steps: - - name: Checkout repo + - name: Checkout repo uses: actions/checkout@v3 # installs tools, ninja, installs llvm and sets up sccahe @@ -77,13 +105,24 @@ jobs: llvm_version: 16 llvm_build_type: RelAssert - - name: build riscv M1 - uses: ./.github/actions/do_build_ock/do_build_m1 + # These need to match the configurations of build_pr_cache to use the cache effectively + - name: build host x86_64 online release + uses: ./.github/actions/do_build_ock + with: + build_type: ReleaseAssert + build_targets: build.ninja - - name: run riscv M1 lit + - name: build actual targets needed run: - ninja -C build check-all-lit + ninja -C build + $( + awk -F':' 'NR==FNR { targets[$1] = 1; next } $1 in targets { print $1 }' + <(ninja -C build -t targets) + <( + find modules source -type f -name CMakeLists.txt -exec + awk -F"[()]" '/add_dependencies\(tidy-/ {sub(/[^ ]*/, "", $2);print $2}' + {} \+ | tr ' ' '\n' + ) + ) - - name: run riscv M1 UnitCL tests - run: - ninja -C build check-UnitCL + \ No newline at end of file diff --git a/modules/compiler/utils/source/pass_functions.cpp b/modules/compiler/utils/source/pass_functions.cpp index b240d3a76..510ae4310 100644 --- a/modules/compiler/utils/source/pass_functions.cpp +++ b/modules/compiler/utils/source/pass_functions.cpp @@ -39,11 +39,13 @@ llvm::AnalysisKey compiler::utils::DeviceInfoAnalysis::Key; namespace compiler { namespace utils { +void some_func(int *unused) { +} uint64_t computeApproximatePrivateMemoryUsage(const llvm::Function &fn) { const llvm::Module *module = fn.getParent(); const auto &layout = module->getDataLayout(); uint64_t bytes = 0; - return 0; + // BarrierPass asserts that `allocas` only exist in the entry block for (auto &inst : fn.getEntryBlock()) { if (!llvm::isa(inst)) {