Skip to content

Commit

Permalink
Added clang-tidy testing
Browse files Browse the repository at this point in the history
  • Loading branch information
coldav committed Jul 18, 2023
1 parent a3f2889 commit c0f9916
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 45 deletions.
127 changes: 83 additions & 44 deletions .github/workflows/run_pr_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,62 +12,90 @@ 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:

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
Expand All @@ -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

4 changes: 3 additions & 1 deletion modules/compiler/utils/source/pass_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<llvm::AllocaInst>(inst)) {
Expand Down

0 comments on commit c0f9916

Please sign in to comment.