Skip to content

Commit

Permalink
Add config option and test for mlir-miopen-driver.
Browse files Browse the repository at this point in the history
-DMLIR_MIOPEN_DRIVER=1
  • Loading branch information
whchung committed Jun 6, 2020
1 parent 2fc0e87 commit 8159cb5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mlir/CMakeLists.txt
Expand Up @@ -44,6 +44,9 @@ set(MLIR_CUDA_RUNNER_ENABLED 0 CACHE BOOL "Enable building the mlir CUDA runner"
set(MLIR_ROCM_RUNNER_ENABLED 0 CACHE BOOL "Enable building the mlir ROCm runner")
set(MLIR_VULKAN_RUNNER_ENABLED 0 CACHE BOOL "Enable building the mlir Vulkan runner")

# MIOpen dialect.
set(MLIR_MIOPEN_DRIVER_ENABLED 0 CACHE BOOL "Enable build MIOpen driver")

option(MLIR_INCLUDE_TESTS
"Generate build targets for the MLIR unit tests."
${LLVM_INCLUDE_TESTS})
Expand Down
10 changes: 10 additions & 0 deletions mlir/test/CMakeLists.txt
Expand Up @@ -77,6 +77,16 @@ if(MLIR_VULKAN_RUNNER_ENABLED)
)
endif()

# MIOpen dialect tools.
if(MLIR_MIOPEN_DRIVER_ENABLED)
list(APPEND MLIR_TEST_DEPENDS
mlir-miopen-driver
mlir-translate
opt
llc
)
endif()

add_lit_testsuite(check-mlir "Running the MLIR regression tests"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${MLIR_TEST_DEPENDS}
Expand Down
2 changes: 2 additions & 0 deletions mlir/test/Dialect/MIOpen/Driver/lit.local.cfg
@@ -0,0 +1,2 @@
if not config.enable_miopen_driver:
config.unsupported = True
5 changes: 5 additions & 0 deletions mlir/test/Dialect/MIOpen/Driver/populate.mlir
@@ -0,0 +1,5 @@
// RUN: mlir-miopen-driver -p | FileCheck %s

// CHECK-LABEL: module
// CHECK-NEXT: func @miopen_conv2d_kcyx_nchw_nkhw({{.*}}: memref<128x8x3x3xf32>, {{.*}}: memref<128x8x32x32xf32>, {{.*}}: memref<128x128x30x30xf32>)
// CHECK-NEXT: miopen.conv2d({{.*}}, {{.*}}, {{.*}}) {dilations = [1 : i32, 1 : i32], filter_layout = ["k", "c", "y", "x"], input_layout = ["ni", "ci", "hi", "wi"], output_layout = ["no", "ko", "ho", "wo"], padding = [0 : i32, 0 : i32], strides = [1 : i32, 1 : i32]} : memref<128x8x3x3xf32>, memref<128x8x32x32xf32>, memref<128x128x30x30xf32>
1 change: 1 addition & 0 deletions mlir/test/lit.site.cfg.py.in
Expand Up @@ -41,6 +41,7 @@ config.enable_cuda_runner = @MLIR_CUDA_RUNNER_ENABLED@
config.run_rocm_tests = @MLIR_ROCM_CONVERSIONS_ENABLED@
config.rocm_wrapper_library_dir = "@MLIR_ROCM_WRAPPER_LIBRARY_DIR@"
config.enable_rocm_runner = @MLIR_ROCM_RUNNER_ENABLED@
config.enable_miopen_driver = @MLIR_MIOPEN_DRIVER_ENABLED@
config.vulkan_wrapper_library_dir = "@MLIR_VULKAN_WRAPPER_LIBRARY_DIR@"
config.enable_vulkan_runner = @MLIR_VULKAN_RUNNER_ENABLED@

Expand Down

0 comments on commit 8159cb5

Please sign in to comment.