Removing more absl::string_view usage.
diff --git a/iree/base/internal/BUILD b/iree/base/internal/BUILD
index 50b3fc3..19ffccb 100644
--- a/iree/base/internal/BUILD
+++ b/iree/base/internal/BUILD
@@ -284,8 +284,6 @@
"//iree/base",
"//iree/base:core_headers",
"//iree/base:logging",
- "@com_google_absl//absl/base:core_headers",
- "@com_google_absl//absl/strings",
"@com_google_absl//absl/utility",
],
)
diff --git a/iree/base/internal/CMakeLists.txt b/iree/base/internal/CMakeLists.txt
index 67298a8..1a047b0 100644
--- a/iree/base/internal/CMakeLists.txt
+++ b/iree/base/internal/CMakeLists.txt
@@ -284,8 +284,6 @@
"status.cc"
"statusor.cc"
DEPS
- absl::core_headers
- absl::strings
absl::utility
iree::base
iree::base::core_headers
diff --git a/iree/base/internal/status.h b/iree/base/internal/status.h
index 3cdc353..e80ae64 100644
--- a/iree/base/internal/status.h
+++ b/iree/base/internal/status.h
@@ -23,7 +23,6 @@
#include <memory>
#include <string>
-#include "absl/strings/string_view.h"
#include "iree/base/api.h"
#include "iree/base/attributes.h"
#include "iree/base/logging.h"
@@ -143,22 +142,20 @@
// Creates a status with the specified code and error message.
// If `code` is kOk, `message` is ignored.
- Status(StatusCode code, absl::string_view message) {
+ Status(StatusCode code, const char* message) {
if (IREE_UNLIKELY(code != StatusCode::kOk)) {
- value_ = message.empty()
+ value_ = (!message || !strlen(message))
? iree_status_from_code(code)
- : iree_status_allocate(
- static_cast<iree_status_code_t>(code),
- /*file=*/nullptr, /*line=*/0,
- iree_make_string_view(message.data(), message.size()));
+ : iree_status_allocate(static_cast<iree_status_code_t>(code),
+ /*file=*/nullptr, /*line=*/0,
+ iree_make_cstring_view(message));
}
}
- Status(StatusCode code, SourceLocation location, absl::string_view message) {
+ Status(StatusCode code, SourceLocation location, const char* message) {
if (IREE_UNLIKELY(code != StatusCode::kOk)) {
- value_ = iree_status_allocate(
- static_cast<iree_status_code_t>(code), location.file_name(),
- location.line(),
- iree_make_string_view(message.data(), message.size()));
+ value_ = iree_status_allocate(static_cast<iree_status_code_t>(code),
+ location.file_name(), location.line(),
+ iree_make_cstring_view(message));
}
}
diff --git a/iree/hal/buffer_view.cc b/iree/hal/buffer_view.cc
index 94654e1..52b8485 100644
--- a/iree/hal/buffer_view.cc
+++ b/iree/hal/buffer_view.cc
@@ -19,10 +19,6 @@
#include <cstdio>
#include <vector>
-#include "absl/strings/ascii.h"
-#include "absl/strings/numbers.h"
-#include "absl/strings/str_join.h"
-#include "absl/strings/str_split.h"
#include "absl/strings/string_view.h"
#include "iree/base/api.h"
#include "iree/base/tracing.h"
diff --git a/iree/hal/vulkan/BUILD b/iree/hal/vulkan/BUILD
index e35e4d8..72e109f 100644
--- a/iree/hal/vulkan/BUILD
+++ b/iree/hal/vulkan/BUILD
@@ -104,7 +104,6 @@
"//iree/hal/vulkan/util:intrusive_list",
"//iree/hal/vulkan/util:ref_ptr",
"//iree/schemas:spirv_executable_def_c_fbs",
- "@com_google_absl//absl/strings",
"@com_google_absl//absl/types:span",
"@iree_vulkan_headers//:vulkan_headers",
"@vulkan_memory_allocator//:impl_header_only",
diff --git a/iree/hal/vulkan/CMakeLists.txt b/iree/hal/vulkan/CMakeLists.txt
index c6ece6e..ea53e18 100644
--- a/iree/hal/vulkan/CMakeLists.txt
+++ b/iree/hal/vulkan/CMakeLists.txt
@@ -74,7 +74,6 @@
::dynamic_symbols
Vulkan::Headers
absl::span
- absl::strings
iree::base
iree::base::core_headers
iree::base::internal
diff --git a/iree/hal/vulkan/vulkan_device.cc b/iree/hal/vulkan/vulkan_device.cc
index 11593c4..cc883a7 100644
--- a/iree/hal/vulkan/vulkan_device.cc
+++ b/iree/hal/vulkan/vulkan_device.cc
@@ -18,7 +18,6 @@
#include <utility>
#include <vector>
-#include "absl/strings/str_cat.h"
#include "iree/base/internal/math.h"
#include "iree/base/tracing.h"
#include "iree/hal/vulkan/api.h"
diff --git a/iree/modules/vmla/op_kernels_generic.h b/iree/modules/vmla/op_kernels_generic.h
index afaa1e1..827ae4a 100644
--- a/iree/modules/vmla/op_kernels_generic.h
+++ b/iree/modules/vmla/op_kernels_generic.h
@@ -18,6 +18,7 @@
#include <algorithm>
#include <array>
#include <cmath>
+#include <cstring>
#include <iostream>
#include <iterator>
#include <numeric>
diff --git a/iree/samples/custom_modules/BUILD b/iree/samples/custom_modules/BUILD
index 2e36741..2b16a06 100644
--- a/iree/samples/custom_modules/BUILD
+++ b/iree/samples/custom_modules/BUILD
@@ -57,7 +57,6 @@
"//iree/vm",
"//iree/vm:bytecode_module",
"//iree/vm:cc",
- "@com_google_absl//absl/strings",
],
)
diff --git a/iree/samples/custom_modules/CMakeLists.txt b/iree/samples/custom_modules/CMakeLists.txt
index ae4dc43..4765f55 100644
--- a/iree/samples/custom_modules/CMakeLists.txt
+++ b/iree/samples/custom_modules/CMakeLists.txt
@@ -38,7 +38,6 @@
DEPS
::custom_modules_test_module_cc
::native_module
- absl::strings
iree::base
iree::base::logging
iree::hal
diff --git a/iree/samples/custom_modules/custom_modules_test.cc b/iree/samples/custom_modules/custom_modules_test.cc
index b05572b..4cb00e0 100644
--- a/iree/samples/custom_modules/custom_modules_test.cc
+++ b/iree/samples/custom_modules/custom_modules_test.cc
@@ -14,7 +14,6 @@
// Tests that our bytecode module can call through into our native module.
-#include "absl/strings/string_view.h"
#include "iree/base/api.h"
#include "iree/base/logging.h"
#include "iree/hal/api.h"
@@ -85,12 +84,11 @@
iree_vm_instance_release(instance_);
}
- iree_vm_function_t LookupFunction(absl::string_view function_name) {
+ iree_vm_function_t LookupFunction(const char* function_name) {
iree_vm_function_t function;
IREE_CHECK_OK(bytecode_module_->lookup_function(
bytecode_module_->self, IREE_VM_FUNCTION_LINKAGE_EXPORT,
- iree_string_view_t{function_name.data(), function_name.size()},
- &function))
+ iree_make_cstring_view(function_name), &function))
<< "Exported function '" << function_name << "' not found";
return function;
}
diff --git a/iree/tools/BUILD b/iree/tools/BUILD
index b3bcab2..0183e34 100644
--- a/iree/tools/BUILD
+++ b/iree/tools/BUILD
@@ -39,7 +39,6 @@
"//iree/tools/utils:vm_util",
"//iree/vm",
"//iree/vm:bytecode_module",
- "@com_google_absl//absl/strings",
"@com_google_benchmark//:benchmark",
],
)
@@ -61,7 +60,6 @@
"//iree/testing:gtest",
"//iree/tools/utils:vm_util",
"//iree/vm:bytecode_module",
- "@com_google_absl//absl/strings",
],
)
@@ -252,7 +250,6 @@
"//iree/tools/utils:vm_util",
"//iree/vm",
"//iree/vm:bytecode_module",
- "@com_google_absl//absl/strings",
"@com_google_absl//absl/types:span",
"@llvm-project//llvm:Support",
"@llvm-project//mlir:IR",
diff --git a/iree/tools/CMakeLists.txt b/iree/tools/CMakeLists.txt
index 25720aa..2cbf5ab 100644
--- a/iree/tools/CMakeLists.txt
+++ b/iree/tools/CMakeLists.txt
@@ -63,7 +63,6 @@
SRCS
"iree-benchmark-module-main.cc"
DEPS
- absl::strings
benchmark
iree::base::internal::file_io
iree::base::internal::flags
@@ -124,7 +123,6 @@
SRCS
"iree-run-module-main.cc"
DEPS
- absl::strings
iree::base::internal::file_io
iree::base::internal::flags
iree::base::status
@@ -363,7 +361,6 @@
MLIRSupport
MLIRTargetLLVMIRExport
absl::span
- absl::strings
iree::base
iree::base::internal::flags
iree::base::status
diff --git a/iree/tools/android/run_module_app/src/main.cc b/iree/tools/android/run_module_app/src/main.cc
index cb9ebaa..68b957c 100644
--- a/iree/tools/android/run_module_app/src/main.cc
+++ b/iree/tools/android/run_module_app/src/main.cc
@@ -106,7 +106,7 @@
IREE_RETURN_IF_ERROR(LoadBytecodeModule(invocation.module, &input_module));
iree_hal_device_t* device = nullptr;
- IREE_RETURN_IF_ERROR(CreateDevice(invocation.driver, &device));
+ IREE_RETURN_IF_ERROR(CreateDevice(invocation.driver.c_str(), &device));
iree_vm_module_t* hal_module = nullptr;
IREE_RETURN_IF_ERROR(CreateHalModule(device, &hal_module));
diff --git a/iree/tools/iree-benchmark-module-main.cc b/iree/tools/iree-benchmark-module-main.cc
index b660a2d..f8af4bf 100644
--- a/iree/tools/iree-benchmark-module-main.cc
+++ b/iree/tools/iree-benchmark-module-main.cc
@@ -187,8 +187,7 @@
iree_vm_instance_create(iree_allocator_system(), &instance_));
// Create IREE's device and module.
- IREE_RETURN_IF_ERROR(
- iree::CreateDevice(std::string(FLAG_driver), &device_));
+ IREE_RETURN_IF_ERROR(iree::CreateDevice(FLAG_driver, &device_));
IREE_RETURN_IF_ERROR(CreateHalModule(device_, &hal_module_));
IREE_RETURN_IF_ERROR(LoadBytecodeModule(module_data_, &input_module_));
diff --git a/iree/tools/iree-check-module-main.cc b/iree/tools/iree-check-module-main.cc
index a2df8d3..6402406 100644
--- a/iree/tools/iree-check-module-main.cc
+++ b/iree/tools/iree-check-module-main.cc
@@ -14,8 +14,6 @@
#include <iostream>
-#include "absl/strings/match.h"
-#include "absl/strings/string_view.h"
#include "iree/base/api.h"
#include "iree/base/internal/file_io.h"
#include "iree/base/internal/flags.h"
@@ -103,7 +101,7 @@
IREE_RETURN_IF_ERROR(LoadBytecodeModule(module_data, &input_module));
iree_hal_device_t* device = nullptr;
- IREE_RETURN_IF_ERROR(CreateDevice(std::string(FLAG_driver), &device));
+ IREE_RETURN_IF_ERROR(CreateDevice(FLAG_driver, &device));
iree_vm_module_t* hal_module = nullptr;
IREE_RETURN_IF_ERROR(CreateHalModule(device, &hal_module));
iree_vm_module_t* check_module = nullptr;
@@ -115,21 +113,17 @@
for (iree_host_size_t ordinal = 0;
ordinal < module_signature.export_function_count; ++ordinal) {
iree_vm_function_t function;
- iree_string_view_t export_name_sv;
+ iree_string_view_t export_name;
IREE_RETURN_IF_ERROR(iree_vm_module_lookup_function_by_ordinal(
input_module, IREE_VM_FUNCTION_LINKAGE_EXPORT,
- ordinal, &function, &export_name_sv),
+ ordinal, &function, &export_name),
"looking up function export %zu", ordinal);
- // TODO(gcmn): Implicit conversion from iree to absl string view.
- auto export_name =
- absl::string_view(export_name_sv.data, export_name_sv.size);
-
- iree_string_view_t module_name_iree_sv = iree_vm_module_name(input_module);
- auto module_name =
- absl::string_view(module_name_iree_sv.data, module_name_iree_sv.size);
- if (absl::StartsWith(export_name, "__") ||
- export_name.find('$') != absl::string_view::npos) {
+ iree_string_view_t module_name = iree_vm_module_name(input_module);
+ if (iree_string_view_starts_with(export_name,
+ iree_make_cstring_view("__")) ||
+ iree_string_view_find_char(export_name, '$', 0) !=
+ IREE_STRING_VIEW_NPOS) {
// Skip internal or special functions.
continue;
}
@@ -153,12 +147,12 @@
return iree_make_status(IREE_STATUS_INVALID_ARGUMENT,
"expected function with no inputs or outputs, "
"but export '%.*s' has signature '%.*s'",
- (int)export_name.size(), export_name.data(),
+ (int)export_name.size, export_name.data,
(int)sig_f.size, sig_f.data);
}
::testing::RegisterTest(
- module_name.data(), export_name.data(), nullptr,
+ module_name.data, export_name.data, nullptr,
std::to_string(ordinal).c_str(), __FILE__, __LINE__,
[&instance, modules, function]() -> CheckModuleTest* {
return new CheckModuleTest(instance, modules, function);
diff --git a/iree/tools/iree-run-mlir-main.cc b/iree/tools/iree-run-mlir-main.cc
index 8746c9a..c0bd58c 100644
--- a/iree/tools/iree-run-mlir-main.cc
+++ b/iree/tools/iree-run-mlir-main.cc
@@ -39,8 +39,6 @@
#include <iostream>
#include <utility>
-#include "absl/strings/match.h"
-#include "absl/strings/string_view.h"
#include "absl/types/span.h"
#include "iree/base/api.h"
#include "iree/base/internal/flags.h"
@@ -259,10 +257,11 @@
Status EvaluateFunction(iree_vm_context_t* context,
iree_hal_allocator_t* allocator,
iree_vm_function_t function,
- absl::string_view export_name) {
+ iree_string_view_t export_name) {
IREE_TRACE_SCOPE();
- std::cout << "EXEC @" << export_name << std::endl;
+ std::cout << "EXEC @" << std::string(export_name.data, export_name.size)
+ << std::endl;
std::vector<RawSignatureParser::Description> input_descs;
IREE_RETURN_IF_ERROR(ParseInputSignature(function, &input_descs));
vm::ref<iree_vm_list_t> inputs;
@@ -293,7 +292,7 @@
// Evaluates all exported functions within given module.
Status EvaluateFunctions(iree_vm_instance_t* instance,
- absl::string_view driver_name,
+ const std::string& driver_name,
const std::string& flatbuffer_data) {
IREE_TRACE_SCOPE0("EvaluateFunctions");
@@ -313,21 +312,22 @@
}
iree_hal_device_t* device = nullptr;
- IREE_RETURN_IF_ERROR(CreateDevice(driver_name, &device));
+ IREE_RETURN_IF_ERROR(CreateDevice(driver_name.c_str(), &device));
iree_vm_module_t* hal_module = nullptr;
IREE_RETURN_IF_ERROR(CreateHalModule(device, &hal_module));
// Evaluate all exported functions.
auto run_function = [&](int ordinal) -> Status {
iree_vm_function_t function;
- iree_string_view_t export_name_isv;
+ iree_string_view_t export_name;
IREE_RETURN_IF_ERROR(iree_vm_module_lookup_function_by_ordinal(
bytecode_module, IREE_VM_FUNCTION_LINKAGE_EXPORT,
- ordinal, &function, &export_name_isv),
+ ordinal, &function, &export_name),
"Looking up function export %d", ordinal);
- absl::string_view export_name(export_name_isv.data, export_name_isv.size);
- if (absl::StartsWith(export_name, "__") ||
- export_name.find('$') != absl::string_view::npos) {
+ if (iree_string_view_starts_with(export_name,
+ iree_make_cstring_view("__")) ||
+ iree_string_view_find_char(export_name, '$', 0) !=
+ IREE_STRING_VIEW_NPOS) {
// Skip internal or special functions.
return OkStatus();
}
diff --git a/iree/tools/iree-run-module-main.cc b/iree/tools/iree-run-module-main.cc
index f4b5744..0ea23d7 100644
--- a/iree/tools/iree-run-module-main.cc
+++ b/iree/tools/iree-run-module-main.cc
@@ -14,7 +14,6 @@
#include <iostream>
-#include "absl/strings/string_view.h"
#include "iree/base/internal/file_io.h"
#include "iree/base/internal/flags.h"
#include "iree/base/status.h"
@@ -97,7 +96,7 @@
IREE_RETURN_IF_ERROR(LoadBytecodeModule(module_data, &input_module));
iree_hal_device_t* device = nullptr;
- IREE_RETURN_IF_ERROR(CreateDevice(std::string(FLAG_driver), &device));
+ IREE_RETURN_IF_ERROR(CreateDevice(FLAG_driver, &device));
iree_vm_module_t* hal_module = nullptr;
IREE_RETURN_IF_ERROR(CreateHalModule(device, &hal_module));
diff --git a/iree/tools/utils/vm_util.cc b/iree/tools/utils/vm_util.cc
index b43f243..5307af0 100644
--- a/iree/tools/utils/vm_util.cc
+++ b/iree/tools/utils/vm_util.cc
@@ -286,20 +286,17 @@
return OkStatus();
}
-Status CreateDevice(absl::string_view driver_name,
- iree_hal_device_t** out_device) {
+Status CreateDevice(const char* driver_name, iree_hal_device_t** out_device) {
IREE_LOG(INFO) << "Creating driver and device for '" << driver_name << "'...";
iree_hal_driver_t* driver = nullptr;
- IREE_RETURN_IF_ERROR(
- iree_hal_driver_registry_try_create_by_name(
- iree_hal_driver_registry_default(),
- iree_string_view_t{driver_name.data(), driver_name.size()},
- iree_allocator_system(), &driver),
- "creating driver '%.*s'", (int)driver_name.size(), driver_name.data());
+ IREE_RETURN_IF_ERROR(iree_hal_driver_registry_try_create_by_name(
+ iree_hal_driver_registry_default(),
+ iree_make_cstring_view(driver_name),
+ iree_allocator_system(), &driver),
+ "creating driver '%s'", driver_name);
IREE_RETURN_IF_ERROR(iree_hal_driver_create_default_device(
driver, iree_allocator_system(), out_device),
- "creating default device for driver '%.*s'",
- (int)driver_name.size(), driver_name.data());
+ "creating default device for driver '%s'", driver_name);
iree_hal_driver_release(driver);
return OkStatus();
}
diff --git a/iree/tools/utils/vm_util.h b/iree/tools/utils/vm_util.h
index 2b9bdc0..a55362f 100644
--- a/iree/tools/utils/vm_util.h
+++ b/iree/tools/utils/vm_util.h
@@ -79,8 +79,7 @@
// Creates the default device for |driver| in |out_device|.
// The returned |out_device| must be released by the caller.
-Status CreateDevice(absl::string_view driver_name,
- iree_hal_device_t** out_device);
+Status CreateDevice(const char* driver_name, iree_hal_device_t** out_device);
// Creates a hal module |driver| in |out_hal_module|.
// The returned |out_module| must be released by the caller.