Forking off device methods from TargetBackend->TargetDevice. (#16591)
This is the start of changes allowing us to reason about devices
independently from the backend used to generate code for them. For now
the TargetDevice is fairly coupled to the TargetBackend it was forked
from but in the future the intent is to split them further such that the
TargetDevice is shared across multiple backends (to start the CPU ->
VMVX/LLVM-CPU backends).
When asked to provide a set of default or host executable targets each
plugin implementing a TargetBackend now receives the device it's
generating for. This allows for example a Metal device specifying
runtime device properties (Metal version, etc) to have the Metal SPIRV
target backend produce executables compatible with it. TargetDevice
being separate allows us to provide those independently in plugins or in
the main IREE compiler (like where the CPUTargetDevice will live). This
will make composition possible such as multiple plugins contributing
translation pipelines for a single device to allow for specialization.
Future PRs will start to deprecate the `--iree-hal-target-backends=`
flag in favor of specifying devices instead and then allowing each
device to have its own default backends specified if the user wants
global flags (`--iree-hal-cpu-target-backends=llvm-cpu,vmvx`, etc). For
now it's going to remain and there's a link back from backends to
devices for automatic selection.
diff --git a/samples/transform_dialect/example_module.mlir b/samples/transform_dialect/example_module.mlir
index 22f2927..9ea0f78 100644
--- a/samples/transform_dialect/example_module.mlir
+++ b/samples/transform_dialect/example_module.mlir
@@ -30,14 +30,14 @@
module attributes {
hal.device.targets = [
#hal.device.target<"vulkan", [
- #hal.executable.target<"vulkan", "vulkan-spirv-fb", {
+ #hal.executable.target<"vulkan-spirv", "vulkan-spirv-fb", {
spirv.target_env = #target_env
}>
]>
]
} {
hal.executable private @example_module_dispatch_0 {
- hal.executable.variant public @vulkan_spirv_fb target(<"vulkan", "vulkan-spirv-fb", {spirv.target_env = #target_env}>) {
+ hal.executable.variant public @vulkan_spirv_fb target(<"vulkan-spirv", "vulkan-spirv-fb", {spirv.target_env = #target_env}>) {
hal.executable.export public @example_module_dispatch_0_generic_80_f32 ordinal(0) layout(
#hal.pipeline.layout<push_constants = 0, sets = [<0, bindings = [<0, storage_buffer, ReadOnly>, <1, storage_buffer>]>]>) {
^bb0(%arg0: !hal.device):
@@ -63,7 +63,7 @@
}
}
hal.executable private @example_module_dispatch_1 {
- hal.executable.variant public @vulkan_spirv_fb target(<"vulkan", "vulkan-spirv-fb", {spirv.target_env = #target_env}>) {
+ hal.executable.variant public @vulkan_spirv_fb target(<"vulkan-spirv", "vulkan-spirv-fb", {spirv.target_env = #target_env}>) {
hal.executable.export public @example_module_dispatch_1_matmul_16x16x5_f32 ordinal(0) layout(
#hal.pipeline.layout<push_constants = 0, sets = [<0, bindings = [<0, storage_buffer, ReadOnly>, <1, storage_buffer, ReadOnly>, <2, storage_buffer>]>]>) {
^bb0(%arg0: !hal.device):
@@ -87,7 +87,7 @@
}
}
hal.executable private @example_module_dispatch_2 {
- hal.executable.variant public @vulkan_spirv_fb target(<"vulkan", "vulkan-spirv-fb", {spirv.target_env = #target_env}>) {
+ hal.executable.variant public @vulkan_spirv_fb target(<"vulkan-spirv", "vulkan-spirv-fb", {spirv.target_env = #target_env}>) {
hal.executable.export public @example_module_dispatch_2_generic_16x16_f32 ordinal(0) layout(
#hal.pipeline.layout<push_constants = 0, sets = [<0, bindings = [<0, storage_buffer, ReadOnly>, <1, storage_buffer>]>]>) {
^bb0(%arg0: !hal.device):