brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · 9f80cd8 Raw
46 lines · plain
1// RUN: mlir-opt %s -split-input-file -async-parallel-for=num-workers=-1  \2// RUN: | FileCheck %s --dump-input=always3 4// CHECK-LABEL: @num_worker_threads(5// CHECK:       %[[MEMREF:.*]]: memref<?xf32>6func.func @num_worker_threads(%arg0: memref<?xf32>) {7 8  // CHECK-DAG: %[[scalingCstInit:.*]] = arith.constant 8.000000e+00 : f329  // CHECK-DAG: %[[bracketLowerBound4:.*]] = arith.constant 4 : index10  // CHECK-DAG: %[[scalingCst4:.*]] = arith.constant 4.000000e+00 : f3211  // CHECK-DAG: %[[bracketLowerBound8:.*]] = arith.constant 8 : index12  // CHECK-DAG: %[[scalingCst8:.*]] = arith.constant 2.000000e+00 : f3213  // CHECK-DAG: %[[bracketLowerBound16:.*]] = arith.constant 16 : index14  // CHECK-DAG: %[[scalingCst16:.*]] = arith.constant 1.000000e+00 : f3215  // CHECK-DAG: %[[bracketLowerBound32:.*]] = arith.constant 32 : index16  // CHECK-DAG: %[[scalingCst32:.*]] = arith.constant 8.000000e-01 : f3217  // CHECK-DAG: %[[bracketLowerBound64:.*]] = arith.constant 64 : index18  // CHECK-DAG: %[[scalingCst64:.*]] = arith.constant 6.000000e-01 : f3219  // CHECK:     %[[workersIndex:.*]] = async.runtime.num_worker_threads : index20  // CHECK:     %[[inBracket4:.*]] = arith.cmpi sgt, %[[workersIndex]], %[[bracketLowerBound4]] : index21  // CHECK:     %[[scalingFactor4:.*]] = arith.select %[[inBracket4]], %[[scalingCst4]], %[[scalingCstInit]] : f3222  // CHECK:     %[[inBracket8:.*]] = arith.cmpi sgt, %[[workersIndex]], %[[bracketLowerBound8]] : index23  // CHECK:     %[[scalingFactor8:.*]] = arith.select %[[inBracket8]], %[[scalingCst8]], %[[scalingFactor4]] : f3224  // CHECK:     %[[inBracket16:.*]] = arith.cmpi sgt, %[[workersIndex]], %[[bracketLowerBound16]] : index25  // CHECK:     %[[scalingFactor16:.*]] = arith.select %[[inBracket16]], %[[scalingCst16]], %[[scalingFactor8]] : f3226  // CHECK:     %[[inBracket32:.*]] = arith.cmpi sgt, %[[workersIndex]], %[[bracketLowerBound32]] : index27  // CHECK:     %[[scalingFactor32:.*]] = arith.select %[[inBracket32]], %[[scalingCst32]], %[[scalingFactor16]] : f3228  // CHECK:     %[[inBracket64:.*]] = arith.cmpi sgt, %[[workersIndex]], %[[bracketLowerBound64]] : index29  // CHECK:     %[[scalingFactor64:.*]] = arith.select %[[inBracket64]], %[[scalingCst64]], %[[scalingFactor32]] : f3230  // CHECK:     %[[workersInt:.*]] = arith.index_cast %[[workersIndex]] : index to i3231  // CHECK:     %[[workersFloat:.*]] = arith.sitofp %[[workersInt]] : i32 to f3232  // CHECK:     %[[scaledFloat:.*]] = arith.mulf %[[scalingFactor64]], %[[workersFloat]] : f3233  // CHECK:     %[[scaledInt:.*]] = arith.fptosi %[[scaledFloat]] : f32 to i3234  // CHECK:     %[[scaledIndex:.*]] = arith.index_cast %[[scaledInt]] : i32 to index35 36  %lb = arith.constant 0 : index37  %ub = arith.constant 100 : index38  %st = arith.constant 1 : index39  scf.parallel (%i) = (%lb) to (%ub) step (%st) {40    %one = arith.constant 1.0 : f3241    memref.store %one, %arg0[%i] : memref<?xf32>42  }43 44  return45}46