Minor comment/style tweaks to the null HAL driver. (#18911)
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 11cf13c..6edcff5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS
@@ -32,7 +32,6 @@ # Experimental # It's experimental, but we still don't want any old directory added here. /experimental/ @benvanik @stellaraccident -/experimental/rocm/ @benvanik /experimental/web/ @ScottTodd /experimental/webgpu/ @benvanik @ScottTodd
diff --git a/runtime/src/iree/hal/drivers/null/README.md b/runtime/src/iree/hal/drivers/null/README.md index 3c3e420..3dcb62a 100644 --- a/runtime/src/iree/hal/drivers/null/README.md +++ b/runtime/src/iree/hal/drivers/null/README.md
@@ -17,8 +17,10 @@ `experimental/` folder if going in-tree. 1. Find/replace `{Null}` with the friendly name of your driver (e.g. `Vulkan`). 1. Find/replace `_null_` with the C name of your driver (e.g. `vulkan`). +1. Find/replace `_NULL_` with the upper C name of your driver (e.g. `VULKAN`). 1. Find/replace `// TODO(null):` with your github ID, your driver name, or a GitHub issue number tracking driver creation (e.g. `// TODO(#1234):`). +1. Find/replace `iree/hal/drivers/null/` with your source path. ## Build Setup
diff --git a/runtime/src/iree/hal/drivers/null/allocator.c b/runtime/src/iree/hal/drivers/null/allocator.c index f84f002..e1c91ce 100644 --- a/runtime/src/iree/hal/drivers/null/allocator.c +++ b/runtime/src/iree/hal/drivers/null/allocator.c
@@ -8,6 +8,10 @@ #include "iree/hal/drivers/null/buffer.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_allocator_t +//===----------------------------------------------------------------------===// + // TODO(null): use one ID per address space or pool - each shows as a different // track in tracing tools. #if IREE_TRACING_FEATURES & IREE_TRACING_FEATURE_ALLOCATION_TRACKING @@ -33,6 +37,7 @@ iree_allocator_t host_allocator, iree_hal_allocator_t** out_allocator) { IREE_ASSERT_ARGUMENT(out_allocator); IREE_TRACE_ZONE_BEGIN(z0); + *out_allocator = NULL; iree_hal_null_allocator_t* allocator = NULL; IREE_RETURN_AND_END_ZONE_IF_ERROR(
diff --git a/runtime/src/iree/hal/drivers/null/allocator.h b/runtime/src/iree/hal/drivers/null/allocator.h index c0286ba..299c9c9 100644 --- a/runtime/src/iree/hal/drivers/null/allocator.h +++ b/runtime/src/iree/hal/drivers/null/allocator.h
@@ -10,6 +10,10 @@ #include "iree/base/api.h" #include "iree/hal/api.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_allocator_t +//===----------------------------------------------------------------------===// + // Creates a {Null} buffer allocator used for persistent allocations. iree_status_t iree_hal_null_allocator_create( iree_allocator_t host_allocator, iree_hal_allocator_t** out_allocator);
diff --git a/runtime/src/iree/hal/drivers/null/buffer.c b/runtime/src/iree/hal/drivers/null/buffer.c index f6eeecb..6e67652 100644 --- a/runtime/src/iree/hal/drivers/null/buffer.c +++ b/runtime/src/iree/hal/drivers/null/buffer.c
@@ -6,6 +6,10 @@ #include "iree/hal/drivers/null/buffer.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_buffer_t +//===----------------------------------------------------------------------===// + typedef struct iree_hal_null_buffer_t { iree_hal_buffer_t base; iree_hal_buffer_release_callback_t release_callback; @@ -33,8 +37,8 @@ iree_hal_buffer_release_callback_t release_callback, iree_allocator_t host_allocator, iree_hal_buffer_t** out_buffer) { IREE_ASSERT_ARGUMENT(out_buffer); - *out_buffer = NULL; IREE_TRACE_ZONE_BEGIN(z0); + *out_buffer = NULL; iree_hal_null_buffer_t* buffer = NULL; IREE_RETURN_AND_END_ZONE_IF_ERROR(
diff --git a/runtime/src/iree/hal/drivers/null/buffer.h b/runtime/src/iree/hal/drivers/null/buffer.h index 7e492f4..edf2e45 100644 --- a/runtime/src/iree/hal/drivers/null/buffer.h +++ b/runtime/src/iree/hal/drivers/null/buffer.h
@@ -10,6 +10,10 @@ #include "iree/base/api.h" #include "iree/hal/api.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_buffer_t +//===----------------------------------------------------------------------===// + // Wraps a {Null} allocation in an iree_hal_buffer_t. iree_status_t iree_hal_null_buffer_wrap( iree_hal_allocator_t* allocator, iree_hal_memory_type_t memory_type,
diff --git a/runtime/src/iree/hal/drivers/null/channel.c b/runtime/src/iree/hal/drivers/null/channel.c index 195c3d5..0d2915b 100644 --- a/runtime/src/iree/hal/drivers/null/channel.c +++ b/runtime/src/iree/hal/drivers/null/channel.c
@@ -6,6 +6,10 @@ #include "iree/hal/drivers/null/channel.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_channel_t +//===----------------------------------------------------------------------===// + typedef struct iree_hal_null_channel_t { iree_hal_resource_t resource; iree_allocator_t host_allocator; @@ -34,8 +38,8 @@ iree_allocator_t host_allocator, iree_hal_channel_t** out_channel) { IREE_ASSERT_ARGUMENT(out_channel); - *out_channel = NULL; IREE_TRACE_ZONE_BEGIN(z0); + *out_channel = NULL; iree_hal_null_channel_t* channel = NULL; IREE_RETURN_AND_END_ZONE_IF_ERROR(
diff --git a/runtime/src/iree/hal/drivers/null/channel.h b/runtime/src/iree/hal/drivers/null/channel.h index 83c4ef1..efa7c10 100644 --- a/runtime/src/iree/hal/drivers/null/channel.h +++ b/runtime/src/iree/hal/drivers/null/channel.h
@@ -10,6 +10,10 @@ #include "iree/base/api.h" #include "iree/hal/api.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_channel_t +//===----------------------------------------------------------------------===// + // Creates a {Null} HAL collective channel using the given |params|. iree_status_t iree_hal_null_channel_create(iree_hal_channel_params_t params, iree_allocator_t host_allocator,
diff --git a/runtime/src/iree/hal/drivers/null/command_buffer.c b/runtime/src/iree/hal/drivers/null/command_buffer.c index 9d474d4..4f8fe82 100644 --- a/runtime/src/iree/hal/drivers/null/command_buffer.c +++ b/runtime/src/iree/hal/drivers/null/command_buffer.c
@@ -10,6 +10,10 @@ #include "iree/hal/drivers/null/channel.h" #include "iree/hal/drivers/null/executable.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_command_buffer_t +//===----------------------------------------------------------------------===// + typedef struct iree_hal_null_command_buffer_t { iree_hal_command_buffer_t base; iree_allocator_t host_allocator; @@ -31,8 +35,8 @@ iree_allocator_t host_allocator, iree_hal_command_buffer_t** out_command_buffer) { IREE_ASSERT_ARGUMENT(out_command_buffer); - *out_command_buffer = NULL; IREE_TRACE_ZONE_BEGIN(z0); + *out_command_buffer = NULL; iree_hal_null_command_buffer_t* command_buffer = NULL; IREE_RETURN_AND_END_ZONE_IF_ERROR(
diff --git a/runtime/src/iree/hal/drivers/null/command_buffer.h b/runtime/src/iree/hal/drivers/null/command_buffer.h index cca9236..d8ab61d 100644 --- a/runtime/src/iree/hal/drivers/null/command_buffer.h +++ b/runtime/src/iree/hal/drivers/null/command_buffer.h
@@ -10,6 +10,10 @@ #include "iree/base/api.h" #include "iree/hal/api.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_command_buffer_t +//===----------------------------------------------------------------------===// + // Creates {Null} command buffer. iree_status_t iree_hal_null_command_buffer_create( iree_hal_allocator_t* device_allocator, iree_hal_command_buffer_mode_t mode,
diff --git a/runtime/src/iree/hal/drivers/null/device.c b/runtime/src/iree/hal/drivers/null/device.c index aaa7b15..ce12240 100644 --- a/runtime/src/iree/hal/drivers/null/device.c +++ b/runtime/src/iree/hal/drivers/null/device.c
@@ -17,6 +17,10 @@ #include "iree/hal/utils/file_transfer.h" #include "iree/hal/utils/memory_file.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_device_t +//===----------------------------------------------------------------------===// + typedef struct iree_hal_null_device_t { iree_hal_resource_t resource; iree_string_view_t identifier; @@ -60,8 +64,8 @@ iree_allocator_t host_allocator, iree_hal_device_t** out_device) { IREE_ASSERT_ARGUMENT(options); IREE_ASSERT_ARGUMENT(out_device); - *out_device = NULL; IREE_TRACE_ZONE_BEGIN(z0); + *out_device = NULL; // Verify the parameters prior to creating resources. IREE_RETURN_AND_END_ZONE_IF_ERROR(
diff --git a/runtime/src/iree/hal/drivers/null/device.h b/runtime/src/iree/hal/drivers/null/device.h index aa70db6..1897866 100644 --- a/runtime/src/iree/hal/drivers/null/device.h +++ b/runtime/src/iree/hal/drivers/null/device.h
@@ -10,6 +10,10 @@ #include "iree/base/api.h" #include "iree/hal/api.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_device_t +//===----------------------------------------------------------------------===// + // NOTE: nothing in the skeleton implementation. Device creation and adoption is // part of the public API header. This header can contain internal types and // functions.
diff --git a/runtime/src/iree/hal/drivers/null/driver.c b/runtime/src/iree/hal/drivers/null/driver.c index 94be18a..78cf511 100644 --- a/runtime/src/iree/hal/drivers/null/driver.c +++ b/runtime/src/iree/hal/drivers/null/driver.c
@@ -8,6 +8,10 @@ #include "iree/hal/drivers/null/api.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_driver_t +//===----------------------------------------------------------------------===// + // TODO(null): if it's possible to have more than one device use real IDs. // This is a placeholder for this skeleton that just indicates the first and // only device. @@ -57,8 +61,8 @@ iree_allocator_t host_allocator, iree_hal_driver_t** out_driver) { IREE_ASSERT_ARGUMENT(options); IREE_ASSERT_ARGUMENT(out_driver); - *out_driver = NULL; IREE_TRACE_ZONE_BEGIN(z0); + *out_driver = NULL; // TODO(null): verify options; this may be moved after any libraries are // loaded so the verification can use underlying implementation queries.
diff --git a/runtime/src/iree/hal/drivers/null/driver.h b/runtime/src/iree/hal/drivers/null/driver.h index 84b12c1..1938778 100644 --- a/runtime/src/iree/hal/drivers/null/driver.h +++ b/runtime/src/iree/hal/drivers/null/driver.h
@@ -10,6 +10,10 @@ #include "iree/base/api.h" #include "iree/hal/api.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_driver_t +//===----------------------------------------------------------------------===// + // NOTE: nothing in the skeleton implementation. Driver creation and adoption is // part of the public API header. This header can contain internal types and // functions.
diff --git a/runtime/src/iree/hal/drivers/null/event.c b/runtime/src/iree/hal/drivers/null/event.c index 5f1e413..fabbe45 100644 --- a/runtime/src/iree/hal/drivers/null/event.c +++ b/runtime/src/iree/hal/drivers/null/event.c
@@ -6,6 +6,10 @@ #include "iree/hal/drivers/null/event.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_event_t +//===----------------------------------------------------------------------===// + typedef struct iree_hal_null_event_t { iree_hal_resource_t resource; iree_allocator_t host_allocator; @@ -23,8 +27,8 @@ iree_hal_queue_affinity_t queue_affinity, iree_hal_event_flags_t flags, iree_allocator_t host_allocator, iree_hal_event_t** out_event) { IREE_ASSERT_ARGUMENT(out_event); - *out_event = NULL; IREE_TRACE_ZONE_BEGIN(z0); + *out_event = NULL; iree_hal_null_event_t* event = NULL; IREE_RETURN_AND_END_ZONE_IF_ERROR(
diff --git a/runtime/src/iree/hal/drivers/null/event.h b/runtime/src/iree/hal/drivers/null/event.h index 68c11f4..ca7f364 100644 --- a/runtime/src/iree/hal/drivers/null/event.h +++ b/runtime/src/iree/hal/drivers/null/event.h
@@ -10,6 +10,10 @@ #include "iree/base/api.h" #include "iree/hal/api.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_event_t +//===----------------------------------------------------------------------===// + // WIP API and may change. Mostly ignored for now. iree_status_t iree_hal_null_event_create( iree_hal_queue_affinity_t queue_affinity, iree_hal_event_flags_t flags,
diff --git a/runtime/src/iree/hal/drivers/null/executable.c b/runtime/src/iree/hal/drivers/null/executable.c index a90d697..3301d6c 100644 --- a/runtime/src/iree/hal/drivers/null/executable.c +++ b/runtime/src/iree/hal/drivers/null/executable.c
@@ -6,6 +6,10 @@ #include "iree/hal/drivers/null/executable.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_executable_t +//===----------------------------------------------------------------------===// + typedef struct iree_hal_null_executable_t { iree_hal_resource_t resource; iree_allocator_t host_allocator; @@ -24,8 +28,8 @@ iree_allocator_t host_allocator, iree_hal_executable_t** out_executable) { IREE_ASSERT_ARGUMENT(executable_params); IREE_ASSERT_ARGUMENT(out_executable); - *out_executable = NULL; IREE_TRACE_ZONE_BEGIN(z0); + *out_executable = NULL; // Allocate storage for the executable and its associated data structures. iree_hal_null_executable_t* executable = NULL;
diff --git a/runtime/src/iree/hal/drivers/null/executable.h b/runtime/src/iree/hal/drivers/null/executable.h index 0107e1a..0ae87ae 100644 --- a/runtime/src/iree/hal/drivers/null/executable.h +++ b/runtime/src/iree/hal/drivers/null/executable.h
@@ -10,6 +10,10 @@ #include "iree/base/api.h" #include "iree/hal/api.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_executable_t +//===----------------------------------------------------------------------===// + // Creates a {Null} executable from a binary in memory. Each executable may // contain multiple entry points and be composed of several modules presented to // the HAL as a single instance. See iree_hal_executable_params_t for more
diff --git a/runtime/src/iree/hal/drivers/null/executable_cache.c b/runtime/src/iree/hal/drivers/null/executable_cache.c index d4f0ad6..a7c6f4b 100644 --- a/runtime/src/iree/hal/drivers/null/executable_cache.c +++ b/runtime/src/iree/hal/drivers/null/executable_cache.c
@@ -8,6 +8,10 @@ #include "iree/hal/drivers/null/executable.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_executable_cache_t +//===----------------------------------------------------------------------===// + typedef struct iree_hal_null_executable_cache_t { iree_hal_resource_t resource; iree_allocator_t host_allocator; @@ -26,8 +30,8 @@ iree_string_view_t identifier, iree_allocator_t host_allocator, iree_hal_executable_cache_t** out_executable_cache) { IREE_ASSERT_ARGUMENT(out_executable_cache); - *out_executable_cache = NULL; IREE_TRACE_ZONE_BEGIN(z0); + *out_executable_cache = NULL; iree_hal_null_executable_cache_t* executable_cache = NULL; IREE_RETURN_AND_END_ZONE_IF_ERROR(
diff --git a/runtime/src/iree/hal/drivers/null/executable_cache.h b/runtime/src/iree/hal/drivers/null/executable_cache.h index 519b8c0..b4af9e7 100644 --- a/runtime/src/iree/hal/drivers/null/executable_cache.h +++ b/runtime/src/iree/hal/drivers/null/executable_cache.h
@@ -10,6 +10,10 @@ #include "iree/base/api.h" #include "iree/hal/api.h" +//===----------------------------------------------------------------------===// +// iree_hal_null_executable_cache_t +//===----------------------------------------------------------------------===// + // Creates a no-op executable cache that does not cache at all. // This is useful to isolate pipeline caching behavior and verify compilation // behavior.
diff --git a/runtime/src/iree/hal/drivers/null/semaphore.c b/runtime/src/iree/hal/drivers/null/semaphore.c index 25ec7dc..b397c85 100644 --- a/runtime/src/iree/hal/drivers/null/semaphore.c +++ b/runtime/src/iree/hal/drivers/null/semaphore.c
@@ -29,8 +29,8 @@ uint64_t initial_value, iree_hal_semaphore_flags_t flags, iree_allocator_t host_allocator, iree_hal_semaphore_t** out_semaphore) { IREE_ASSERT_ARGUMENT(out_semaphore); - *out_semaphore = NULL; IREE_TRACE_ZONE_BEGIN(z0); + *out_semaphore = NULL; iree_hal_null_semaphore_t* semaphore = NULL; IREE_RETURN_AND_END_ZONE_IF_ERROR(