Renaming iree-run-mlir2 -> iree-run-mlir and making the other tool names consistent. PiperOrigin-RevId: 287589722
diff --git a/build_tools/cmake/iree_bytecode_module.cmake b/build_tools/cmake/iree_bytecode_module.cmake index 77476e9..88fa28c 100644 --- a/build_tools/cmake/iree_bytecode_module.cmake +++ b/build_tools/cmake/iree_bytecode_module.cmake
@@ -62,10 +62,10 @@ set(_ARGS "${_TRANSLATION}") list(APPEND _ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${_RULE_SRC}") list(APPEND _ARGS "-o") - list(APPEND _ARGS "${_RULE_NAME}.emod") + list(APPEND _ARGS "${_RULE_NAME}.module") add_custom_command( - OUTPUT "${_RULE_NAME}.emod" + OUTPUT "${_RULE_NAME}.module" COMMAND ${_TRANSLATION_TOOL_EXECUTABLE} ${_ARGS} DEPENDS ${_TRANSLATION_TOOL} ) @@ -81,7 +81,7 @@ IDENTIFIER "${_RULE_NAME}" GENERATED_SRCS - "${_RULE_NAME}.emod" + "${_RULE_NAME}.module" CC_FILE_OUTPUT "${_RULE_NAME}.cc" H_FILE_OUTPUT
diff --git a/docs/getting_started.md b/docs/getting_started.md index e530b24..7e709de 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md
@@ -88,18 +88,18 @@ -o /tmp/module.fb ``` -### run_module +### iree-run-module -The `run_module` program takes an already translated IREE module as input and -executes an exported main function using the provided inputs. +The `iree-run-module` program takes an already translated IREE module as input +and executes an exported main function using the provided inputs. This program can be used in sequence with `iree-translate` to translate a .mlir file to an IREE module and then execute it. Here is an example command that runs the `simple_mul` function in `simple_compute_test.mlir`. ```shell -$ bazel build -c opt //iree/tools:iree-translate //iree/tools:run_module -$ ./bazel-bin/iree/tools/run_module \ +$ bazel build -c opt //iree/tools:iree-translate //iree/tools:iree-run-module +$ ./bazel-bin/iree/tools/iree-run-module \ --main_module=/tmp/module.fb \ --main_function=simple_mul \ --input_values="4xf32=1 2 3 4
diff --git a/iree/schemas/BUILD b/iree/schemas/BUILD index 3d6255e..45c33af 100644 --- a/iree/schemas/BUILD +++ b/iree/schemas/BUILD
@@ -65,15 +65,6 @@ ], ) -# TODO(benvanik): also expose as C using flatcc. -iree_flatbuffer_cc_library( - name = "bytecode_module_def_cc_fbs", - srcs = ["bytecode_module_def.fbs"], - flatc_args = FLATC_ARGS, - includes = [ - ], -) - iree_flatbuffer_cc_library( name = "debug_service_cc_fbs", srcs = ["debug_service.fbs"], @@ -282,3 +273,12 @@ cpp_namespace = "iree::schemas", h_file_output = "reflection_data.h", ) + +# TODO(benvanik): also expose as C using flatcc. +iree_flatbuffer_cc_library( + name = "bytecode_module_def_cc_fbs", + srcs = ["bytecode_module_def.fbs"], + flatc_args = FLATC_ARGS, + includes = [ + ], +)
diff --git a/iree/schemas/bytecode_module_def.fbs b/iree/schemas/bytecode_module_def.fbs index bb8eceb..cfccbf7 100644 --- a/iree/schemas/bytecode_module_def.fbs +++ b/iree/schemas/bytecode_module_def.fbs
@@ -16,7 +16,7 @@ // 'Bytecode MODule'. file_identifier "BMOD"; -file_extension "bmod"; +file_extension "module"; // Arbitrary key/value reflection attribute. table ReflectionAttrDef {
diff --git a/iree/tools/BUILD b/iree/tools/BUILD index 04cfff7..b01e7b7 100644 --- a/iree/tools/BUILD +++ b/iree/tools/BUILD
@@ -32,6 +32,19 @@ "//iree/compiler/Dialect/HAL/Target/VulkanSPIRV", ] +cc_binary( + name = "iree-dump-module", + srcs = ["dump_module_main.cc"], + deps = [ + "//iree/base:file_io", # build-cleaner: keep + "//iree/base:flatbuffer_util", + "//iree/base:init", + "//iree/schemas", + "//iree/schemas:bytecode_module_def_cc_fbs", + "@com_github_google_flatbuffers//:flatbuffers", + ], +) + cc_library( name = "iree_opt_library", deps = [ @@ -77,37 +90,6 @@ deps = [ "@com_google_absl//absl/flags:flag", "@com_google_absl//absl/strings", - "//iree/base:source_location", - "//iree/rt", - "//iree/vm:sequencer_module", - "@llvm-project//llvm:support", - "@llvm-project//mlir:IR", - "@llvm-project//mlir:Parser", - "@llvm-project//mlir:Support", - "//iree/base:init", - "//iree/base:status", - "//iree/compiler/Translation/Sequencer", - "//iree/compiler/Translation/Interpreter", - "//iree/compiler/Translation/SPIRV", - "//iree/compiler/Translation:IREEVM", - "//iree/hal:buffer_view_string_util", - "//iree/hal:driver_registry", - "//iree/schemas", - "//iree/rt/debug:debug_server_flags", - ] + TARGET_COMPILER_BACKENDS + PLATFORM_VULKAN_DEPS + [ - "//iree/hal/interpreter:interpreter_driver_module", - # TODO(b/142004903): enable when Dawn HAL implementation is functional - # "//iree/hal/dawn:dawn_driver_module", - "//iree/hal/vulkan:vulkan_driver_module", - ], -) - -cc_binary( - name = "iree-run-mlir2", - srcs = ["run_mlir_main2.cc"], - deps = [ - "@com_google_absl//absl/flags:flag", - "@com_google_absl//absl/strings", "//iree/base:api", "//iree/base:api_util", "//iree/base:shaped_buffer", @@ -153,7 +135,7 @@ cc_library( name = "iree_translate_library", - srcs = ["iree_translate_main.cc"], + srcs = ["translate_main.cc"], deps = [ "//iree/compiler/Dialect/VM/Target/Bytecode", "//iree/compiler/Translation:IREEVM", @@ -181,7 +163,7 @@ ) cc_binary( - name = "run_module", + name = "iree-run-module", srcs = ["run_module_main.cc"], deps = [ "//iree/base:file_io", @@ -201,19 +183,6 @@ ], ) -cc_binary( - name = "iree_dump_module", - srcs = ["dump_module.cc"], - deps = [ - "//iree/base:file_io", # build-cleaner: keep - "//iree/base:flatbuffer_util", - "//iree/base:init", - "//iree/schemas", - "//iree/schemas:reflection_data", - "@com_github_google_flatbuffers//:flatbuffers", - ], -) - sh_binary( name = "IreeFileCheck", testonly = True,
diff --git a/iree/tools/CMakeLists.txt b/iree/tools/CMakeLists.txt index 43c89a3..1194b09 100644 --- a/iree/tools/CMakeLists.txt +++ b/iree/tools/CMakeLists.txt
@@ -105,7 +105,7 @@ OUT iree-translate SRCS - "iree_translate_main.cc" + "translate_main.cc" DEPS ${_ALWAYSLINK_LIBS} iree::compiler::Translation::Interpreter
diff --git a/iree/tools/compilation.bzl b/iree/tools/compilation.bzl index 6fdcc23..19c6dde 100644 --- a/iree/tools/compilation.bzl +++ b/iree/tools/compilation.bzl
@@ -28,13 +28,13 @@ name = name, srcs = [src], outs = [ - "%s.emod" % (name), + "%s.module" % (name), ], cmd = " && ".join([ " ".join([ "$(location %s)" % (translate_tool), translation, - "-o $(location %s.emod)" % (name), + "-o $(location %s.module)" % (name), "$(location %s)" % (src), ]), ]), @@ -49,7 +49,7 @@ cc_embed_data( name = "%s_cc" % (name), identifier = name, - srcs = ["%s.emod" % (name)], + srcs = ["%s.module" % (name)], cc_file_output = "%s.cc" % (name), h_file_output = "%s.h" % (name), cpp_namespace = cc_namespace,
diff --git a/iree/tools/dump_module.cc b/iree/tools/dump_module_main.cc similarity index 91% rename from iree/tools/dump_module.cc rename to iree/tools/dump_module_main.cc index 9beedf6..a55cc1a 100644 --- a/iree/tools/dump_module.cc +++ b/iree/tools/dump_module_main.cc
@@ -14,6 +14,7 @@ #include <iostream> #include <string> +#include <utility> #include "flatbuffers/flatbuffers.h" #include "flatbuffers/minireflect.h" @@ -21,13 +22,12 @@ #include "flatbuffers/util.h" #include "iree/base/flatbuffer_util.h" #include "iree/base/init.h" -#include "iree/schemas/module_def_generated.h" +#include "iree/schemas/bytecode_module_def_generated.h" namespace { using ::flatbuffers::ElementaryType; using ::flatbuffers::NumToString; -using ::flatbuffers::Offset; using ::flatbuffers::String; using ::flatbuffers::TypeTable; @@ -38,7 +38,8 @@ bool is_truncating_vector = false; int vector_depth = 0; - explicit TruncatingToStringVisitor(std::string delimiter) : d(delimiter) {} + explicit TruncatingToStringVisitor(std::string delimiter) + : d(std::move(delimiter)) {} void StartSequence() override { if (is_truncating_vector) return; @@ -157,16 +158,16 @@ } // namespace -int main(int argc, char** argv) { +extern "C" int main(int argc, char** argv) { iree::InitializeEnvironment(&argc, &argv); if (argc < 2) { - std::cerr << "Syntax: iree_dump_module filename\n"; + std::cerr << "Syntax: iree-dump-module filename\n"; return 1; } std::string module_path = argv[1]; - auto module_fb = iree::FlatBufferFile<iree::ModuleDef>::LoadFile( - iree::ModuleDefIdentifier(), module_path) + auto module_fb = iree::FlatBufferFile<iree::vm::BytecodeModuleDef>::LoadFile( + iree::vm::BytecodeModuleDefIdentifier(), module_path) .ValueOrDie(); TruncatingToStringVisitor tos_visitor("\n"); auto object = reinterpret_cast<const uint8_t*>(module_fb->root());
diff --git a/iree/tools/run_mlir_main.cc b/iree/tools/run_mlir_main.cc index 147f702..b7f341f 100644 --- a/iree/tools/run_mlir_main.cc +++ b/iree/tools/run_mlir_main.cc
@@ -16,85 +16,121 @@ // This is meant to be called from LIT for FileCheck tests, and tries to match // the interface of mlir-opt (featuring -split-input-file, etc) so it's easier // to work with there. If you want a more generalized runner for standalone -// precompiled IREE modules use //third_party/iree/tools:run_module. +// precompiled IREE modules use //third_party/iree/tools:iree-run-module. // // By default all exported functions in the module will be run in order. // All input values, provided via -input-values, will be passed to the // functions (this means all input signatures must match). Results from the // executed functions will be printed to stdout for checking. -// Use -output_types to set the function output data types, which like args will -// be used for all functions executed. // // Example input: -// // RUN: iree-run %s | FileCheck %s +// // RUN: iree-run-mlir %s | IreeFileCheck %s // // CHECK-LABEL: @foo // // CHECK: 1xf32: 2 -// func @foo() -> memref<f32> attributes {iree.module.export} { -// %0 = "iree.constant"() {value: dense<tensor<f32>, 2.0>} : () -> memref<f32> -// return %0 : memref<f32> +// func @foo() -> tensor<f32> attributes {iree.module.export} { +// %0 = constant dense<2.0> : tensor<f32> +// return %0 : tensor<f32> // } +// +// Command line arguments are handled by LLVM's parser by default but -- can be +// used to separate the compiler flags from the runtime flags, such as: +// iree-run-mlir -iree-hal-target-backends=vulkan-spirv -- --logtostderr #include <iostream> +#include <utility> #include "absl/flags/flag.h" #include "absl/strings/numbers.h" #include "absl/strings/str_replace.h" #include "absl/strings/str_split.h" #include "absl/strings/string_view.h" +#include "iree/base/api.h" +#include "iree/base/api_util.h" #include "iree/base/init.h" +#include "iree/base/shaped_buffer.h" +#include "iree/base/shaped_buffer_string_util.h" +#include "iree/base/signature_mangle.h" #include "iree/base/source_location.h" #include "iree/base/status.h" -#include "iree/compiler/Translation/Sequencer/SequencerModuleTranslation.h" -#include "iree/hal/buffer_view_string_util.h" -#include "iree/hal/driver_registry.h" -#include "iree/rt/context.h" -#include "iree/rt/debug/debug_server_flags.h" -#include "iree/rt/instance.h" -#include "iree/rt/invocation.h" -#include "iree/rt/module.h" -#include "iree/rt/module_printer.h" -#include "iree/schemas/module_def_generated.h" -#include "iree/vm/sequencer_module.h" +#include "iree/compiler/Dialect/Flow/Transforms/Passes.h" +#include "iree/compiler/Dialect/HAL/Transforms/Passes.h" +#include "iree/compiler/Dialect/VM/Target/Bytecode/BytecodeModuleTarget.h" +#include "iree/compiler/Dialect/VM/Target/Bytecode/TranslationFlags.h" +#include "iree/compiler/Dialect/VM/Transforms/Passes.h" +#include "iree/compiler/Translation/IREEVM.h" +#include "iree/hal/api.h" +#include "iree/modules/hal/hal_module.h" +#include "iree/vm2/api.h" +#include "iree/vm2/bytecode_module.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/InitLLVM.h" #include "llvm/Support/SourceMgr.h" #include "mlir/IR/Attributes.h" #include "mlir/IR/Function.h" #include "mlir/IR/MLIRContext.h" #include "mlir/IR/Module.h" #include "mlir/Parser.h" +#include "mlir/Pass/PassManager.h" #include "mlir/Support/FileUtilities.h" -ABSL_FLAG(bool, split_input_file, true, - "Split the input file into multiple modules."); +static llvm::cl::opt<std::string> input_file_flag{ + llvm::cl::Positional, + llvm::cl::desc("<input .mlir file>"), + llvm::cl::init("-"), +}; -ABSL_FLAG(std::string, target_backends, "", - "Comma-separated list of target backends to translate executables " - "into. Omit to translate using all linked-in backend translators."); -ABSL_FLAG( - bool, export_all, true, - "Automatically add the iree.module.export attribute to all functions."); +static llvm::cl::opt<bool> split_input_file_flag{ + "split-input-file", + llvm::cl::desc("Split the input file into multiple modules"), + llvm::cl::init(true), +}; -ABSL_FLAG(std::string, input_values, "", "Input shapes and optional values."); -ABSL_FLAG(std::string, output_types, "", - "Output data types (comma delimited list of b/i/u/f for " - "binary/signed int/unsigned int/float)."); +static llvm::cl::opt<bool> export_all_flag{ + "export-all", + llvm::cl::desc("Adds iree.module.export to all functions"), + llvm::cl::init(true), +}; -// TODO(benvanik): is there a more canonical flag we can use? -ABSL_FLAG(bool, print_mlir, true, "Prints MLIR IR during translation."); +static llvm::cl::opt<bool> print_mlir_flag{ + "print-mlir", + llvm::cl::desc("Prints MLIR IR after translation"), + llvm::cl::init(false), +}; -ABSL_FLAG(bool, print_bytecode, false, - "Prints IREE bytecode after translation."); +static llvm::cl::opt<bool> print_annotated_mlir_flag{ + "print-annotated-mlir", + llvm::cl::desc("Prints MLIR IR with final serialization annotations"), + llvm::cl::init(false), +}; -ABSL_FLAG(bool, run, true, - "Option to run the file. Setting it to false just compiles it."); +static llvm::cl::opt<bool> print_flatbuffer_flag{ + "print-flatbuffer", + llvm::cl::desc("Prints Flatbuffer text after serialization"), + llvm::cl::init(false), +}; + +static llvm::cl::list<std::string> input_values_flag{ + "input-value", + llvm::cl::desc("Input shapes and optional values"), + llvm::cl::ZeroOrMore, +}; + +static llvm::cl::opt<bool> run_flag{ + "run", + llvm::cl::desc("Runs the module (vs. just compiling and verifing)"), + llvm::cl::init(true), +}; + +static llvm::cl::list<std::string> run_args_flag{ + "run-arg", + llvm::cl::desc("Argument passed to the execution flag parser"), + llvm::cl::ZeroOrMore, +}; namespace iree { namespace { -using ::iree::hal::BufferView; -using ::iree::rt::Function; -using ::iree::rt::Module; - // Returns a driver name capable of handling input from the given backend. std::string BackendToDriverName(std::string backend) { size_t dash = backend.find('-'); @@ -105,8 +141,30 @@ } } +// Returns a list of target compiler backends to use for file evaluation. +StatusOr<std::vector<std::string>> GetTargetBackends() { + auto target_backends = + mlir::iree_compiler::IREE::HAL::getExecutableTargetOptionsFromFlags() + .targets; + if (target_backends.empty()) { + iree_string_view_t* driver_names = nullptr; + iree_host_size_t driver_count = 0; + RETURN_IF_ERROR( + FromApiStatus(iree_hal_driver_registry_query_available_drivers( + IREE_ALLOCATOR_SYSTEM, &driver_names, &driver_count), + IREE_LOC)); + for (int i = 0; i < driver_count; ++i) { + target_backends.push_back( + std::string(driver_names[i].data, driver_names[i].size)); + } + iree_allocator_free(IREE_ALLOCATOR_SYSTEM, driver_names); + } + return target_backends; +} + // Prepares a module for evaluation by running MLIR import and IREE translation. -StatusOr<ref_ptr<Module>> PrepareModule( +// Returns the serialized flatbuffer data. +StatusOr<std::string> PrepareModule( std::string target_backend, std::unique_ptr<llvm::MemoryBuffer> file_buffer) { mlir::MLIRContext context; @@ -117,33 +175,72 @@ mlir::OwningModuleRef mlir_module = mlir::parseSourceFile(source_mgr, &context); - if (absl::GetFlag(FLAGS_export_all)) { + if (export_all_flag) { for (auto function : mlir_module->getOps<mlir::FuncOp>()) { function.setAttr("iree.module.export", mlir::UnitAttr::get(&context)); } } // Translate from MLIR to IREE bytecode. - mlir::iree_compiler::ModuleTranslationOptions options; - options.print_mlir = absl::GetFlag(FLAGS_print_mlir); - options.target_backends = {target_backend}; - auto iree_module_bytes = - mlir::iree_compiler::translateMlirToIreeSequencerModule(mlir_module.get(), - options); - if (iree_module_bytes.empty()) { - return iree::InternalErrorBuilder(IREE_LOC) - << "Error translating MLIR to an IREE sequencer module"; + LOG(INFO) << "Compiling for target backend '" << target_backend << "'..."; + auto executable_options = + mlir::iree_compiler::IREE::HAL::getExecutableTargetOptionsFromFlags(); + executable_options.targets = {std::move(target_backend)}; + mlir::PassManager pass_manager(mlir_module->getContext()); + mlir::iree_compiler::IREE::Flow::buildFlowTransformPassPipeline(pass_manager); + mlir::iree_compiler::IREE::HAL::buildHALTransformPassPipeline( + pass_manager, executable_options); + mlir::iree_compiler::IREE::VM::buildVMTransformPassPipeline(pass_manager); + if (failed(pass_manager.run(mlir_module.get()))) { + return InternalErrorBuilder(IREE_LOC) + << "Conversion from source -> vm failed"; } - if (absl::GetFlag(FLAGS_print_mlir)) { + if (print_mlir_flag) { mlir_module->dump(); } - // Wrap module in a file handle. - ASSIGN_OR_RETURN(auto iree_module_file, - vm::ModuleFile::FromBuffer(ModuleDefIdentifier(), - std::move(iree_module_bytes))); - return vm::SequencerModule::FromFile(std::move(iree_module_file)); + auto bytecode_options = + mlir::iree_compiler::IREE::VM::getBytecodeTargetOptionsFromFlags(); + std::string binary_contents; + llvm::raw_string_ostream binary_output(binary_contents); + if (failed(mlir::iree_compiler::IREE::VM::translateModuleToBytecode( + mlir_module.get(), bytecode_options, binary_output))) { + return InternalErrorBuilder(IREE_LOC) + << "Serialization to flatbuffer bytecode (binary) failed"; + } + binary_output.flush(); + + // Print the annotated MLIR and flatbuffer; easiest way right now is to just + // do it all again. + if (print_annotated_mlir_flag) { + bytecode_options.outputFormat = + mlir::iree_compiler::IREE::VM::BytecodeOutputFormat::kAnnotatedMlirText; + std::string text_contents; + llvm::raw_string_ostream text_output(text_contents); + if (failed(mlir::iree_compiler::IREE::VM::translateModuleToBytecode( + mlir_module.get(), bytecode_options, text_output))) { + return InternalErrorBuilder(IREE_LOC) + << "Serialization to annotated MLIR (text) failed"; + } + text_output.flush(); + std::cerr << text_contents << std::endl; + } + if (print_flatbuffer_flag) { + bytecode_options.outputFormat = + mlir::iree_compiler::IREE::VM::BytecodeOutputFormat::kFlatBufferText; + std::string text_contents; + llvm::raw_string_ostream text_output(text_contents); + if (failed(mlir::iree_compiler::IREE::VM::translateModuleToBytecode( + mlir_module.get(), bytecode_options, text_output))) { + return InternalErrorBuilder(IREE_LOC) + << "Serialization to flatbuffer bytecode (text) failed"; + } + text_output.flush(); + std::cerr << text_contents << std::endl; + } + + return binary_contents; } // Parses a list of input shapes and values from a string of newline-separated @@ -152,42 +249,127 @@ // [shape]xtype=[value] // Example: // 4x4xi8=0,1,2,3 -StatusOr<std::vector<BufferView>> ParseInputsFromFlags( - hal::Allocator *allocator) { - std::string file_contents = - absl::StrReplaceAll(absl::GetFlag(FLAGS_input_values), {{"\\n", "\n"}}); - std::vector<BufferView> inputs; - std::vector<std::string> lines = absl::StrSplit( - file_contents, absl::ByAnyChar("\n;"), absl::SkipWhitespace()); - for (const auto &line : lines) { - ASSIGN_OR_RETURN(auto input, - hal::ParseBufferViewFromString(line, allocator)); - inputs.push_back(input); +StatusOr<iree_vm_variant_list_t*> ParseInputsFromFlags( + iree_vm_function_t function, iree_hal_allocator_t* allocator) { + iree_vm_variant_list_t* inputs = nullptr; + RETURN_IF_ERROR( + FromApiStatus(iree_vm_variant_list_alloc(input_values_flag.size(), + IREE_ALLOCATOR_SYSTEM, &inputs), + IREE_LOC)); + for (const auto& input_value : input_values_flag) { + ASSIGN_OR_RETURN(auto shaped_buffer, + ParseShapedBufferFromString(input_value), + _ << "Parsing input value '" << input_value << "'"); + iree_hal_buffer_t* input_buffer = nullptr; + // TODO(benvanik): combined function for linear to optimal upload. + iree_device_size_t allocation_size = + shaped_buffer.shape().element_count() * shaped_buffer.element_size(); + RETURN_IF_ERROR(FromApiStatus( + iree_hal_allocator_allocate_buffer( + allocator, + static_cast<iree_hal_memory_type_t>( + IREE_HAL_MEMORY_TYPE_HOST_LOCAL | + IREE_HAL_MEMORY_TYPE_DEVICE_VISIBLE), + static_cast<iree_hal_buffer_usage_t>( + IREE_HAL_BUFFER_USAGE_ALL | IREE_HAL_BUFFER_USAGE_CONSTANT), + allocation_size, &input_buffer), + IREE_LOC)) + << "Allocating input buffer"; + RETURN_IF_ERROR(FromApiStatus( + iree_hal_buffer_write_data(input_buffer, 0, + shaped_buffer.contents().data(), + shaped_buffer.contents().size()), + IREE_LOC)) + << "Populating input buffer contents"; + auto input_buffer_ref = iree_hal_buffer_move_ref(input_buffer); + RETURN_IF_ERROR(FromApiStatus( + iree_vm_variant_list_append_ref_move(inputs, &input_buffer_ref), + IREE_LOC)); } return inputs; } // Outputs all results from the function to stdout in IREE BufferView format. -Status OutputFunctionResults(const Function &function, - absl::Span<BufferView> results) { - std::vector<std::string> output_types = - absl::StrSplit(absl::GetFlag(FLAGS_output_types), absl::ByAnyChar(", "), - absl::SkipWhitespace()); - if (!output_types.empty() && output_types.size() != results.size()) { - return InvalidArgumentErrorBuilder(IREE_LOC) - << "--output_types= specified but has " << output_types.size() - << " types when the function returns " << results.size(); +Status OutputFunctionResults(iree_vm_function_t function, + iree_vm_variant_list_t* outputs) { + iree_string_view_t sig_fv = + iree_vm_function_reflection_attr(&function, iree_make_cstring_view("fv")); + if (iree_string_view_compare(sig_fv, iree_make_cstring_view("1")) != 0) { + return UnimplementedErrorBuilder(IREE_LOC) << "Unsupported function ABI"; } - for (int i = 0; i < results.size(); ++i) { - const auto &result = results[i]; + iree_string_view_t sig_f = + iree_vm_function_reflection_attr(&function, iree_make_cstring_view("f")); + RawSignatureParser sig_parser; + absl::InlinedVector<RawSignatureParser::Description, 4> output_descs; + sig_parser.VisitResults(absl::string_view{sig_f.data, sig_f.size}, + [&](const RawSignatureParser::Description& desc) { + output_descs.push_back(desc); + }); + if (output_descs.size() != iree_vm_variant_list_size(outputs)) { + return FailedPreconditionErrorBuilder(IREE_LOC) + << "Result signature mismatch; expected " << output_descs.size() + << " results but VM returned " << iree_vm_variant_list_size(outputs); + } + + for (int i = 0; i < iree_vm_variant_list_size(outputs); ++i) { + iree_vm_variant_t* variant = iree_vm_variant_list_get(outputs, i); + auto* buffer = iree_hal_buffer_deref(&variant->ref); + + const auto& desc = output_descs[i]; + std::string desc_str; + desc.ToString(desc_str); auto print_mode = BufferDataPrintMode::kFloatingPoint; - if (!output_types.empty()) { - ASSIGN_OR_RETURN(print_mode, ParseBufferDataPrintMode(output_types[i])); + int8_t element_size = 4; + Shape shape; + switch (desc.type) { + case RawSignatureParser::Type::kBuffer: + switch (desc.buffer.scalar_type) { + case AbiConstants::ScalarType::kIeeeFloat16: + case AbiConstants::ScalarType::kIeeeFloat32: + case AbiConstants::ScalarType::kIeeeFloat64: + print_mode = BufferDataPrintMode::kFloatingPoint; + break; + case AbiConstants::ScalarType::kSint8: + case AbiConstants::ScalarType::kSint16: + case AbiConstants::ScalarType::kSint32: + case AbiConstants::ScalarType::kSint64: + print_mode = BufferDataPrintMode::kSignedInteger; + break; + case AbiConstants::ScalarType::kUint8: + case AbiConstants::ScalarType::kUint16: + case AbiConstants::ScalarType::kUint32: + case AbiConstants::ScalarType::kUint64: + print_mode = BufferDataPrintMode::kUnsignedInteger; + break; + default: + print_mode = BufferDataPrintMode::kBinary; + break; + } + element_size = AbiConstants::kScalarTypeSize[static_cast<unsigned>( + desc.buffer.scalar_type)]; + shape = Shape{desc.dims}; + break; + default: + return UnimplementedErrorBuilder(IREE_LOC) + << "Unsupported signature type: " << desc_str; } - ASSIGN_OR_RETURN(auto result_str, - hal::PrintBufferViewToString(result, print_mode, 1024)); - LOG(INFO) << "result[" << i << "]: " << result.buffer->DebugString(); + + // TODO(benvanik): debug string C API: buffer->DebugString(); + LOG(INFO) << "result[" << i << "]: " << desc_str; + iree_hal_mapped_memory_t mapped_memory; + RETURN_IF_ERROR( + FromApiStatus(iree_hal_buffer_map(buffer, IREE_HAL_MEMORY_ACCESS_READ, + 0, IREE_WHOLE_BUFFER, &mapped_memory), + IREE_LOC)); + auto contents = absl::MakeConstSpan(mapped_memory.contents.data, + mapped_memory.contents.data_length); + ShapedBuffer shaped_buffer( + element_size, shape, + std::vector<uint8_t>(contents.begin(), contents.end())); + ASSIGN_OR_RETURN(auto result_str, PrintShapedBufferToString( + shaped_buffer, print_mode, 1024)); + iree_hal_buffer_unmap(buffer, &mapped_memory); std::cout << result_str << "\n"; } @@ -195,105 +377,167 @@ } // Evaluates a single function in its own fiber, printing the results to stdout. -Status EvaluateFunction(const ref_ptr<rt::Context> &context, - hal::Allocator *allocator, const Function &function) { - std::cout << "EXEC @" << function.name() << std::endl; +Status EvaluateFunction(iree_vm_context_t* context, + iree_hal_allocator_t* allocator, + iree_vm_function_t function) { + auto function_name = iree_vm_function_name(&function); + std::cout << "EXEC @" + << absl::string_view(function_name.data, function_name.size) + << std::endl; - // Create invocation that will perform the execution. - ASSIGN_OR_RETURN(auto arguments, ParseInputsFromFlags(allocator)); - ASSIGN_OR_RETURN( - auto invocation, - rt::Invocation::Create(add_ref(context), function, make_ref<rt::Policy>(), - {}, absl::MakeConstSpan(arguments))); + // Parse inputs and create the required input buffers. + ASSIGN_OR_RETURN(auto* input_list, ParseInputsFromFlags(function, allocator)); - // Wait until invocation completes. - RETURN_IF_ERROR(invocation->Await(absl::InfiniteFuture())); + // Prepare outputs list to accept the results from the invocation. + iree_vm_variant_list_t* output_list = nullptr; + RETURN_IF_ERROR(FromApiStatus( + iree_vm_variant_list_alloc(16, IREE_ALLOCATOR_SYSTEM, &output_list), + IREE_LOC)); + + // Synchronously invoke the function. + RETURN_IF_ERROR(FromApiStatus( + iree_vm_invoke(context, function, /*policy=*/nullptr, input_list, + output_list, IREE_ALLOCATOR_SYSTEM), + IREE_LOC)); + + iree_vm_variant_list_free(input_list); // Print outputs. - ASSIGN_OR_RETURN(auto results, invocation->ConsumeResults()); - RETURN_IF_ERROR(OutputFunctionResults(function, absl::MakeSpan(results))); + RETURN_IF_ERROR(OutputFunctionResults(function, output_list)); + iree_vm_variant_list_free(output_list); return OkStatus(); } // Evaluates all exported functions within given module. -Status EvaluateFunctions(absl::string_view target_backend, - ref_ptr<Module> module) { - // Create the context we'll use for this (ensuring that we can't interfere - // with other running evaluations, such as when in a multithreaded test - // runner). - ASSIGN_OR_RETURN(auto debug_server, rt::debug::CreateDebugServerFromFlags()); - auto instance = make_ref<rt::Instance>(std::move(debug_server)); - ASSIGN_OR_RETURN(auto driver, hal::DriverRegistry::shared_registry()->Create( - target_backend)); - ASSIGN_OR_RETURN(auto device, driver->CreateDefaultDevice()); - RETURN_IF_ERROR(instance->device_manager()->RegisterDevice(add_ref(device))); +Status EvaluateFunctions(iree_vm_instance_t* instance, + absl::string_view target_backend, + const std::string& flatbuffer_data) { + LOG(INFO) << "Evaluating all functions in module for backend '" + << target_backend << "'..."; - if (absl::GetFlag(FLAGS_print_bytecode)) { - RETURN_IF_ERROR(rt::PrintModuleToStream( - *module, rt::PrintModuleFlag::kDisassemble, &std::cout)); + // Load the bytecode module from the flatbuffer data. + // We do this first so that if we fail validation we know prior to dealing + // with devices. + iree_vm_module_t* bytecode_module = nullptr; + RETURN_IF_ERROR(FromApiStatus( + iree_vm_bytecode_module_create( + iree_const_byte_span_t{ + reinterpret_cast<const uint8_t*>(flatbuffer_data.c_str()), + flatbuffer_data.size()}, + IREE_ALLOCATOR_NULL, IREE_ALLOCATOR_SYSTEM, &bytecode_module), + IREE_LOC)) + << "Deserializing flatbuffer module"; + + if (!run_flag) { + // Just wanted verification; return without running. + iree_vm_module_release(bytecode_module); + return OkStatus(); } + // Create the driver/device as defined by the test and setup the HAL module. + LOG(INFO) << "Creating target backend driver '" << target_backend << "'..."; + iree_hal_driver_t* driver = nullptr; + RETURN_IF_ERROR(FromApiStatus( + iree_hal_driver_registry_create_driver( + iree_string_view_t{target_backend.data(), target_backend.size()}, + IREE_ALLOCATOR_SYSTEM, &driver), + IREE_LOC)) + << "Creating driver for " << target_backend; + iree_hal_device_t* device = nullptr; + RETURN_IF_ERROR(FromApiStatus(iree_hal_driver_create_default_device( + driver, IREE_ALLOCATOR_SYSTEM, &device), + IREE_LOC)) + << "Creating default device for " << target_backend; + iree_vm_module_t* hal_module = nullptr; + RETURN_IF_ERROR(FromApiStatus( + iree_hal_module_create(device, IREE_ALLOCATOR_SYSTEM, &hal_module), + IREE_LOC)) + << "Creating HAL module"; + iree_hal_driver_release(driver); + // Evaluate all exported functions. - auto policy = make_ref<rt::Policy>(); auto run_function = [&](int ordinal) -> Status { - // Setup a new context for this invocation. - auto context = make_ref<rt::Context>(add_ref(instance), add_ref(policy)); - RETURN_IF_ERROR(context->RegisterModule(add_ref(module))); + iree_vm_function_t function; + RETURN_IF_ERROR( + FromApiStatus(iree_vm_module_lookup_function_by_ordinal( + bytecode_module, IREE_VM_FUNCTION_LINKAGE_EXPORT, + ordinal, &function), + IREE_LOC)) + << "Looking up function export " << ordinal; + if (iree_string_view_starts_with(iree_vm_function_name(&function), + iree_make_cstring_view("__"))) { + // Skip internal functions. + return OkStatus(); + } + + // Create the context we'll use for this (ensuring that we can't interfere + // with other running evaluations, such as when in a multithreaded test + // runner). + iree_vm_context_t* context = nullptr; + std::vector<iree_vm_module_t*> modules = {hal_module, bytecode_module}; + RETURN_IF_ERROR(FromApiStatus(iree_vm_context_create_with_modules( + instance, modules.data(), modules.size(), + IREE_ALLOCATOR_SYSTEM, &context), + IREE_LOC)) + << "Creating context"; // Invoke the function and print results. - ASSIGN_OR_RETURN(auto function, - module->LookupFunctionByOrdinal( - rt::Function::Linkage::kExport, ordinal)); - RETURN_IF_ERROR(EvaluateFunction(context, device->allocator(), function)); + RETURN_IF_ERROR( + EvaluateFunction(context, iree_hal_device_allocator(device), function)) + << "Evaluating export function " << ordinal; + + iree_vm_context_release(context); return OkStatus(); }; Status evaluate_status = OkStatus(); - for (int i = 0; i < module->signature().export_function_count(); ++i) { + auto module_signature = iree_vm_module_signature(bytecode_module); + for (int i = 0; i < module_signature.export_function_count; ++i) { evaluate_status = run_function(i); if (!evaluate_status.ok()) { break; } } - RETURN_IF_ERROR(instance->device_manager()->UnregisterDevice(device.get())); - device.reset(); - driver.reset(); + iree_vm_module_release(hal_module); + iree_vm_module_release(bytecode_module); + iree_hal_device_release(device); return evaluate_status; } // Translates and runs a single LLVM file buffer. Status EvaluateFile(std::unique_ptr<llvm::MemoryBuffer> file_buffer) { - std::vector<std::string> target_backends; - if (absl::GetFlag(FLAGS_target_backends).empty()) { - target_backends = - hal::DriverRegistry::shared_registry()->EnumerateAvailableDrivers(); - } else { - // We need to map specific backends names to drivers (like 'vulkan-spirv' to - // the driver 'vulkan'). - target_backends = absl::StrSplit(absl::GetFlag(FLAGS_target_backends), ','); - } + // TODO(benvanik): move to instance-based registration. + RETURN_IF_ERROR(FromApiStatus(iree_hal_module_register_types(), IREE_LOC)) + << "Registering HAL types"; - for (auto target_backend : target_backends) { + iree_vm_instance_t* instance = nullptr; + RETURN_IF_ERROR(FromApiStatus( + iree_vm_instance_create(IREE_ALLOCATOR_SYSTEM, &instance), IREE_LOC)) + << "Create instance"; + + ASSIGN_OR_RETURN(auto target_backends, GetTargetBackends()); + for (const auto& target_backend : target_backends) { // Prepare the module for execution and evaluate it. auto cloned_file_buffer = llvm::MemoryBuffer::getMemBufferCopy( file_buffer->getBuffer(), file_buffer->getBufferIdentifier()); - ASSIGN_OR_RETURN(auto module, PrepareModule(target_backend + '*', - std::move(cloned_file_buffer))); - if (!absl::GetFlag(FLAGS_run)) { - continue; - } - RETURN_IF_ERROR(EvaluateFunctions(BackendToDriverName(target_backend), - std::move(module))); + ASSIGN_OR_RETURN( + auto flatbuffer_data, + PrepareModule(target_backend + '*', std::move(cloned_file_buffer)), + _ << "Translating module"); + RETURN_IF_ERROR(EvaluateFunctions( + instance, BackendToDriverName(target_backend), flatbuffer_data)) + << "Evaluating functions"; } + iree_vm_instance_release(instance); return OkStatus(); } // Runs the given .mlir file based on the current flags. -Status RunFile(std::string mlir_filename) { +Status RunFile(const std::string& mlir_filename) { // Load input file/from stdin. std::string error_message; auto file = mlir::openInputFile(mlir_filename, &error_message); @@ -303,7 +547,7 @@ << error_message; } - if (!absl::GetFlag(FLAGS_split_input_file)) { + if (!split_input_file_flag) { // Use entire buffer as a single module. return EvaluateFile(std::move(file)); } @@ -311,19 +555,19 @@ // Split the buffer into separate modules and evaluate independently. // This matches the -split-input-file arg to mlir-opt. const char kSplitMarker[] = "// -----\n"; - auto *full_buffer = file.get(); + auto* full_buffer = file.get(); llvm::SmallVector<llvm::StringRef, 8> source_buffers; full_buffer->getBuffer().split(source_buffers, kSplitMarker); // Add the original buffer to the source manager. - llvm::SourceMgr fileSourceMgr; - fileSourceMgr.AddNewSourceBuffer(std::move(file), llvm::SMLoc()); + llvm::SourceMgr file_source_mgr; + file_source_mgr.AddNewSourceBuffer(std::move(file), llvm::SMLoc()); // Process each chunk in turn. Only return the first error (but log all). Status any_failure; - for (auto &sub_source_buffer : source_buffers) { + for (auto& sub_source_buffer : source_buffers) { auto split_loc = llvm::SMLoc::getFromPointer(sub_source_buffer.data()); - unsigned split_line = fileSourceMgr.getLineAndColumn(split_loc).first; + unsigned split_line = file_source_mgr.getLineAndColumn(split_loc).first; auto sub_buffer = llvm::MemoryBuffer::getMemBufferCopy( sub_source_buffer, full_buffer->getBufferIdentifier() + llvm::Twine(" split at line #") + @@ -343,15 +587,37 @@ } // namespace -extern "C" int main(int argc, char **argv) { - InitializeEnvironment(&argc, &argv); - if (argc < 2) { - LOG(ERROR) << "Must supply an input .mlir file."; - return 1; +extern "C" int main(int argc, char** argv) { + int argc_llvm = argc; + char** argv_llvm = argv; + int argc_absl = 1; + std::vector<char*> argv_absl = {argv[0]}; + for (int i = 0; i < argc; ++i) { + if (std::strcmp(argv[i], "--") == 0) { + argc_llvm = i; + argc_absl = argc - i; + for (int j = i + 1; j < argc; ++j) { + argv_absl.push_back(argv[i + 1]); + } + break; + } } - auto status = RunFile(argv[1]); + + mlir::registerPassManagerCLOptions(); + llvm::InitLLVM init_llvm(argc_llvm, argv_llvm); + llvm::cl::ParseCommandLineOptions(argc_llvm, argv_llvm); + + for (auto& run_arg : run_args_flag) { + argv_absl.push_back(const_cast<char*>(run_arg.c_str())); + } + argc_absl += run_args_flag.size(); + char** argv_absl_ptr = argv_absl.data(); + InitializeEnvironment(&argc_absl, &argv_absl_ptr); + + auto status = RunFile(input_file_flag); if (!status.ok()) { - std::cerr << "ERROR running file (" << argv[1] << "): " << status << "\n"; + std::cerr << "ERROR running file (" << input_file_flag << "): " << status + << "\n"; return 1; } return 0;
diff --git a/iree/tools/run_mlir_main2.cc b/iree/tools/run_mlir_main2.cc index b7f341f..ed368be 100644 --- a/iree/tools/run_mlir_main2.cc +++ b/iree/tools/run_mlir_main2.cc
@@ -458,19 +458,6 @@ // Evaluate all exported functions. auto run_function = [&](int ordinal) -> Status { - iree_vm_function_t function; - RETURN_IF_ERROR( - FromApiStatus(iree_vm_module_lookup_function_by_ordinal( - bytecode_module, IREE_VM_FUNCTION_LINKAGE_EXPORT, - ordinal, &function), - IREE_LOC)) - << "Looking up function export " << ordinal; - if (iree_string_view_starts_with(iree_vm_function_name(&function), - iree_make_cstring_view("__"))) { - // Skip internal functions. - return OkStatus(); - } - // Create the context we'll use for this (ensuring that we can't interfere // with other running evaluations, such as when in a multithreaded test // runner). @@ -482,6 +469,14 @@ IREE_LOC)) << "Creating context"; + iree_vm_function_t function; + RETURN_IF_ERROR( + FromApiStatus(iree_vm_module_lookup_function_by_ordinal( + bytecode_module, IREE_VM_FUNCTION_LINKAGE_EXPORT, + ordinal, &function), + IREE_LOC)) + << "Looking up function export " << ordinal; + // Invoke the function and print results. RETURN_IF_ERROR( EvaluateFunction(context, iree_hal_device_allocator(device), function))
diff --git a/iree/tools/iree_translate_main.cc b/iree/tools/translate_main.cc similarity index 100% rename from iree/tools/iree_translate_main.cc rename to iree/tools/translate_main.cc
diff --git a/test/e2e/xla/BUILD b/test/e2e/xla/BUILD index ee17199..2a822db 100644 --- a/test/e2e/xla/BUILD +++ b/test/e2e/xla/BUILD
@@ -23,7 +23,7 @@ iree_setup_lit_package( data = [ - "//iree/tools:iree-run-mlir2", + "//iree/tools:iree-run-mlir", ], )
diff --git a/test/e2e/xla/abs.mlir b/test/e2e/xla/abs.mlir index 3055d86..884fdba 100644 --- a/test/e2e/xla/abs.mlir +++ b/test/e2e/xla/abs.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode -input-value="2x2xf32= 1 2 3 4" -input-value="2x3xf32= 5 6 7 8 9 10" -input-value="2x2xf32= 11 12 13 14" %s | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv -input-value="2x2xf32= 1 2 3 4" -input-value="2x3xf32= 5 6 7 8 9 10" -input-value="2x2xf32= 11 12 13 14" %s | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode -input-value="2x2xf32= 1 2 3 4" -input-value="2x3xf32= 5 6 7 8 9 10" -input-value="2x2xf32= 11 12 13 14" %s | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv -input-value="2x2xf32= 1 2 3 4" -input-value="2x3xf32= 5 6 7 8 9 10" -input-value="2x2xf32= 11 12 13 14" %s | IreeFileCheck %s) // CHECK-LABEL: EXEC @tensor func @tensor() -> tensor<4xf32> {
diff --git a/test/e2e/xla/collatz.mlir b/test/e2e/xla/collatz.mlir index af48c7c..e214609 100644 --- a/test/e2e/xla/collatz.mlir +++ b/test/e2e/xla/collatz.mlir
@@ -1,4 +1,4 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode -input-value="f32=178" %s | IreeFileCheck %s +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode -input-value="f32=178" %s | IreeFileCheck %s // CHECK-LABEL: EXEC @collatz func @collatz(%arg0: tensor<f32>) -> tensor<f32> {
diff --git a/test/e2e/xla/compare.mlir b/test/e2e/xla/compare.mlir index bb73f68..b7395a9 100644 --- a/test/e2e/xla/compare.mlir +++ b/test/e2e/xla/compare.mlir
@@ -1,4 +1,4 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s // CHECK-LABEL: EXEC @compare_tensor func @compare_tensor() -> tensor<4xi8> {
diff --git a/test/e2e/xla/concatenate.mlir b/test/e2e/xla/concatenate.mlir index 51f1c34..0988d8c 100644 --- a/test/e2e/xla/concatenate.mlir +++ b/test/e2e/xla/concatenate.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode -input-value="2x2xf32= 1 2 3 4" -input-value="2x3xf32= 5 6 7 8 9 10" -input-value="2x2xf32= 11 12 13 14" %s | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv -input-value="2x2xf32= 1 2 3 4" -input-value="2x3xf32= 5 6 7 8 9 10" -input-value="2x2xf32= 11 12 13 14" %s | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode -input-value="2x2xf32= 1 2 3 4" -input-value="2x3xf32= 5 6 7 8 9 10" -input-value="2x2xf32= 11 12 13 14" %s | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv -input-value="2x2xf32= 1 2 3 4" -input-value="2x3xf32= 5 6 7 8 9 10" -input-value="2x2xf32= 11 12 13 14" %s | IreeFileCheck %s) // CHECK-LABEL: EXEC @xla_concatenate func @xla_concatenate(%arg0: tensor<2x2xf32>, %arg1: tensor<2x3xf32>, %arg2: tensor<2x2xf32>) -> (tensor<2x5xf32>, tensor<2x5xf32>, tensor<2x7xf32>, tensor<4x2xf32>) {
diff --git a/test/e2e/xla/constants.mlir b/test/e2e/xla/constants.mlir index f2dc5ca..a49f70f 100644 --- a/test/e2e/xla/constants.mlir +++ b/test/e2e/xla/constants.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s | IreeFileCheck %s) // CHECK-LABEL: EXEC @xla_constant_i32 func @xla_constant_i32 () -> (tensor<2x2x3xi32>, tensor<2x2x3xi32>) {
diff --git a/test/e2e/xla/convert_int.mlir b/test/e2e/xla/convert_int.mlir index d7a9b3e..6530c79 100644 --- a/test/e2e/xla/convert_int.mlir +++ b/test/e2e/xla/convert_int.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s -input-value=1xi32=42 | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s -input-value=1xi32=42 | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s -input-value=1xi32=42 | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s -input-value=1xi32=42 | IreeFileCheck %s) // CHECK-LABEL: EXEC @narrow_int func @narrow_int(%arg : tensor<1xi32>) -> tensor<1xi8> {
diff --git a/test/e2e/xla/dot.mlir b/test/e2e/xla/dot.mlir index 4ead947..c374e76 100644 --- a/test/e2e/xla/dot.mlir +++ b/test/e2e/xla/dot.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode -input-value="2xf32=0.3, 0.5" %s | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv -input-value="2xf32=0.3, 0.5" %s | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode -input-value="2xf32=0.3, 0.5" %s | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv -input-value="2xf32=0.3, 0.5" %s | IreeFileCheck %s) // CHECK-LABEL: EXEC @dot_passthrough func @dot_passthrough(%arg0: tensor<2xf32>) -> tensor<1x3xf32> {
diff --git a/test/e2e/xla/exp.mlir b/test/e2e/xla/exp.mlir index d972062..d731aa5 100644 --- a/test/e2e/xla/exp.mlir +++ b/test/e2e/xla/exp.mlir
@@ -1,4 +1,4 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s // CHECK-LABEL: EXEC @tensor func @tensor() -> tensor<4xf32> {
diff --git a/test/e2e/xla/floor.mlir b/test/e2e/xla/floor.mlir index cf1d56d..cd4809c 100644 --- a/test/e2e/xla/floor.mlir +++ b/test/e2e/xla/floor.mlir
@@ -1,4 +1,4 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s // CHECK-LABEL: EXEC @tensor func @tensor() -> tensor<4xf32> {
diff --git a/test/e2e/xla/fragment_000.mlir b/test/e2e/xla/fragment_000.mlir index d5f1dd7..a09f25d 100644 --- a/test/e2e/xla/fragment_000.mlir +++ b/test/e2e/xla/fragment_000.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s -input-value="f32=0" -input-value="5x1xf32=[1][-2][-3][4][-5]" -input-value="f32=1" -input-value="5x5xf32=[3.46499 -7.64389 -5.72249 5.98053 17.6892][2.9707 -6.20734 -4.25962 4.76055 13.8784][2.47641 -4.77079 -2.79675 3.54056 10.0675][1.98212 -3.33424 -1.33388 2.32058 6.25666][1.48783 -1.8977 0.12899 1.1006 2.4458]" -input-value="5xf32=0 0 0 0 0" | IreeFileCheck %s --implicit-check-not="[" --implicit-check-not="]" -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s -input-value="f32=0" -input-value="5x1xf32=[1][-2][-3][4][-5]" -input-value="f32=1" -input-value="5x5xf32=[3.46499 -7.64389 -5.72249 5.98053 17.6892][2.9707 -6.20734 -4.25962 4.76055 13.8784][2.47641 -4.77079 -2.79675 3.54056 10.0675][1.98212 -3.33424 -1.33388 2.32058 6.25666][1.48783 -1.8977 0.12899 1.1006 2.4458]" -input-value="5xf32=0 0 0 0 0" | IreeFileCheck %s --implicit-check-not="[" --implicit-check-not="]") +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s -input-value="f32=0" -input-value="5x1xf32=[1][-2][-3][4][-5]" -input-value="f32=1" -input-value="5x5xf32=[3.46499 -7.64389 -5.72249 5.98053 17.6892][2.9707 -6.20734 -4.25962 4.76055 13.8784][2.47641 -4.77079 -2.79675 3.54056 10.0675][1.98212 -3.33424 -1.33388 2.32058 6.25666][1.48783 -1.8977 0.12899 1.1006 2.4458]" -input-value="5xf32=0 0 0 0 0" | IreeFileCheck %s --implicit-check-not="[" --implicit-check-not="]" +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s -input-value="f32=0" -input-value="5x1xf32=[1][-2][-3][4][-5]" -input-value="f32=1" -input-value="5x5xf32=[3.46499 -7.64389 -5.72249 5.98053 17.6892][2.9707 -6.20734 -4.25962 4.76055 13.8784][2.47641 -4.77079 -2.79675 3.54056 10.0675][1.98212 -3.33424 -1.33388 2.32058 6.25666][1.48783 -1.8977 0.12899 1.1006 2.4458]" -input-value="5xf32=0 0 0 0 0" | IreeFileCheck %s --implicit-check-not="[" --implicit-check-not="]") // CHECK-LABEL: EXEC @main_entry_dispatch_3 func @main_entry_dispatch_3(
diff --git a/test/e2e/xla/fullyconnected.mlir b/test/e2e/xla/fullyconnected.mlir index 4053411..e243255 100644 --- a/test/e2e/xla/fullyconnected.mlir +++ b/test/e2e/xla/fullyconnected.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 %s -iree-hal-target-backends=interpreter-bytecode -input-value="1x5xf32=1,-2,-3,4,-5" -input-value="1x5x3x1xf32=15,14,13,12,11,10,9,8,7,6,5,4,3,2,1" | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 %s -iree-hal-target-backends=vulkan-spirv -input-value="1x5xf32=1,-2,-3,4,-5" -input-value="1x5x3x1xf32=15,14,13,12,11,10,9,8,7,6,5,4,3,2,1" | IreeFileCheck %s) +// RUN: iree-run-mlir %s -iree-hal-target-backends=interpreter-bytecode -input-value="1x5xf32=1,-2,-3,4,-5" -input-value="1x5x3x1xf32=15,14,13,12,11,10,9,8,7,6,5,4,3,2,1" | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir %s -iree-hal-target-backends=vulkan-spirv -input-value="1x5xf32=1,-2,-3,4,-5" -input-value="1x5x3x1xf32=15,14,13,12,11,10,9,8,7,6,5,4,3,2,1" | IreeFileCheck %s) // CHECK-LABEL: EXEC @main func @main(%arg0: tensor<1x5xf32>, %arg1: tensor<1x5x3x1xf32>) -> tuple<tensor<5x1x5xf32>>
diff --git a/test/e2e/xla/gather.mlir b/test/e2e/xla/gather.mlir index 26b7ac1..765f743 100644 --- a/test/e2e/xla/gather.mlir +++ b/test/e2e/xla/gather.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s -input-value="5x1x5xi32=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25]" -input-value="i64=2" | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s -input-value="5x1x5xi32=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25]" -input-value="i64=2" | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s -input-value="5x1x5xi32=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25]" -input-value="i64=2" | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s -input-value="5x1x5xi32=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25]" -input-value="i64=2" | IreeFileCheck %s) module { // CHECK-LABEL: EXEC @foo
diff --git a/test/e2e/xla/gather_concat.mlir b/test/e2e/xla/gather_concat.mlir index 32efe0d..753f8ac 100644 --- a/test/e2e/xla/gather_concat.mlir +++ b/test/e2e/xla/gather_concat.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode --input-value="1x2xf32= 1 2" -input-value="2x1x4xf32= 5 6 7 8 9 10 11 12" -input-value="i64= 0" %s | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv -input-value="1x2xf32= 1 2" -input-value="2x1x4xf32= 5 6 7 8 9 10 11 12" -input-value="i64= 0" %s | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode --input-value="1x2xf32= 1 2" -input-value="2x1x4xf32= 5 6 7 8 9 10 11 12" -input-value="i64= 0" %s | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv -input-value="1x2xf32= 1 2" -input-value="2x1x4xf32= 5 6 7 8 9 10 11 12" -input-value="i64= 0" %s | IreeFileCheck %s) module { func @gather_concat(%arg0: tensor<1x2xf32>, %arg1: tensor<2x1x4xf32>, %arg2: tensor<i64>) -> tensor<1x6xf32> {
diff --git a/test/e2e/xla/gemm.mlir b/test/e2e/xla/gemm.mlir index 92ef721..82614b5 100644 --- a/test/e2e/xla/gemm.mlir +++ b/test/e2e/xla/gemm.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 %s -iree-hal-target-backends=interpreter-bytecode -input-value="5x3xf32=15,14,13,12,11,10,9,8,7,6,5,4,3,2,1" -input-value="3x5xf32=15,14,13,12,11,10,9,8,7,6,5,4,3,2,1" | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s -input-value="5x3xf32=15,14,13,12,11,10,9,8,7,6,5,4,3,2,1" -input-value="3x5xf32=15,14,13,12,11,10,9,8,7,6,5,4,3,2,1" | IreeFileCheck %s) +// RUN: iree-run-mlir %s -iree-hal-target-backends=interpreter-bytecode -input-value="5x3xf32=15,14,13,12,11,10,9,8,7,6,5,4,3,2,1" -input-value="3x5xf32=15,14,13,12,11,10,9,8,7,6,5,4,3,2,1" | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s -input-value="5x3xf32=15,14,13,12,11,10,9,8,7,6,5,4,3,2,1" -input-value="3x5xf32=15,14,13,12,11,10,9,8,7,6,5,4,3,2,1" | IreeFileCheck %s) // CHECK-LABEL: EXEC @main func @main(%arg0: tensor<5x3xf32>, %arg1: tensor<3x5xf32>) -> tensor<5x5xf32>
diff --git a/test/e2e/xla/globals.mlir b/test/e2e/xla/globals.mlir index 726f293..9eafdc3 100644 --- a/test/e2e/xla/globals.mlir +++ b/test/e2e/xla/globals.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s | IreeFileCheck %s) module { flow.variable @counter mutable dense<2.0> : tensor<f32>
diff --git a/test/e2e/xla/load_i8.mlir b/test/e2e/xla/load_i8.mlir index d129844..22801f9 100644 --- a/test/e2e/xla/load_i8.mlir +++ b/test/e2e/xla/load_i8.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s -input-value="17xi8= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17" | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s -input-value="17xi8= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17" | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s -input-value="17xi8= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17" | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s -input-value="17xi8= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17" | IreeFileCheck %s) // CHECK-LABEL: EXEC @load_i8 func @load_i8(%arg : tensor<17xi8>) -> tensor<17xi32> {
diff --git a/test/e2e/xla/log.mlir b/test/e2e/xla/log.mlir index 989ec9d..c388ae3 100644 --- a/test/e2e/xla/log.mlir +++ b/test/e2e/xla/log.mlir
@@ -1,4 +1,4 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s // CHECK-LABEL: EXEC @tensor func @tensor() -> tensor<4xf32> {
diff --git a/test/e2e/xla/max_float.mlir b/test/e2e/xla/max_float.mlir index df36dae..7bf0081 100644 --- a/test/e2e/xla/max_float.mlir +++ b/test/e2e/xla/max_float.mlir
@@ -1,4 +1,4 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s // CHECK-LABEL: EXEC @tensor func @tensor() -> tensor<4xf32> {
diff --git a/test/e2e/xla/max_int.mlir b/test/e2e/xla/max_int.mlir index a9299f9..bd0caba 100644 --- a/test/e2e/xla/max_int.mlir +++ b/test/e2e/xla/max_int.mlir
@@ -1,4 +1,4 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s // CHECK-LABEL: EXEC @tensor func @tensor() -> tensor<4xi32> {
diff --git a/test/e2e/xla/min_float.mlir b/test/e2e/xla/min_float.mlir index df36dae..7bf0081 100644 --- a/test/e2e/xla/min_float.mlir +++ b/test/e2e/xla/min_float.mlir
@@ -1,4 +1,4 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s // CHECK-LABEL: EXEC @tensor func @tensor() -> tensor<4xf32> {
diff --git a/test/e2e/xla/min_int.mlir b/test/e2e/xla/min_int.mlir index 1e6f8d0..c1da3c7 100644 --- a/test/e2e/xla/min_int.mlir +++ b/test/e2e/xla/min_int.mlir
@@ -1,4 +1,4 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s // CHECK-LABEL: EXEC @tensor func @tensor() -> tensor<4xi32> {
diff --git a/test/e2e/xla/mnist.mlir b/test/e2e/xla/mnist.mlir index fc848fe..c4f760d 100644 --- a/test/e2e/xla/mnist.mlir +++ b/test/e2e/xla/mnist.mlir
@@ -1,7 +1,7 @@ // MNIST model with placeholder weights, for translation testing. -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s -input-value="1x28x28x1xf32" | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s -input-value="1x28x28x1xf32" | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s -input-value="1x28x28x1xf32" | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s -input-value="1x28x28x1xf32" | IreeFileCheck %s) module { // CHECK-LABEL: EXEC @main
diff --git a/test/e2e/xla/pad.mlir b/test/e2e/xla/pad.mlir index 96428ff..943ccd4 100644 --- a/test/e2e/xla/pad.mlir +++ b/test/e2e/xla/pad.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s -input-value="2x3xi32=[1 2 3 4 5 6]" | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s -input-value="2x3xi32=[1 2 3 4 5 6]" | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s -input-value="2x3xi32=[1 2 3 4 5 6]" | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s -input-value="2x3xi32=[1 2 3 4 5 6]" | IreeFileCheck %s) // CHECK-LABEL: EXEC @pad func @pad(%0: tensor<2x3xi32>) -> tensor<4x13xi32>
diff --git a/test/e2e/xla/reduce_float.mlir b/test/e2e/xla/reduce_float.mlir index 30b34fe..55de379 100644 --- a/test/e2e/xla/reduce_float.mlir +++ b/test/e2e/xla/reduce_float.mlir
@@ -1,6 +1,6 @@ -// RUN: iree-run-mlir2 %s -iree-hal-target-backends=interpreter-bytecode | IreeFileCheck %s +// RUN: iree-run-mlir %s -iree-hal-target-backends=interpreter-bytecode | IreeFileCheck %s // TODO(b/142903911): figure out swiftshader+asan crash: -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 %s -iree-hal-target-backends=vulkan-spirv --run=false) +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir %s -iree-hal-target-backends=vulkan-spirv --run=false) // Float sum values from [1.0, 10.0] // CHECK-LABEL: EXEC @reduce_sum_1x10xf32
diff --git a/test/e2e/xla/reduce_int.mlir b/test/e2e/xla/reduce_int.mlir index d99e479..07eaeb8 100644 --- a/test/e2e/xla/reduce_int.mlir +++ b/test/e2e/xla/reduce_int.mlir
@@ -1,4 +1,4 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s // Int sum values from [1, 10] // CHECK-LABEL: EXEC @reduce_sum_1x10xi32
diff --git a/test/e2e/xla/rem.mlir b/test/e2e/xla/rem.mlir index 6dfa46d..167ac51 100644 --- a/test/e2e/xla/rem.mlir +++ b/test/e2e/xla/rem.mlir
@@ -1,4 +1,4 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s // CHECK-LABEL: EXEC @scalar func @scalar() -> tensor<f32> {
diff --git a/test/e2e/xla/reshape.mlir b/test/e2e/xla/reshape.mlir index 46371c0..9c9b9b7 100644 --- a/test/e2e/xla/reshape.mlir +++ b/test/e2e/xla/reshape.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s -input-value="12xf32=[1 2 3 4 5 6 7 8 9 10 11 12]" | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s -input-value="12xf32=[1 2 3 4 5 6 7 8 9 10 11 12]" | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s -input-value="12xf32=[1 2 3 4 5 6 7 8 9 10 11 12]" | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s -input-value="12xf32=[1 2 3 4 5 6 7 8 9 10 11 12]" | IreeFileCheck %s) // CHECK-LABEL: EXEC @reshape_1D_2D func @reshape_1D_2D(%arg : tensor<12xf32>) -> tensor<3x4xf32> {
diff --git a/test/e2e/xla/reshape_adddims.mlir b/test/e2e/xla/reshape_adddims.mlir index ff4112d..c0e8657 100644 --- a/test/e2e/xla/reshape_adddims.mlir +++ b/test/e2e/xla/reshape_adddims.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s -input-value="2x6xf32= 1 2 3 4 5 6 7 8 9 10 11 12" | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s -input-value="2x6xf32= 1 2 3 4 5 6 7 8 9 10 11 12" | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s -input-value="2x6xf32= 1 2 3 4 5 6 7 8 9 10 11 12" | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s -input-value="2x6xf32= 1 2 3 4 5 6 7 8 9 10 11 12" | IreeFileCheck %s) // CHECK-LABEL: EXEC @reshape_3D_2D func @reshape_3D_2D(%arg : tensor<2x6xf32>) -> tensor<2x1x6xf32> {
diff --git a/test/e2e/xla/reshape_dropdims.mlir b/test/e2e/xla/reshape_dropdims.mlir index 5f110eb..923c4d4 100644 --- a/test/e2e/xla/reshape_dropdims.mlir +++ b/test/e2e/xla/reshape_dropdims.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s -input-value="2x1x6xf32= 1 2 3 4 5 6 7 8 9 10 11 12" | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s -input-value="2x1x6xf32= 1 2 3 4 5 6 7 8 9 10 11 12" | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s -input-value="2x1x6xf32= 1 2 3 4 5 6 7 8 9 10 11 12" | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s -input-value="2x1x6xf32= 1 2 3 4 5 6 7 8 9 10 11 12" | IreeFileCheck %s) // CHECK-LABEL: EXEC @reshape_3D_1D func @reshape_3D_1D(%arg : tensor<2x1x6xf32>) -> tensor<2x6xf32> {
diff --git a/test/e2e/xla/reverse.mlir b/test/e2e/xla/reverse.mlir index 2486608..c522a33 100644 --- a/test/e2e/xla/reverse.mlir +++ b/test/e2e/xla/reverse.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s | IreeFileCheck %s) // CHECK-LABEL: EXEC @xla_reverse func @xla_reverse () -> (tensor<2x3xf32>, tensor <2x3xf32>, tensor <2x3xf32>) {
diff --git a/test/e2e/xla/rsqrt.mlir b/test/e2e/xla/rsqrt.mlir index fcba71d..f4207d6 100644 --- a/test/e2e/xla/rsqrt.mlir +++ b/test/e2e/xla/rsqrt.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s | IreeFileCheck %s) // CHECK-LABEL: EXEC @tensor func @tensor() -> tensor<4xf32> {
diff --git a/test/e2e/xla/select.mlir b/test/e2e/xla/select.mlir index e57d8d5..eea55f2 100644 --- a/test/e2e/xla/select.mlir +++ b/test/e2e/xla/select.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s -input-value="4xi8=[1 0 200 0]" | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s -input-value="4xi8=[1 0 200 0]" | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s -input-value="4xi8=[1 0 200 0]" | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s -input-value="4xi8=[1 0 200 0]" | IreeFileCheck %s) // CHECK-LABEL: EXEC @select func @select(%cond : tensor<4xi1>) -> tensor<4xf32> {
diff --git a/test/e2e/xla/slice.mlir b/test/e2e/xla/slice.mlir index 5fe5692..4790f72 100644 --- a/test/e2e/xla/slice.mlir +++ b/test/e2e/xla/slice.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s -input-value="3x4xf32= 1 2 3 4 5 6 7 8 9 10 11 12" | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s -input-value="3x4xf32= 1 2 3 4 5 6 7 8 9 10 11 12" | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s -input-value="3x4xf32= 1 2 3 4 5 6 7 8 9 10 11 12" | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s -input-value="3x4xf32= 1 2 3 4 5 6 7 8 9 10 11 12" | IreeFileCheck %s) // CHECK-LABEL: EXEC @slice_whole_buffer func @slice_whole_buffer(%arg : tensor<3x4xf32>) -> tensor<3x4xf32> {
diff --git a/test/e2e/xla/sqrt.mlir b/test/e2e/xla/sqrt.mlir index b2e9263..da98e7c 100644 --- a/test/e2e/xla/sqrt.mlir +++ b/test/e2e/xla/sqrt.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s | IreeFileCheck %s) // CHECK-LABEL: EXEC @tensor func @tensor() -> tensor<4xf32> {
diff --git a/test/e2e/xla/store_i8.mlir b/test/e2e/xla/store_i8.mlir index b93f621..d451bc6 100644 --- a/test/e2e/xla/store_i8.mlir +++ b/test/e2e/xla/store_i8.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s -input-value="17xi32=-8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8" | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s -input-value="17xi32=-8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8" | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s -input-value="17xi32=-8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8" | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s -input-value="17xi32=-8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8" | IreeFileCheck %s) // CHECK-LABEL: EXEC @store_i8 func @store_i8(%arg : tensor<17xi32>) -> tensor<17xi8> {
diff --git a/test/e2e/xla/through_std.mlir b/test/e2e/xla/through_std.mlir index 7af1b82..665effe 100644 --- a/test/e2e/xla/through_std.mlir +++ b/test/e2e/xla/through_std.mlir
@@ -1,5 +1,5 @@ -// RUN: iree-run-mlir2 -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 -iree-hal-target-backends=vulkan-spirv %s | IreeFileCheck %s) +// RUN: iree-run-mlir -iree-hal-target-backends=interpreter-bytecode %s | IreeFileCheck %s +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir -iree-hal-target-backends=vulkan-spirv %s | IreeFileCheck %s) // CHECK-LABEL: EXEC @xla_through_stdops func @xla_through_stdops () -> (tensor<f32>, tensor<f32>) {
diff --git a/test/e2e/xla/unidirectional_lstm.mlir b/test/e2e/xla/unidirectional_lstm.mlir index 79dc3b5..59aff4e 100644 --- a/test/e2e/xla/unidirectional_lstm.mlir +++ b/test/e2e/xla/unidirectional_lstm.mlir
@@ -1,6 +1,6 @@ // An example LSTM exported from a python reference model with dummy weights. -// RUN: iree-run-mlir2 %s -iree-hal-target-backends=interpreter-bytecode -input-value="1x5xf32=[0 1 0 3 4]" -input-value="1x5x2x2xf32=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]" -export-all=false | IreeFileCheck %s --implicit-check-not="[" --implicit-check-not="]" +// RUN: iree-run-mlir %s -iree-hal-target-backends=interpreter-bytecode -input-value="1x5xf32=[0 1 0 3 4]" -input-value="1x5x2x2xf32=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]" -export-all=false | IreeFileCheck %s --implicit-check-not="[" --implicit-check-not="]" // Exported via the XLA HLO Importer // The resulting MLIR was modified by hand by changing all large constants to be
diff --git a/test/e2e/xla/while.mlir b/test/e2e/xla/while.mlir index e786713..150cb01 100644 --- a/test/e2e/xla/while.mlir +++ b/test/e2e/xla/while.mlir
@@ -1,7 +1,7 @@ // A simple while loop example. -// RUN: iree-run-mlir2 %s -iree-hal-target-backends=interpreter-bytecode -input-value="f32=[1]" -input-value="f32=[3]" --export-all=false | IreeFileCheck %s --implicit-check-not="[" --implicit-check-not="]" -// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir2 %s -iree-hal-target-backends=vulkan-spirv -input-value="f32=[1]" -input-value="f32=[3]" --export-all=false | IreeFileCheck %s --implicit-check-not="[" --implicit-check-not="]") +// RUN: iree-run-mlir %s -iree-hal-target-backends=interpreter-bytecode -input-value="f32=[1]" -input-value="f32=[3]" --export-all=false | IreeFileCheck %s --implicit-check-not="[" --implicit-check-not="]" +// RUN: [[ $IREE_VULKAN_DISABLE == 1 ]] || (iree-run-mlir %s -iree-hal-target-backends=vulkan-spirv -input-value="f32=[1]" -input-value="f32=[3]" --export-all=false | IreeFileCheck %s --implicit-check-not="[" --implicit-check-not="]") // CHECK-LABEL: EXEC @main func @main(%arg0: tensor<f32>, %arg1: tensor<f32>) -> tensor<f32> attributes { iree.module.export } {