Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump IREE to eff06715692fe9642e4b8902e3dbc843c375218b #979

Merged
merged 5 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions runtime/src/iree-amd-aie/driver/xrt-lite/allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,14 @@ static iree_status_t iree_hal_xrt_lite_allocator_allocate_buffer(
shim_xdna::bo* bo =
allocator->shim_device->alloc_bo(allocation_size, flags).release();
iree_hal_buffer_t* buffer = nullptr;
const iree_hal_buffer_placement_t placement = {
.queue_affinity = params->queue_affinity ? params->queue_affinity
: IREE_HAL_QUEUE_AFFINITY_ANY,
.flags = IREE_HAL_BUFFER_PLACEMENT_FLAG_NONE,
};
iree_status_t status = iree_hal_xrt_lite_buffer_wrap(
bo, reinterpret_cast<iree_hal_allocator_t*>(allocator),
compat_params.type, compat_params.access, compat_params.usage,
allocation_size,
bo, placement, compat_params.type, compat_params.access,
compat_params.usage, allocation_size,
/*byte_offset=*/0, /*byte_length=*/allocation_size,
iree_hal_buffer_release_callback_null(), allocator->host_allocator,
&buffer);
Expand Down
11 changes: 6 additions & 5 deletions runtime/src/iree-amd-aie/driver/xrt-lite/buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ extern const iree_hal_buffer_vtable_t iree_hal_xrt_lite_buffer_vtable;
struct iree_hal_xrt_lite_buffer {
iree_hal_buffer_t base;
shim_xdna::bo* bo;
iree_allocator_t host_allocator;
iree_hal_buffer_release_callback_t release_callback;
};

Expand Down Expand Up @@ -111,7 +112,7 @@ static iree_status_t iree_hal_xrt_lite_buffer_unmap_range(
}

iree_status_t iree_hal_xrt_lite_buffer_wrap(
shim_xdna::bo* bo, iree_hal_allocator_t* allocator,
shim_xdna::bo* bo, iree_hal_buffer_placement_t placement,
iree_hal_memory_type_t memory_type, iree_hal_memory_access_t allowed_access,
iree_hal_buffer_usage_t allowed_usage, iree_device_size_t allocation_size,
iree_device_size_t byte_offset, iree_device_size_t byte_length,
Expand All @@ -125,9 +126,9 @@ iree_status_t iree_hal_xrt_lite_buffer_wrap(
IREE_RETURN_AND_END_ZONE_IF_ERROR(
z0, iree_allocator_malloc(host_allocator, sizeof(*buffer),
reinterpret_cast<void**>(&buffer)));
iree_hal_buffer_initialize(host_allocator, allocator, &buffer->base,
allocation_size, byte_offset, byte_length,
memory_type, allowed_access, allowed_usage,
iree_hal_buffer_initialize(placement, &buffer->base, allocation_size,
byte_offset, byte_length, memory_type,
allowed_access, allowed_usage,
&iree_hal_xrt_lite_buffer_vtable, &buffer->base);
buffer->release_callback = release_callback;
buffer->bo = bo;
Expand All @@ -142,7 +143,7 @@ static void iree_hal_xrt_lite_buffer_destroy(iree_hal_buffer_t* base_buffer) {
base_buffer, iree_hal_xrt_lite_buffer_vtable, iree_hal_xrt_lite_buffer);
IREE_TRACE_ZONE_BEGIN(z0);

iree_allocator_t host_allocator = base_buffer->host_allocator;
iree_allocator_t host_allocator = buffer->host_allocator;
if (buffer->release_callback.fn) {
buffer->release_callback.fn(buffer->release_callback.user_data,
base_buffer);
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/iree-amd-aie/driver/xrt-lite/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "iree/hal/api.h"

iree_status_t iree_hal_xrt_lite_buffer_wrap(
shim_xdna::bo* bo, iree_hal_allocator_t* allocator,
shim_xdna::bo* bo, iree_hal_buffer_placement_t placement,
iree_hal_memory_type_t memory_type, iree_hal_memory_access_t allowed_access,
iree_hal_buffer_usage_t allowed_usage, iree_device_size_t allocation_size,
iree_device_size_t byte_offset, iree_device_size_t byte_length,
Expand Down
10 changes: 8 additions & 2 deletions runtime/src/iree-amd-aie/driver/xrt/direct_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,18 @@ static iree_status_t iree_hal_xrt_allocator_allocate_buffer(
}

iree_hal_buffer_t* buffer = nullptr;
const iree_hal_buffer_placement_t placement = {
.queue_affinity = params->queue_affinity ? params->queue_affinity
: IREE_HAL_QUEUE_AFFINITY_ANY,
.flags = IREE_HAL_BUFFER_PLACEMENT_FLAG_NONE,
};
if (iree_status_is_ok(status)) {
status = iree_hal_xrt_buffer_wrap(
xrt_buffer.release(), base_allocator, compat_params.type,
xrt_buffer.release(), placement, compat_params.type,
compat_params.access, compat_params.usage, allocation_size,
/*byte_offset=*/0, /*byte_length=*/allocation_size,
iree_hal_buffer_release_callback_null(), &buffer);
iree_hal_buffer_release_callback_null(), allocator->host_allocator,
&buffer);
}

if (iree_status_is_ok(status)) {
Expand Down
16 changes: 7 additions & 9 deletions runtime/src/iree-amd-aie/driver/xrt/xrt_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
typedef struct iree_hal_xrt_buffer_t {
iree_hal_buffer_t base;
xrt::bo* buffer;
iree_allocator_t host_allocator;
iree_hal_buffer_release_callback_t release_callback;
} iree_hal_xrt_buffer_t;

Expand All @@ -33,25 +34,22 @@ static const iree_hal_xrt_buffer_t* iree_hal_xrt_buffer_const_cast(
}

iree_status_t iree_hal_xrt_buffer_wrap(
xrt::bo* xrt_buffer, iree_hal_allocator_t* allocator,
xrt::bo* xrt_buffer, iree_hal_buffer_placement_t placement,
iree_hal_memory_type_t memory_type, iree_hal_memory_access_t allowed_access,
iree_hal_buffer_usage_t allowed_usage, iree_device_size_t allocation_size,
iree_device_size_t byte_offset, iree_device_size_t byte_length,
iree_hal_buffer_release_callback_t release_callback,
iree_hal_buffer_t** out_buffer) {
IREE_ASSERT_ARGUMENT(allocator);
iree_allocator_t host_allocator, iree_hal_buffer_t** out_buffer) {
IREE_ASSERT_ARGUMENT(out_buffer);
IREE_TRACE_ZONE_BEGIN(z0);

iree_allocator_t host_allocator =
iree_hal_allocator_host_allocator(allocator);
iree_hal_xrt_buffer_t* buffer = nullptr;
IREE_RETURN_AND_END_ZONE_IF_ERROR(
z0,
iree_allocator_malloc(host_allocator, sizeof(*buffer), (void**)&buffer));
iree_hal_buffer_initialize(host_allocator, allocator, &buffer->base,
allocation_size, byte_offset, byte_length,
memory_type, allowed_access, allowed_usage,
iree_hal_buffer_initialize(placement, &buffer->base, allocation_size,
byte_offset, byte_length, memory_type,
allowed_access, allowed_usage,
&iree_hal_xrt_buffer_vtable, &buffer->base);
buffer->buffer = xrt_buffer;
buffer->release_callback = release_callback;
Expand All @@ -62,7 +60,7 @@ iree_status_t iree_hal_xrt_buffer_wrap(

static void iree_hal_xrt_buffer_destroy(iree_hal_buffer_t* base_buffer) {
iree_hal_xrt_buffer_t* buffer = iree_hal_xrt_buffer_cast(base_buffer);
iree_allocator_t host_allocator = base_buffer->host_allocator;
iree_allocator_t host_allocator = buffer->host_allocator;
IREE_TRACE_ZONE_BEGIN(z0);
IREE_TRACE_ZONE_APPEND_VALUE_I64(
z0, (int64_t)iree_hal_buffer_allocation_size(base_buffer));
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/iree-amd-aie/driver/xrt/xrt_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ extern "C" {
// Wraps a XRT allocation in an iree_hal_buffer_t by retaining |xrt_buffer|.
// |out_buffer| must be released by the caller (see iree_hal_buffer_release).
iree_status_t iree_hal_xrt_buffer_wrap(
xrt::bo* xrt_buffer, iree_hal_allocator_t* allocator,
xrt::bo* xrt_buffer, iree_hal_buffer_placement_t placement,
iree_hal_memory_type_t memory_type, iree_hal_memory_access_t allowed_access,
iree_hal_buffer_usage_t allowed_usage, iree_device_size_t allocation_size,
iree_device_size_t byte_offset, iree_device_size_t byte_length,
iree_hal_buffer_release_callback_t release_callback,
iree_hal_buffer_t** out_buffer);
iree_allocator_t host_allocator, iree_hal_buffer_t** out_buffer);

// Returns the underlying XRT buffer handle for the given |buffer|.
xrt::bo* iree_hal_xrt_buffer_handle(const iree_hal_buffer_t* buffer);
Expand Down
2 changes: 1 addition & 1 deletion third_party/iree
Submodule iree updated 370 files
Loading