Removing some IREE_RETURN_AND_END_ZONE_IF_ERROR usage that was ugly. Having an unconditional error used with IF_ERROR read odd, and obscuring the trace zone end + return makes it harder to skim the functions.
diff --git a/runtime/src/iree/base/tracing.h b/runtime/src/iree/base/tracing.h index e0c339a..c0fbed9 100644 --- a/runtime/src/iree/base/tracing.h +++ b/runtime/src/iree/base/tracing.h
@@ -165,14 +165,14 @@ //===----------------------------------------------------------------------===// // Matches Tracy's PlotFormatType enum. -enum { +typedef enum { // Values will be displayed as plain numbers. IREE_TRACING_PLOT_TYPE_NUMBER = 0, // Treats the values as memory sizes. Will display kilobytes, megabytes, etc. IREE_TRACING_PLOT_TYPE_MEMORY = 1, // Values will be displayed as percentage with value 100 being equal to 100%. IREE_TRACING_PLOT_TYPE_PERCENTAGE = 2, -}; +} iree_tracing_plot_type_t; // Colors used for messages based on the level provided to the macro. enum {
diff --git a/runtime/src/iree/hal/utils/fd_file.c b/runtime/src/iree/hal/utils/fd_file.c index 6941e2e..a502c1b 100644 --- a/runtime/src/iree/hal/utils/fd_file.c +++ b/runtime/src/iree/hal/utils/fd_file.c
@@ -223,17 +223,16 @@ // Verify that the requested access can be satisfied. if (iree_all_bits_set(access, IREE_HAL_MEMORY_ACCESS_READ) && !iree_all_bits_set(allowed_access, IREE_HAL_MEMORY_ACCESS_READ)) { - IREE_RETURN_AND_END_ZONE_IF_ERROR( - z0, - iree_make_status( - IREE_STATUS_PERMISSION_DENIED, - "read access requested on a file descriptor that is not readable")); + IREE_TRACE_ZONE_END(z0); + return iree_make_status( + IREE_STATUS_PERMISSION_DENIED, + "read access requested on a file descriptor that is not readable"); } else if (iree_all_bits_set(access, IREE_HAL_MEMORY_ACCESS_WRITE) && !iree_all_bits_set(allowed_access, IREE_HAL_MEMORY_ACCESS_WRITE)) { - IREE_RETURN_AND_END_ZONE_IF_ERROR( - z0, iree_make_status(IREE_STATUS_PERMISSION_DENIED, - "write access requested on a file descriptor that " - "is not writable")); + IREE_TRACE_ZONE_END(z0); + return iree_make_status(IREE_STATUS_PERMISSION_DENIED, + "write access requested on a file descriptor that " + "is not writable"); } // Allocate object that retains the underlying file handle and our opened
diff --git a/runtime/src/iree/io/formats/irpa/irpa_builder.c b/runtime/src/iree/io/formats/irpa/irpa_builder.c index 330691f..e1459e8 100644 --- a/runtime/src/iree/io/formats/irpa/irpa_builder.c +++ b/runtime/src/iree/io/formats/irpa/irpa_builder.c
@@ -189,10 +189,10 @@ break; } default: { - IREE_RETURN_AND_END_ZONE_IF_ERROR( - z0, iree_make_status(IREE_STATUS_INVALID_ARGUMENT, - "unhandled entry type %d", - (int)source_entry->type)); + IREE_TRACE_ZONE_END(z0); + return iree_make_status(IREE_STATUS_INVALID_ARGUMENT, + "unhandled entry type %d", + (int)source_entry->type); } }
diff --git a/runtime/src/iree/io/memory_stream.c b/runtime/src/iree/io/memory_stream.c index 84043c0..f16d300 100644 --- a/runtime/src/iree/io/memory_stream.c +++ b/runtime/src/iree/io/memory_stream.c
@@ -199,15 +199,14 @@ z0, iree_io_stream_validate_fixed_range(stream->offset, stream->length, buffer_capacity, &read_length)); if (!out_buffer_length && read_length != buffer_capacity) { - IREE_RETURN_AND_END_ZONE_IF_ERROR( - z0, - iree_make_status(IREE_STATUS_OUT_OF_RANGE, - "read of range [%" PRIu64 ", %" PRIu64 ") (%" PRIu64 - " bytes) out of range; stream offset %" PRIu64 - " and length %" PRIu64 " insufficient", - stream->offset, stream->offset + buffer_capacity, - (iree_io_stream_pos_t)buffer_capacity, stream->offset, - stream->length)); + IREE_TRACE_ZONE_END(z0); + return iree_make_status(IREE_STATUS_OUT_OF_RANGE, + "read of range [%" PRIu64 ", %" PRIu64 ") (%" PRIu64 + " bytes) out of range; stream offset %" PRIu64 + " and length %" PRIu64 " insufficient", + stream->offset, stream->offset + buffer_capacity, + (iree_io_stream_pos_t)buffer_capacity, + stream->offset, stream->length); } memcpy(buffer, stream->contents + stream->offset,
diff --git a/runtime/src/iree/tooling/context_util.c b/runtime/src/iree/tooling/context_util.c index f088ee8..8dbd959 100644 --- a/runtime/src/iree/tooling/context_util.c +++ b/runtime/src/iree/tooling/context_util.c
@@ -66,10 +66,10 @@ } else if (strcmp(FLAG_module_mode, "preload") == 0) { read_flags |= IREE_FILE_READ_FLAG_PRELOAD; } else { - IREE_RETURN_AND_END_ZONE_IF_ERROR( - z0, iree_make_status(IREE_STATUS_INVALID_ARGUMENT, - "unrecognized --module_mode= value '%s'", - FLAG_module_mode)); + IREE_TRACE_ZONE_END(z0); + return iree_make_status(IREE_STATUS_INVALID_ARGUMENT, + "unrecognized --module_mode= value '%s'", + FLAG_module_mode); } IREE_RETURN_AND_END_ZONE_IF_ERROR( z0, iree_file_read_contents(path_str, read_flags, host_allocator,