Summary: This CL introduces an integration test directory for MLIR in general, with vector dialect integration tests in particular as a first working suite. To run all the integration tests (and currently just the vector suite): $ cmake --build . --target check-mlir-integration [0/1] Running the MLIR integration tests Testing Time: 0.24s Passed: 22 The general call is to contribute to this integration test directory with more tests and other suites, running end-to-end examples that may be too heavy for the regular test directory, but should be tested occasionally to verify the health of MLIR. Background discussion at: https://llvm.discourse.group/t/vectorops-rfc-add-suite-of-integration-tests-for-vector-dialect-operations/1213/ Reviewers: nicolasvasilache, reidtatge, andydavis1, rriddle, ftynse, mehdi_amini, jpienaar, stephenneuendorffer Reviewed By: nicolasvasilache, stephenneuendorffer Subscribers: mgorny, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, msifontes Tags: #mlir Differential Revision: https://reviews.llvm.org/D81626
33 lines
1.3 KiB
MLIR
33 lines
1.3 KiB
MLIR
// RUN: mlir-opt %s -convert-scf-to-std -convert-vector-to-llvm -convert-std-to-llvm | \
|
|
// RUN: mlir-cpu-runner -e entry -entry-point-result=void \
|
|
// RUN: -shared-libs=%mlir_integration_test_dir/libmlir_c_runner_utils%shlibext | \
|
|
// RUN: FileCheck %s
|
|
|
|
func @entry() {
|
|
%f0 = constant 0.0: f32
|
|
%f1 = constant 1.0: f32
|
|
%f2 = constant 2.0: f32
|
|
%f3 = constant 3.0: f32
|
|
%f4 = constant 4.0: f32
|
|
%v1 = vector.broadcast %f1 : f32 to vector<8xf32>
|
|
%v2 = vector.broadcast %f2 : f32 to vector<8xf32>
|
|
%v3 = vector.broadcast %f3 : f32 to vector<8xf32>
|
|
%v4 = vector.broadcast %f4 : f32 to vector<8xf32>
|
|
|
|
%a0 = vector.broadcast %f0 : f32 to vector<4x4x8xf32>
|
|
%a1 = vector.insert %v1, %a0[1, 1] : vector<8xf32> into vector<4x4x8xf32>
|
|
%a2 = vector.insert %v2, %a1[1, 2] : vector<8xf32> into vector<4x4x8xf32>
|
|
%a3 = vector.insert %v3, %a2[2, 1] : vector<8xf32> into vector<4x4x8xf32>
|
|
%a4 = vector.insert %v4, %a3[2, 2] : vector<8xf32> into vector<4x4x8xf32>
|
|
|
|
%ss = vector.extract_strided_slice %a4 {offsets = [1, 1], sizes = [2, 2], strides = [1, 1]} : vector<4x4x8xf32> to vector<2x2x8xf32>
|
|
|
|
vector.print %ss : vector<2x2x8xf32>
|
|
//
|
|
// extract strided slice:
|
|
//
|
|
// CHECK: ( ( ( 1, 1, 1, 1, 1, 1, 1, 1 ), ( 2, 2, 2, 2, 2, 2, 2, 2 ) ), ( ( 3, 3, 3, 3, 3, 3, 3, 3 ), ( 4, 4, 4, 4, 4, 4, 4, 4 ) ) )
|
|
|
|
return
|
|
}
|