2019-11-27 00:47:14 +08:00
|
|
|
// RUN: mlir-cuda-runner %s --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s
|
2019-10-17 01:43:12 +08:00
|
|
|
|
2019-11-22 03:16:02 +08:00
|
|
|
// CHECK: [{{(35, ){34}35}}]
|
2019-10-17 01:43:12 +08:00
|
|
|
func @main() {
|
|
|
|
%arg = alloc() : memref<35xf32>
|
|
|
|
%dst = memref_cast %arg : memref<35xf32> to memref<?xf32>
|
|
|
|
%one = constant 1 : index
|
2020-06-10 21:52:43 +08:00
|
|
|
%c0 = constant 0 : index
|
|
|
|
%sx = dim %dst, %c0 : memref<?xf32>
|
Unrank mcuMemHostRegister tensor argument.
Reviewers: herhut
Reviewed By: herhut
Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80118
2020-05-18 20:13:14 +08:00
|
|
|
%cast_dst = memref_cast %dst : memref<?xf32> to memref<*xf32>
|
|
|
|
call @mcuMemHostRegisterFloat(%cast_dst) : (memref<*xf32>) -> ()
|
2019-10-17 01:43:12 +08:00
|
|
|
gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %one, %grid_y = %one, %grid_z = %one)
|
2020-01-31 17:29:29 +08:00
|
|
|
threads(%tx, %ty, %tz) in (%block_x = %sx, %block_y = %one, %block_z = %one) {
|
2019-10-17 01:43:12 +08:00
|
|
|
%val = index_cast %tx : index to i32
|
|
|
|
%xor = "gpu.all_reduce"(%val) ({
|
|
|
|
^bb(%lhs : i32, %rhs : i32):
|
|
|
|
%xor = xor %lhs, %rhs : i32
|
|
|
|
"gpu.yield"(%xor) : (i32) -> ()
|
|
|
|
}) : (i32) -> (i32)
|
|
|
|
%res = sitofp %xor : i32 to f32
|
2020-01-31 17:29:29 +08:00
|
|
|
store %res, %dst[%tx] : memref<?xf32>
|
Add 'gpu.terminator' operation.
Summary:
The 'gpu.terminator' operation is used as the terminator for the
regions of gpu.launch. This is to disambugaute them from the
return operation on 'gpu.func' functions.
This is a breaking change and users of the gpu dialect will need
to adapt their code when producting 'gpu.launch' operations.
Reviewers: nicolasvasilache
Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, csigg, arpith-jacob, mgester, lucyrfox, liufengdb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73620
2020-01-29 20:59:36 +08:00
|
|
|
gpu.terminator
|
2019-10-17 01:43:12 +08:00
|
|
|
}
|
Unrank mcuMemHostRegister tensor argument.
Reviewers: herhut
Reviewed By: herhut
Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80118
2020-05-18 20:13:14 +08:00
|
|
|
call @print_memref_f32(%cast_dst) : (memref<*xf32>) -> ()
|
2019-10-17 01:43:12 +08:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
Unrank mcuMemHostRegister tensor argument.
Reviewers: herhut
Reviewed By: herhut
Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80118
2020-05-18 20:13:14 +08:00
|
|
|
func @mcuMemHostRegisterFloat(%ptr : memref<*xf32>)
|
2019-12-06 05:12:50 +08:00
|
|
|
func @print_memref_f32(memref<*xf32>)
|