Repository navigation
Open
Labels
Description
Test:
func.func @test() -> () {
%input = util.unfoldable_constant dense<[-1.0]> : tensor<1xf32>
%result_empty = tensor.empty() : tensor<1xf32>
%result = linalg.generic {indexing_maps = [
affine_map<(d0) -> (d0)>,
affine_map<(d0) -> (d0)>
], iterator_types = ["parallel"]}
ins(%input : tensor<1xf32>) outs(%result_empty : tensor<1xf32>) {
^bb0(%in: f32, %out: f32):
%x = math.log10 %in : f32
%y = math.trunc %x : f32
linalg.yield %y : f32
} -> tensor<1xf32>
check.expect_almost_eq_const(%result, dense<[0.5]> : tensor<1xf32>) : tensor<1xf32>
return
}Repro:
tools/iree-compile --iree-hal-target-device=llvm-cpu --iree-llvmcpu-target-cpu=generic ~/a.mlir -o ~/a.vmfb
Result:
// -----// IR Dump Before SCFToControlFlowPass (convert-scf-to-cf) //----- //
util.func private @_test() {
%c1 = arith.constant 1 : index
%c-1_i32 = arith.constant -1 : i32
%c0_i64 = arith.constant 0 : i64
%0 = util.null : !hal.fence
%c-1_i64 = arith.constant -1 : i64
%c0 = arith.constant 0 : index
%c128 = arith.constant 128 : index
%c64 = arith.constant 64 : index
%c-1082130432_i32 = arith.constant -1082130432 : i32
%c4 = arith.constant 4 : index
%__device_0 = util.global.load immutable @__device_0 : !hal.device
%fence = hal.fence.create device(%__device_0 : !hal.device) flags("None") : !hal.fence
%transient_buffer = hal.device.queue.alloca<%__device_0 : !hal.device> affinity(%c-1_i64) wait(%0) signal(%fence) pool(%c0_i64) type("DeviceVisible|DeviceLocal") usage("TransferSource|TransferTarget|Transfer|DispatchStorageRead|DispatchStorageWrite|DispatchStorage") : !hal.buffer{%c4}
%fence_0 = hal.fence.create device(%__device_0 : !hal.device) flags("None") : !hal.fence
hal.device.queue.fill<%__device_0 : !hal.device> affinity(%c-1_i64) wait(%fence) signal(%fence_0) target(%transient_buffer : !hal.buffer)[%c0] length(%c4) pattern(%c-1082130432_i32 : i32) flags(0)
%status = hal.fence.await until([%fence_0]) timeout_millis(%c-1_i32) : i32
util.status.check_ok %status, "failed to wait on timepoint"
%1 = util.optimization_barrier %transient_buffer : !hal.buffer
%fence_1 = hal.fence.create device(%__device_0 : !hal.device) flags("None") : !hal.fence
%transient_buffer_2 = hal.device.queue.alloca<%__device_0 : !hal.device> affinity(%c-1_i64) wait(%0) signal(%fence_1) pool(%c0_i64) type("DeviceVisible|DeviceLocal") usage("TransferSource|TransferTarget|Transfer|DispatchStorageRead|DispatchStorageWrite|DispatchStorage") : !hal.buffer{%c128}
%2 = util.call @___test_memoize_lookup(%__device_0, %c-1_i64) : (!hal.device, i64) -> !hal.command_buffer
%fence_3 = hal.fence.create device(%__device_0 : !hal.device) flags("None") : !hal.fence
hal.device.queue.execute.indirect<%__device_0 : !hal.device> affinity(%c-1_i64) wait(%fence_1) signal(%fence_3) commands(%2) bindings([
(%1 : !hal.buffer)[%c0, %c4],
(%transient_buffer_2 : !hal.buffer)[%c0, %c128]
])
%status_4 = hal.fence.await until([%fence_3]) timeout_millis(%c-1_i32) : i32
util.status.check_ok %status_4, "failed to wait on timepoint"
%dense_row_major = hal.encoding_type<dense_row_major> : i32
%element_type_f32 = hal.element_type<f32> : i32
%view = hal.buffer_view.create buffer(%transient_buffer_2 : !hal.buffer)[%c64, %c4] shape([%c1]) type(%element_type_f32) encoding(%dense_row_major) : !hal.buffer_view
%view_5 = hal.buffer_view.create buffer(%transient_buffer_2 : !hal.buffer)[%c0, %c4] shape([%c1]) type(%element_type_f32) encoding(%dense_row_major) : !hal.buffer_view
check.expect_almost_eq<%__device_0>(%view_5, %view) : !hal.buffer_view
util.return
}
iree-lld: error: undefined symbol: log10f
>>> referenced by a.mlir:10
>>> /tmp/_test_dispatch_0-e950d6.o:(_test_dispatch_0_elementwise)
iree-lld: error: undefined symbol: truncf
>>> referenced by a.mlir:11
>>> /tmp/_test_dispatch_0-e950d6.o:(_test_dispatch_0_elementwise)
Linking failed; escaped command line returned exit code 256:
Activity
E2E tests for math ops. (#20169)
[AMDGPU] Test more math ops on ROCm: `erfc`, `log10`, `trunc` (#20225)
E2E tests for math ops. (#20169)
[AMDGPU] Test more math ops on ROCm: `erfc`, `log10`, `trunc` (#20225)