Skip to content

Commit f98b757

Browse files
authored
Some code cleanup (#164)
1 parent bec5c29 commit f98b757

File tree

10 files changed

+31
-29
lines changed

10 files changed

+31
-29
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ endif()
7676

7777
add_subdirectory(mlir)
7878
add_subdirectory(dpcomp_runtime)
79+
add_subdirectory(tools)
7980

8081
if(NUMBA_ENABLE)
81-
add_subdirectory(tools)
8282
add_subdirectory(numba_dpcomp)
8383
endif()
8484

dpcomp_gpu_runtime/lib/kernel_api_stubs.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
#include <cstdint>
1616
#include <cstdio>
1717
#include <cstdlib>
18-
#include <mutex>
19-
#include <numeric>
2018

2119
#include "dpcomp-gpu-runtime_export.h"
2220

dpcomp_runtime/CMakeLists.txt

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,13 @@ endif()
2222

2323
find_package(MLIR REQUIRED CONFIG)
2424

25-
if(TBB_ENABLE)
26-
set(SOURCES_LIST
27-
lib/context.cpp
28-
lib/tbb_parallel.cpp
29-
lib/memory.cpp
30-
)
31-
set(HEADERS_LIST
32-
)
33-
else()
34-
set(SOURCES_LIST
35-
lib/memory.cpp
36-
)
37-
set(HEADERS_LIST
38-
)
39-
endif()
25+
set(SOURCES_LIST
26+
lib/context.cpp
27+
lib/tbb_parallel.cpp
28+
lib/memory.cpp
29+
)
30+
set(HEADERS_LIST
31+
)
4032

4133
add_library(${PROJECT_NAME} SHARED ${SOURCES_LIST} ${HEADERS_LIST})
4234
generate_export_header(${PROJECT_NAME})
@@ -46,6 +38,8 @@ target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE
4638
PRIVATE
4739
${PROJECT_BINARY_DIR}
4840
)
41+
4942
if(TBB_ENABLE)
43+
target_compile_definitions(${PROJECT_NAME} PRIVATE TBB_ENABLE=1)
5044
target_link_libraries(${PROJECT_NAME} TBB::tbb)
51-
endif()
45+
endif()

dpcomp_runtime/lib/tbb_parallel.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#ifdef TBB_ENABLE
16+
1517
#include <array>
1618
#include <cassert>
1719
#include <cstdio>
@@ -227,18 +229,18 @@ DPCOMP_RUNTIME_EXPORT void dpcompParallelFor(const InputRange *input_ranges,
227229
}
228230

229231
DPCOMP_RUNTIME_EXPORT void dpcompParallelInit(int numThreads) {
230-
if (DEBUG) {
232+
if (DEBUG)
231233
fprintf(stderr, "dpcomp_parallel_init %d\n", numThreads);
232-
}
233-
if (nullptr == globalContext) {
234+
235+
if (nullptr == globalContext)
234236
globalContext = std::make_unique<TBBContext>(numThreads);
235-
}
236237
}
237238

238239
DPCOMP_RUNTIME_EXPORT void dpcompParallelFinalize() {
239-
if (DEBUG) {
240+
if (DEBUG)
240241
fprintf(stderr, "dpcomp_parallel_finalize\n");
241-
}
242+
242243
globalContext.reset();
243244
}
244245
}
246+
#endif // TBB_ENABLE

mlir/include/mlir-extensions/Conversion/gpu_to_gpu_runtime.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "mlir-extensions/dialect/gpu_runtime/IR/gpu_runtime_ops.hpp"
1818

1919
#include "mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.h"
20+
#include <llvm/ADT/SmallBitVector.h>
2021
#include <mlir/Analysis/BufferViewFlowAnalysis.h>
2122
#include <mlir/Conversion/AffineToStandard/AffineToStandard.h>
2223
#include <mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h>
@@ -46,8 +47,6 @@
4647
#include <mlir/Transforms/DialectConversion.h>
4748
#include <mlir/Transforms/GreedyPatternRewriteDriver.h>
4849
#include <mlir/Transforms/Passes.h>
49-
#include <llvm/ADT/SmallBitVector.h>
50-
5150

5251
namespace gpu_runtime {
5352

mlir/lib/dialect/gpu_runtime/IR/gpu_runtime_ops.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,4 +285,3 @@ mlir::StringAttr GPUSuggestBlockSizeOp::getKernelName() {
285285

286286
#define GET_OP_CLASSES
287287
#include "mlir-extensions/dialect/gpu_runtime/IR/GpuRuntimeOps.cpp.inc"
288-

test/Conversion/LowerToLevelZero/addf.mlir

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// REQUIRES: run-gpu-tests
12
// RUN: mlir-vulkan-runner %s --shared-libs=%vulkan_wrapper_library_dir/libvulkan-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s
23

34
// CHECK: [3.3, 3.3, 3.3, 3.3, 3.3, 3.3, 3.3, 3.3]

test/Conversion/LowerToLevelZero/linalg_addf.mlir

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// XFAIL: *
2+
// RUN:
3+
14
#map = affine_map<(d0, d1) -> (d0, d1)>
25
module {
36
func @addt(%arg0: tensor<2x5xf32>, %arg1: tensor<2x5xf32>) -> tensor<2x5xf32> {

test/Conversion/LowerToLevelZero/linalg_test.mlir

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// XFAIL: *
2+
// RUN:
3+
14
#map0 = affine_map<() -> ()>
25
#map1 = affine_map<(d0) -> ()>
36
#map2 = affine_map<(d0) -> (d0)>

test/lit.cfg.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
3838
# subdirectories contain auxiliary inputs for various tests in their parent
3939
# directories.
40-
config.excludes = ['runlit.py', 'lit.cfg.py', 'CMakeLists.txt', 'addf.mlir', 'linalg_addf.mlir', 'linalg_test.mlir']
40+
config.excludes = ['runlit.py', 'lit.cfg.py', 'CMakeLists.txt']
4141

4242
# test_source_root: The root path where tests are located.
4343
config.test_source_root = os.path.dirname(__file__)
@@ -56,4 +56,7 @@
5656
'dpcomp-opt',
5757
]
5858

59+
if os.environ.get('RUN_LIT_GPU_TESTS', None):
60+
config.available_features.add('run-gpu-tests')
61+
5962
llvm_config.add_tool_substitutions(tools, tool_dirs)

0 commit comments

Comments
 (0)