[Mlir-commits] [mlir] b6910fd - [MLIR][AVX512] Add integration test for vp2intersect

Matthias Springer llvmlistbot at llvm.org
Mon Feb 8 23:44:17 PST 2021


Author: Matthias Springer
Date: 2021-02-09T16:43:37+09:00
New Revision: b6910fd31d85b9f60504e0a83c184226ead8c169

URL: https://github.com/llvm/llvm-project/commit/b6910fd31d85b9f60504e0a83c184226ead8c169
DIFF: https://github.com/llvm/llvm-project/commit/b6910fd31d85b9f60504e0a83c184226ead8c169.diff

LOG: [MLIR][AVX512] Add integration test for vp2intersect

Differential Revision: https://reviews.llvm.org/D96306

Added: 
    mlir/integration_test/Dialect/Vector/CPU/AVX512/lit.local.cfg
    mlir/integration_test/Dialect/Vector/CPU/AVX512/test-vp2intersect-i32.mlir

Modified: 
    mlir/CMakeLists.txt
    mlir/integration_test/CMakeLists.txt
    mlir/integration_test/lit.site.cfg.py.in

Removed: 
    


################################################################################
diff  --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index 5d21312bccc3..91ad37f77f52 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -141,6 +141,9 @@ if (MLIR_INCLUDE_TESTS)
   add_subdirectory(test)
 endif()
 if (MLIR_INCLUDE_INTEGRATION_TESTS)
+  set(INTEL_SDE_EXECUTABLE "" CACHE STRING
+      "If set, arch-specific integration tests are run with Intel SDE.")
+  option(MLIR_RUN_AVX512_TESTS "Run AVX512 tests.")
   add_definitions(-DMLIR_INCLUDE_INTEGRATION_TESTS)
   add_subdirectory(integration_test)
 endif()

