35 lines · plain
1// Test that dist_schedule gets correctly translated with the correct schedule type and chunk size where appropriate2 3// RUN: mlir-translate -mlir-to-llvmir -split-input-file %s | FileCheck %s4 5llvm.func @distribute_dist_schedule_chunk_size(%lb : i32, %ub : i32, %step : i32, %x : i32) {6 // CHECK: call void @[[RUNTIME_FUNC:__kmpc_for_static_init_4u]](ptr @1, i32 %omp_global_thread_num, i32 91, ptr %p.lastiter, ptr %p.lowerbound, ptr %p.upperbound, ptr %p.stride, i32 1, i32 1024)7 // We want to make sure that the next call is not another init builder.8 // CHECK-NOT: call void @[[RUNTIME_FUNC]]9 %1 = llvm.mlir.constant(1024: i32) : i3210 omp.distribute dist_schedule_static dist_schedule_chunk_size(%1 : i32) {11 omp.loop_nest (%iv) : i32 = (%lb) to (%ub) step (%step) {12 omp.yield13 }14 }15 llvm.return16}17 18// When a chunk size is present, we need to make sure the correct parallel accesses metadata is added19// CHECK: !2 = !{!"llvm.loop.parallel_accesses", !3}20// CHECK-NEXT: !3 = distinct !{}21 22// -----23 24llvm.func @distribute_dist_schedule(%lb : i32, %ub : i32, %step : i32, %x : i32) {25 // CHECK: call void @[[RUNTIME_FUNC:__kmpc_for_static_init_4u]](ptr @1, i32 %omp_global_thread_num, i32 92, ptr %p.lastiter, ptr %p.lowerbound, ptr %p.upperbound, ptr %p.stride, i32 1, i32 0)26 // We want to make sure that the next call is not another init builder.27 // CHECK-NOT: call void @[[RUNTIME_FUNC]]28 omp.distribute dist_schedule_static {29 omp.loop_nest (%iv) : i32 = (%lb) to (%ub) step (%step) {30 omp.yield31 }32 }33 llvm.return34}35