Ben Vanik | d5a9b1b | 2023-03-06 12:06:27 -0800 | [diff] [blame] | 1 | // RUN: iree-compile --compile-to=input %s | FileCheck %s --check-prefix=INPUT-PHASE |
Ben Vanik | 045bca1 | 2024-02-15 15:53:12 -0800 | [diff] [blame] | 2 | // INPUT-PHASE: util.func public @abs(%[[ARG0:.+]]: tensor<f32>) |
Ben Vanik | 7efcd0a | 2022-11-29 09:21:01 -0800 | [diff] [blame] | 3 | // INPUT-PHASE: math.absf %[[ARG0]] : tensor<f32> |
| 4 | |
Ben Vanik | d5a9b1b | 2023-03-06 12:06:27 -0800 | [diff] [blame] | 5 | // RUN: iree-compile --compile-to=abi %s | FileCheck %s --check-prefix=ABI-PHASE |
Ben Vanik | 045bca1 | 2024-02-15 15:53:12 -0800 | [diff] [blame] | 6 | // ABI-PHASE: util.func public @abs(%[[ARG0:.+]]: !hal.buffer_view) |
Ben Vanik | ac9d6d5 | 2023-12-03 20:20:31 -0800 | [diff] [blame] | 7 | // ABI-PHASE: %[[INPUT:.+]] = hal.tensor.import %[[ARG0]] "input0" : !hal.buffer_view -> tensor<f32> |
Ben Vanik | 7efcd0a | 2022-11-29 09:21:01 -0800 | [diff] [blame] | 8 | // ABI-PHASE: math.absf %[[INPUT]] : tensor<f32> |
| 9 | |
Ben Vanik | 866c0c0 | 2024-05-28 22:30:19 -0700 | [diff] [blame] | 10 | // RUN: iree-compile --compile-to=flow %s --iree-hal-target-device=local --iree-hal-local-target-device-backends=vmvx | FileCheck %s --check-prefix=FLOW-PHASE |
Ben Vanik | 7efcd0a | 2022-11-29 09:21:01 -0800 | [diff] [blame] | 11 | // FLOW-PHASE: flow.executable.export public @abs_dispatch_0 |
| 12 | // FLOW-PHASE: flow.dispatch @abs_dispatch_0 |
| 13 | |
Ben Vanik | 866c0c0 | 2024-05-28 22:30:19 -0700 | [diff] [blame] | 14 | // RUN: iree-compile --compile-to=flow %s | FileCheck %s --check-prefix=FLOW-PHASE-NO-DEVICE |
| 15 | // FLOW-PHASE-NO-DEVICE: flow.executable.export public @abs_dispatch_0 |
| 16 | // FLOW-PHASE-NO-DEVICE: flow.dispatch @abs_dispatch_0 |
| 17 | |
| 18 | // RUN: iree-compile --compile-to=stream --iree-hal-target-device=local --iree-hal-local-target-device-backends=vmvx %s | FileCheck %s --check-prefix=STREAM-PHASE |
Ben Vanik | 7efcd0a | 2022-11-29 09:21:01 -0800 | [diff] [blame] | 19 | // STREAM-PHASE: stream.executable.export public @abs_dispatch_0 |
| 20 | // STREAM-PHASE: stream.cmd.dispatch @abs_dispatch_0 |
| 21 | |
Ben Vanik | 866c0c0 | 2024-05-28 22:30:19 -0700 | [diff] [blame] | 22 | // RUN: iree-compile --compile-to=stream %s | FileCheck %s --check-prefix=STREAM-PHASE-NO-DEVICE |
| 23 | // STREAM-PHASE-NO-DEVICE: stream.executable.export public @abs_dispatch_0 |
| 24 | // STREAM-PHASE-NO-DEVICE: stream.cmd.dispatch @abs_dispatch_0 |
| 25 | |
| 26 | // RUN: iree-compile --compile-to=executable-sources --iree-hal-target-device=local --iree-hal-local-target-device-backends=vmvx %s | FileCheck %s --check-prefix=EXECUTABLE-SOURCES-PHASE |
Ben Vanik | d5a9b1b | 2023-03-06 12:06:27 -0800 | [diff] [blame] | 27 | // EXECUTABLE-SOURCES-PHASE: hal.executable private @abs_dispatch_0 |
| 28 | // EXECUTABLE-SOURCES-PHASE: hal.executable.variant |
| 29 | // EXECUTABLE-SOURCES-PHASE: linalg.generic |
| 30 | // EXECUTABLE-SOURCES-PHASE: math.absf |
| 31 | |
Ben Vanik | 866c0c0 | 2024-05-28 22:30:19 -0700 | [diff] [blame] | 32 | // RUN: iree-compile --compile-to=executable-targets --iree-hal-target-device=local --iree-hal-local-target-device-backends=vmvx %s | FileCheck %s --check-prefix=EXECUTABLE-TARGETS-PHASE |
Ben Vanik | d5a9b1b | 2023-03-06 12:06:27 -0800 | [diff] [blame] | 33 | // EXECUTABLE-TARGETS-PHASE: hal.executable private @abs_dispatch_0 |
| 34 | // EXECUTABLE-TARGETS-PHASE: hal.executable.variant |
| 35 | // EXECUTABLE-TARGETS-PHASE: vm.abs.f32 |
| 36 | |
Ben Vanik | 866c0c0 | 2024-05-28 22:30:19 -0700 | [diff] [blame] | 37 | // RUN: iree-compile --compile-to=hal --iree-hal-target-device=local --iree-hal-local-target-device-backends=vmvx %s | FileCheck %s --check-prefix=HAL-PHASE |
Ben Vanik | 7efcd0a | 2022-11-29 09:21:01 -0800 | [diff] [blame] | 38 | // HAL-PHASE: hal.executable private @abs_dispatch_0 |
| 39 | // HAL-PHASE: hal.executable.binary |
| 40 | // HAL-PHASE: hal.command_buffer.dispatch |
| 41 | |
Ben Vanik | 866c0c0 | 2024-05-28 22:30:19 -0700 | [diff] [blame] | 42 | // RUN: iree-compile --compile-to=vm --iree-hal-target-device=local --iree-hal-local-target-device-backends=vmvx %s | FileCheck %s --check-prefix=VM-PHASE |
Ben Vanik | 7efcd0a | 2022-11-29 09:21:01 -0800 | [diff] [blame] | 43 | // VM-PHASE: vm.rodata private @abs_dispatch_0 |
Ben Vanik | e2a2b2b | 2024-08-22 11:56:59 -0700 | [diff] [blame] | 44 | // VM-PHASE: vm.call.variadic @hal.command_buffer.dispatch |
Ben Vanik | 7efcd0a | 2022-11-29 09:21:01 -0800 | [diff] [blame] | 45 | |
Ben Vanik | 866c0c0 | 2024-05-28 22:30:19 -0700 | [diff] [blame] | 46 | // RUN: iree-compile --output-format=vm-asm --compile-to=end --iree-hal-target-device=local --iree-hal-local-target-device-backends=vmvx %s | FileCheck %s --check-prefix=END-PHASE |
| 47 | // RUN: iree-compile --output-format=vm-asm --iree-hal-target-device=local --iree-hal-local-target-device-backends=vmvx %s | FileCheck %s --check-prefix=END-PHASE |
Ben Vanik | 7efcd0a | 2022-11-29 09:21:01 -0800 | [diff] [blame] | 48 | // END-PHASE: vm.rodata private @abs_dispatch_0 |
Ben Vanik | e2a2b2b | 2024-08-22 11:56:59 -0700 | [diff] [blame] | 49 | // END-PHASE: vm.call.variadic @hal.command_buffer.dispatch |
Ben Vanik | 7efcd0a | 2022-11-29 09:21:01 -0800 | [diff] [blame] | 50 | |
| 51 | func.func @abs(%input : tensor<f32>) -> (tensor<f32>) { |
| 52 | %result = math.absf %input : tensor<f32> |
| 53 | return %result : tensor<f32> |
| 54 | } |