Skip to content

Commit 221376e

Browse files
committed
Address remaining SYCL review comments
1 parent 88046f2 commit 221376e

21 files changed

Lines changed: 182 additions & 148 deletions

.github/workflows/static-analysis.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,18 @@ jobs:
2727
cmake --build build --parallel
2828
- name: Run clang-tidy
2929
run: |
30-
mapfile -t sources < <(find app src -path 'app/SYCL' -prune -o -name '*.cpp' -print)
31-
clang-tidy "${sources[@]}" -format-style=file -header-filter="($PWD/include/.*|$PWD/src/.*|$PWD/app/.*)" -p build
30+
python3 - <<'PY'
31+
import json
32+
from pathlib import Path
33+
34+
compile_commands = json.loads(Path("build/compile_commands.json").read_text())
35+
sources = sorted(
36+
{
37+
entry["file"]
38+
for entry in compile_commands
39+
if "/app/" in entry["file"] or "/src/" in entry["file"]
40+
}
41+
)
42+
Path("build/clang_tidy_sources.txt").write_text("\n".join(sources) + "\n")
43+
PY
44+
xargs -a build/clang_tidy_sources.txt clang-tidy -format-style=file -header-filter="($PWD/include/.*|$PWD/src/.*|$PWD/app/.*)" -p build

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ find_package(OpenMP REQUIRED COMPONENTS CXX)
4242

4343
if(OpenMP_FOUND)
4444
message(STATUS "OpenMP found - enabling parallel support")
45+
add_definitions(-DHAS_OPENMP)
4546
else()
4647
message(STATUS "OpenMP not found - parallel features disabled")
4748
endif()

include/graph/runtime_options.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#pragma once
2-
#include <stdint.h>
2+
#include <cstdint>
33

44
#include "parallel/parallel.hpp"
55

include/layers/ConcatLayer.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma once
2-
#include <stdint.h>
3-
2+
#include <cstdint>
43
#include <numeric>
54
#include <stdexcept>
65
#include <vector>

include/layers/InputLayer.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#pragma once
2-
#include <stdint.h>
3-
42
#include <algorithm>
53
#include <cmath>
4+
#include <cstdint>
65

76
#include "layers/Layer.hpp"
87

include/layers/ReduceLayer.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma once
2-
#include <stdint.h>
3-
2+
#include <cstdint>
43
#include <limits>
54
#include <vector>
65

include/layers/Tensor.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pragma once
22

3-
#include <stdint.h>
4-
3+
#include <cstdint>
54
#include <iostream>
65
#include <stdexcept>
76
#include <type_traits>

include/layers_oneDNN/ReduceLayer.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma once
2-
#include <stdint.h>
3-
2+
#include <cstdint>
43
#include <dnnl.hpp>
54
#include <memory>
65
#include <vector>

include/parallel/backends.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#pragma once
2-
// clang-format off
3-
#include <stdint.h>
42
#include <oneapi/tbb/blocked_range.h>
53
#include <oneapi/tbb/info.h>
64
#include <oneapi/tbb/parallel_for.h>
7-
// clang-format on
5+
6+
#include <cstdint>
87

98
// NOLINTNEXTLINE(misc-header-include-cycle)
109
#include <Kokkos_Core.hpp>
@@ -17,7 +16,7 @@
1716
namespace it_lab_ai {
1817
namespace parallel {
1918

20-
enum class Backend : uint8_t {
19+
enum class Backend : std::uint8_t {
2120
kSeq = 0,
2221
kThreads = 1,
2322
kTbb = 2,
@@ -94,7 +93,7 @@ inline void impl_tbb(std::size_t count,
9493
}, oneapi::tbb::auto_partitioner());
9594
}
9695

97-
#ifdef _OPENMP
96+
#ifdef HAS_OPENMP
9897
inline void impl_omp(std::size_t count,
9998
const std::function<void(std::size_t)>& func,
10099
const Options& opt) {

include/parallel/parallel.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace it_lab_ai {
55
namespace parallel {
66

77
constexpr bool kHasOmp =
8-
#ifdef _OPENMP
8+
#ifdef HAS_OPENMP
99
true;
1010
#else
1111
false;
@@ -16,7 +16,7 @@ inline Backend resolve_default_backend(std::size_t n, const Options& opt) {
1616
return Backend::kSeq;
1717
}
1818

19-
#ifdef _OPENMP
19+
#ifdef HAS_OPENMP
2020
return Backend::kOmp;
2121
#else
2222
return Backend::kTbb;

0 commit comments

Comments
 (0)