2020-06-06 00:53:41 +08:00
|
|
|
// RUN: mlir-opt %s -convert-vector-to-rocdl | FileCheck %s
|
|
|
|
|
|
|
|
gpu.module @test_read{
|
|
|
|
func @transfer_readx2(%A : memref<?xf32>, %base: index) -> vector<2xf32> {
|
|
|
|
%f0 = constant 0.0: f32
|
|
|
|
%f = vector.transfer_read %A[%base], %f0
|
|
|
|
{permutation_map = affine_map<(d0) -> (d0)>} :
|
|
|
|
memref<?xf32>, vector<2xf32>
|
|
|
|
return %f: vector<2xf32>
|
|
|
|
}
|
|
|
|
// CHECK-LABEL: @transfer_readx2
|
[mlir] use built-in vector types instead of LLVM dialect types when possible
Continue the convergence between LLVM dialect and built-in types by using the
built-in vector type whenever possible, that is for fixed vectors of built-in
integers and built-in floats. LLVM dialect vector type is still in use for
pointers, less frequent floating point types that do not have a built-in
equivalent, and scalable vectors. However, the top-level `LLVMVectorType` class
has been removed in favor of free functions capable of inspecting both built-in
and LLVM dialect vector types: `LLVM::getVectorElementType`,
`LLVM::getNumVectorElements` and `LLVM::getFixedVectorType`. Additional work is
necessary to design an implemented the extensions to built-in types so as to
remove the `LLVMFixedVectorType` entirely.
Note that the default output format for the built-in vectors does not have
whitespace around the `x` separator, e.g., `vector<4xf32>` as opposed to the
LLVM dialect vector type format that does, e.g., `!llvm.vec<4 x fp128>`. This
required changing the FileCheck patterns in several tests.
Reviewed By: mehdi_amini, silvas
Differential Revision: https://reviews.llvm.org/D94405
2021-01-11 20:58:05 +08:00
|
|
|
// CHECK: rocdl.buffer.load {{.*}} vector<2xf32>
|
2020-06-06 00:53:41 +08:00
|
|
|
|
|
|
|
func @transfer_readx4(%A : memref<?xf32>, %base: index) -> vector<4xf32> {
|
|
|
|
%f0 = constant 0.0: f32
|
|
|
|
%f = vector.transfer_read %A[%base], %f0
|
|
|
|
{permutation_map = affine_map<(d0) -> (d0)>} :
|
|
|
|
memref<?xf32>, vector<4xf32>
|
|
|
|
return %f: vector<4xf32>
|
|
|
|
}
|
|
|
|
// CHECK-LABEL: @transfer_readx4
|
[mlir] use built-in vector types instead of LLVM dialect types when possible
Continue the convergence between LLVM dialect and built-in types by using the
built-in vector type whenever possible, that is for fixed vectors of built-in
integers and built-in floats. LLVM dialect vector type is still in use for
pointers, less frequent floating point types that do not have a built-in
equivalent, and scalable vectors. However, the top-level `LLVMVectorType` class
has been removed in favor of free functions capable of inspecting both built-in
and LLVM dialect vector types: `LLVM::getVectorElementType`,
`LLVM::getNumVectorElements` and `LLVM::getFixedVectorType`. Additional work is
necessary to design an implemented the extensions to built-in types so as to
remove the `LLVMFixedVectorType` entirely.
Note that the default output format for the built-in vectors does not have
whitespace around the `x` separator, e.g., `vector<4xf32>` as opposed to the
LLVM dialect vector type format that does, e.g., `!llvm.vec<4 x fp128>`. This
required changing the FileCheck patterns in several tests.
Reviewed By: mehdi_amini, silvas
Differential Revision: https://reviews.llvm.org/D94405
2021-01-11 20:58:05 +08:00
|
|
|
// CHECK: rocdl.buffer.load {{.*}} vector<4xf32>
|
2020-06-06 00:53:41 +08:00
|
|
|
|
|
|
|
func @transfer_read_dwordConfig(%A : memref<?xf32>, %base: index) -> vector<4xf32> {
|
|
|
|
%f0 = constant 0.0: f32
|
|
|
|
%f = vector.transfer_read %A[%base], %f0
|
|
|
|
{permutation_map = affine_map<(d0) -> (d0)>} :
|
|
|
|
memref<?xf32>, vector<4xf32>
|
|
|
|
return %f: vector<4xf32>
|
|
|
|
}
|
|
|
|
// CHECK-LABEL: @transfer_read_dwordConfig
|
|
|
|
// CHECK: %[[gep:.*]] = llvm.getelementptr {{.*}}
|
|
|
|
// CHECK: [0, 0, -1, 159744]
|
|
|
|
// CHECK: %[[i64:.*]] = llvm.ptrtoint %[[gep]]
|
|
|
|
// CHECK: llvm.insertelement %[[i64]]
|
|
|
|
}
|
|
|
|
|
|
|
|
gpu.module @test_write{
|
|
|
|
func @transfer_writex2(%A : memref<?xf32>, %B : vector<2xf32>, %base: index) {
|
|
|
|
vector.transfer_write %B, %A[%base]
|
|
|
|
{permutation_map = affine_map<(d0) -> (d0)>} :
|
|
|
|
vector<2xf32>, memref<?xf32>
|
|
|
|
return
|
|
|
|
}
|
|
|
|
// CHECK-LABEL: @transfer_writex2
|
[mlir] use built-in vector types instead of LLVM dialect types when possible
Continue the convergence between LLVM dialect and built-in types by using the
built-in vector type whenever possible, that is for fixed vectors of built-in
integers and built-in floats. LLVM dialect vector type is still in use for
pointers, less frequent floating point types that do not have a built-in
equivalent, and scalable vectors. However, the top-level `LLVMVectorType` class
has been removed in favor of free functions capable of inspecting both built-in
and LLVM dialect vector types: `LLVM::getVectorElementType`,
`LLVM::getNumVectorElements` and `LLVM::getFixedVectorType`. Additional work is
necessary to design an implemented the extensions to built-in types so as to
remove the `LLVMFixedVectorType` entirely.
Note that the default output format for the built-in vectors does not have
whitespace around the `x` separator, e.g., `vector<4xf32>` as opposed to the
LLVM dialect vector type format that does, e.g., `!llvm.vec<4 x fp128>`. This
required changing the FileCheck patterns in several tests.
Reviewed By: mehdi_amini, silvas
Differential Revision: https://reviews.llvm.org/D94405
2021-01-11 20:58:05 +08:00
|
|
|
// CHECK: rocdl.buffer.store {{.*}} vector<2xf32>
|
2020-06-06 00:53:41 +08:00
|
|
|
|
|
|
|
func @transfer_writex4(%A : memref<?xf32>, %B : vector<4xf32>, %base: index) {
|
|
|
|
vector.transfer_write %B, %A[%base]
|
|
|
|
{permutation_map = affine_map<(d0) -> (d0)>} :
|
|
|
|
vector<4xf32>, memref<?xf32>
|
|
|
|
return
|
|
|
|
}
|
|
|
|
// CHECK-LABEL: @transfer_writex4
|
[mlir] use built-in vector types instead of LLVM dialect types when possible
Continue the convergence between LLVM dialect and built-in types by using the
built-in vector type whenever possible, that is for fixed vectors of built-in
integers and built-in floats. LLVM dialect vector type is still in use for
pointers, less frequent floating point types that do not have a built-in
equivalent, and scalable vectors. However, the top-level `LLVMVectorType` class
has been removed in favor of free functions capable of inspecting both built-in
and LLVM dialect vector types: `LLVM::getVectorElementType`,
`LLVM::getNumVectorElements` and `LLVM::getFixedVectorType`. Additional work is
necessary to design an implemented the extensions to built-in types so as to
remove the `LLVMFixedVectorType` entirely.
Note that the default output format for the built-in vectors does not have
whitespace around the `x` separator, e.g., `vector<4xf32>` as opposed to the
LLVM dialect vector type format that does, e.g., `!llvm.vec<4 x fp128>`. This
required changing the FileCheck patterns in several tests.
Reviewed By: mehdi_amini, silvas
Differential Revision: https://reviews.llvm.org/D94405
2021-01-11 20:58:05 +08:00
|
|
|
// CHECK: rocdl.buffer.store {{.*}} vector<4xf32>
|
2020-06-06 00:53:41 +08:00
|
|
|
|
|
|
|
func @transfer_write_dwordConfig(%A : memref<?xf32>, %B : vector<2xf32>, %base: index) {
|
|
|
|
vector.transfer_write %B, %A[%base]
|
|
|
|
{permutation_map = affine_map<(d0) -> (d0)>} :
|
|
|
|
vector<2xf32>, memref<?xf32>
|
|
|
|
return
|
|
|
|
}
|
|
|
|
// CHECK-LABEL: @transfer_write_dwordConfig
|
|
|
|
// CHECK: %[[gep:.*]] = llvm.getelementptr {{.*}}
|
|
|
|
// CHECK: [0, 0, -1, 159744]
|
|
|
|
// CHECK: %[[i64:.*]] = llvm.ptrtoint %[[gep]]
|
|
|
|
// CHECK: llvm.insertelement %[[i64]]
|
|
|
|
}
|