[mlir] Add vector op support to cuda-runner including vector.print

Differential Revision: https://reviews.llvm.org/D97346
This commit is contained in:
thomasraoux
2021-03-18 12:59:49 -07:00
parent 0c208d1f42
commit 1a572f4509
2 changed files with 7 additions and 0 deletions

View File

@@ -18,6 +18,7 @@
#include "../PassDetail.h"
#include "mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h"
#include "mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h"
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
#include "mlir/Dialect/Async/IR/Async.h"
#include "mlir/Dialect/GPU/GPUDialect.h"
#include "mlir/Dialect/GPU/Passes.h"
@@ -313,6 +314,7 @@ void GpuToLLVMConversionPass::runOnOperation() {
OwningRewritePatternList patterns;
LLVMConversionTarget target(getContext());
populateVectorToLLVMConversionPatterns(converter, patterns);
populateStdToLLVMConversionPatterns(converter, patterns);
populateAsyncStructuralTypeConversionsAndLegality(&getContext(), converter,
patterns, target);

View File

@@ -21,7 +21,10 @@ func @other_func(%arg0 : f32, %arg1 : memref<?xf32>) {
}
// CHECK: [1, 1, 1, 1, 1]
// CHECK: ( 1, 1 )
func @main() {
%v0 = constant 0.0 : f32
%c0 = constant 0: index
%arg0 = memref.alloc() : memref<5xf32>
%21 = constant 5 : i32
%22 = memref.cast %arg0 : memref<5xf32> to memref<?xf32>
@@ -31,6 +34,8 @@ func @main() {
%24 = constant 1.0 : f32
call @other_func(%24, %22) : (f32, memref<?xf32>) -> ()
call @print_memref_f32(%23) : (memref<*xf32>) -> ()
%val1 = vector.transfer_read %arg0[%c0], %v0: memref<5xf32>, vector<2xf32>
vector.print %val1: vector<2xf32>
return
}