diff  --git a/mlir/integration_test/CMakeLists.txt b/mlir/integration_test/CMakeLists.txt
index fb2be5256dcc..81f7c8e7b2c6 100644
--- a/mlir/integration_test/CMakeLists.txt
+++ b/mlir/integration_test/CMakeLists.txt
@@ -3,6 +3,7 @@ set(MLIR_INTEGRATION_TEST_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
 
 set(MLIR_INTEGRATION_TEST_DEPENDS
   FileCheck count not
+  lli
   mlir-cpu-runner
   mlir-opt
   mlir_runner_utils

diff  --git a/mlir/integration_test/Dialect/Vector/CPU/AVX512/lit.local.cfg b/mlir/integration_test/Dialect/Vector/CPU/AVX512/lit.local.cfg
new file mode 100644
index 000000000000..6e6803e231fb
--- /dev/null
+++ b/mlir/integration_test/Dialect/Vector/CPU/AVX512/lit.local.cfg
@@ -0,0 +1,15 @@
+import sys
+
+# AVX512 tests must be enabled via build flag.
+if config.mlir_run_avx512_tests != 'ON':
+    config.unsupported = True
+
+# No JIT on win32.
+if sys.platform == 'win32':
+    config.unsupported = True
+
+if config.intel_sde_executable:
+    # Run test in emulator (Intel SDE).
+    config.substitutions.append(('%lli', config.intel_sde_executable + ' -tgl -- lli'))
+else:
+    config.substitutions.append(('%lli', 'lli'))

diff  --git a/mlir/integration_test/Dialect/Vector/CPU/AVX512/test-vp2intersect-i32.mlir b/mlir/integration_test/Dialect/Vector/CPU/AVX512/test-vp2intersect-i32.mlir
new file mode 100644
index 000000000000..d29789a28067
--- /dev/null
+++ b/mlir/integration_test/Dialect/Vector/CPU/AVX512/test-vp2intersect-i32.mlir
@@ -0,0 +1,52 @@
+// RUN: mlir-opt %s -convert-scf-to-std -convert-vector-to-llvm="enable-avx512" -convert-std-to-llvm  | \
+// RUN: mlir-translate  --avx512-mlir-to-llvmir | \
+// RUN: %lli --entry-function=entry --mattr="avx512bw,avx512vp2intersect" --dlopen=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
+// RUN: FileCheck %s
+
+// Note: To run this test, your CPU must support AVX512 vp2intersect.
+
+func @entry() -> i32 {
+  %i0 = constant 0 : i32
+  %i1 = constant 1: i32
+  %i2 = constant 2: i32
+  %i3 = constant 7: i32
+  %i4 = constant 12: i32
+  %i5 = constant -10: i32
+  %i6 = constant -219: i32
+
+  %v0 = vector.broadcast %i1 : i32 to vector<16xi32>
+  %v1 = vector.insert %i2, %v0[1] : i32 into vector<16xi32>
+  %v2 = vector.insert %i3, %v1[4] : i32 into vector<16xi32>
+  %v3 = vector.insert %i4, %v2[6] : i32 into vector<16xi32>
+  %v4 = vector.insert %i5, %v3[7] : i32 into vector<16xi32>
+  %v5 = vector.insert %i0, %v4[10] : i32 into vector<16xi32>
+  %v6 = vector.insert %i0, %v5[12] : i32 into vector<16xi32>
+  %v7 = vector.insert %i3, %v6[13] : i32 into vector<16xi32>
+  %v8 = vector.insert %i3, %v7[14] : i32 into vector<16xi32>
+  %v9 = vector.insert %i0, %v8[15] : i32 into vector<16xi32>
+  vector.print %v9 : vector<16xi32>
+  // CHECK: ( 1, 2, 1, 1, 7, 1, 12, -10, 1, 1, 0, 1, 0, 7, 7, 0 )
+
+  %w0 = vector.broadcast %i1 : i32 to vector<16xi32>
+  %w1 = vector.insert %i2, %w0[4] : i32 into vector<16xi32>
+  %w2 = vector.insert %i6, %w1[7] : i32 into vector<16xi32>
+  %w3 = vector.insert %i4, %w2[8] : i32 into vector<16xi32>
+  %w4 = vector.insert %i4, %w3[9] : i32 into vector<16xi32>
+  %w5 = vector.insert %i4, %w4[10] : i32 into vector<16xi32>
+  %w6 = vector.insert %i0, %w5[11] : i32 into vector<16xi32>
+  %w7 = vector.insert %i0, %w6[12] : i32 into vector<16xi32>
+  %w8 = vector.insert %i0, %w7[13] : i32 into vector<16xi32>
+  %w9 = vector.insert %i0, %w8[15] : i32 into vector<16xi32>
+  vector.print %w9 : vector<16xi32>
+  // CHECK: ( 1, 1, 1, 1, 2, 1, 1, -219, 12, 12, 12, 0, 0, 0, 1, 0 )
+
+  %k1, %k2 = avx512.vp2intersect %v9, %w9 : vector<16xi32>
+
+  vector.print %k1 : vector<16xi1>
+  // CHECK: ( 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1 )
+
+  vector.print %k2 : vector<16xi1>
+  // CHECK: ( 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1 )
+
+  return %i0 : i32
+}

diff  --git a/mlir/integration_test/lit.site.cfg.py.in b/mlir/integration_test/lit.site.cfg.py.in
index bd0ccf4cce24..6d2a7170482f 100644
--- a/mlir/integration_test/lit.site.cfg.py.in
+++ b/mlir/integration_test/lit.site.cfg.py.in
@@ -33,6 +33,8 @@ config.mlir_src_root = "@MLIR_SOURCE_DIR@"
 config.mlir_obj_root = "@MLIR_BINARY_DIR@"
 config.mlir_tools_dir = "@MLIR_TOOLS_DIR@"
 config.mlir_integration_test_dir = "@MLIR_INTEGRATION_TEST_DIR@"
+config.intel_sde_executable = "@INTEL_SDE_EXECUTABLE@"
+config.mlir_run_avx512_tests = "@MLIR_RUN_AVX512_TESTS@"
 
 # Support substitution of the tools_dir with user parameters. This is
 # used when we can't determine the tool dir at configuration time.


        


More information about the Mlir-commits mailing list