With VectorType supporting scalable dimensions, we don't need many of
the operations currently present in ArmSVE, like mask generation and
basic arithmetic instructions. Therefore, this patch also gets
rid of those.
Having built-in scalable vector support also simplifies the lowering of
scalable vector dialects down to LLVMIR.
Scalable dimensions are indicated with the scalable dimensions
between square brackets:
vector<[4]xf32>
Is a scalable vector of 4 single precission floating point elements.
More generally, a VectorType can have a set of fixed-length dimensions
followed by a set of scalable dimensions:
vector<2x[4x4]xf32>
Is a vector with 2 scalable 4x4 vectors of single precission floating
point elements.
The scale of the scalable dimensions can be obtained with the Vector
operation:
%vs = vector.vscale
This change is being discussed in the discourse RFC:
https://llvm.discourse.group/t/rfc-add-built-in-support-for-scalable-vector-types/4484
Differential Revision: https://reviews.llvm.org/D111819
37 lines
1.5 KiB
MLIR
37 lines
1.5 KiB
MLIR
// RUN: mlir-opt %s -allow-unregistered-dialect | mlir-opt -allow-unregistered-dialect
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// UnrealizedConversionCastOp
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
%operand = "foo.op"() : () -> !foo.type
|
|
%tuple_operand = "foo.op"() : () -> !foo.tuple_type<!foo.type, !foo.type>
|
|
|
|
// An unrealized 0-1 conversion.
|
|
%result = unrealized_conversion_cast to !bar.tuple_type<>
|
|
|
|
// An unrealized 1-1 conversion.
|
|
%result1 = unrealized_conversion_cast %operand : !foo.type to !bar.lowered_type
|
|
|
|
// An unrealized 1-N conversion.
|
|
%results2:2 = unrealized_conversion_cast %tuple_operand : !foo.tuple_type<!foo.type, !foo.type> to !foo.type, !foo.type
|
|
|
|
// An unrealized N-1 conversion.
|
|
%result3 = unrealized_conversion_cast %operand, %operand : !foo.type, !foo.type to !bar.tuple_type<!foo.type, !foo.type>
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// VectorType
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// A basic 1D scalable vector
|
|
%scalable_vector_1d = "foo.op"() : () -> vector<[4]xi32>
|
|
|
|
// A 2D scalable vector
|
|
%scalable_vector_2d = "foo.op"() : () -> vector<[2x2]xf64>
|
|
|
|
// A 2D scalable vector with fixed-length dimensions
|
|
%scalable_vector_2d_mixed = "foo.op"() : () -> vector<2x[4]xbf16>
|
|
|
|
// A multi-dimensional vector with mixed scalable and fixed-length dimensions
|
|
%scalable_vector_multi_mixed = "foo.op"() : () -> vector<2x2x[4x4]xi8>
|