From ad51d0f6e9ff95011388f09f43e1f7c79f23f963 Mon Sep 17 00:00:00 2001 From: Marius Brehler Date: Wed, 25 Oct 2023 18:55:53 +0200 Subject: [PATCH] Integrate IREE at openxla/iree@bb51f6f (#285) Updates IREE usage to match openxla/iree@bb51f6f and candidate-20231004.665, respectively. This furthermore adjust `C_FLAGS` to not fail on warnings. --- CMakeLists.txt | 8 ++++++++ iree-release-link.txt | 2 +- requirements-compiler.txt | 2 +- requirements-tools.txt | 4 ++-- samples/simple_embedding/simple_embedding_float.c | 8 ++++---- samples/simple_embedding/simple_embedding_int.c | 8 ++++---- samples/simple_vec_mul/simple_mul_int.c | 8 ++++---- samples/static_library/static_library_demo.c | 8 ++++---- samples/vision_inference/static_library_mnist.c | 4 ++-- third_party/iree | 2 +- 10 files changed, 31 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 161a532..8650545 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,6 +87,14 @@ endif() # Set executable suffix to elf set(CMAKE_EXECUTABLE_SUFFIX ".elf") +# IREE_DEFAULT_COPTS sets `-Wall` in combination with `-Werror` which +# currently breaks the build with GCC. This disables specific warnings. +# TODO: Re-enable these warning. +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-char-subscripts") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-implicit-function-declaration") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-variable") + #------------------------------------------------------------------------------- # Utility definitions #------------------------------------------------------------------------------- diff --git a/iree-release-link.txt b/iree-release-link.txt index d6b6957..42cf1f9 100644 --- a/iree-release-link.txt +++ b/iree-release-link.txt @@ -1 +1 @@ -https://github.com/openxla/iree/releases/download/candidate-20230815.614/iree-dist-20230815.614-linux-x86_64.tar.xz +https://github.com/openxla/iree/releases/download/candidate-20231004.665/iree-dist-20231004.665-linux-x86_64.tar.xz diff --git a/requirements-compiler.txt b/requirements-compiler.txt index 4d7e64e..8d61fce 100644 --- a/requirements-compiler.txt +++ b/requirements-compiler.txt @@ -1,4 +1,4 @@ # SPDX-FileCopyrightText: 2023 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. # SPDX-License-Identifier: CC0-1.0 -f https://openxla.github.io/iree/pip-release-links.html -iree-compiler==20230815.614 +iree-compiler==20231004.665 diff --git a/requirements-tools.txt b/requirements-tools.txt index 101cd8e..abb98c0 100644 --- a/requirements-tools.txt +++ b/requirements-tools.txt @@ -1,5 +1,5 @@ # SPDX-FileCopyrightText: 2022 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. # SPDX-License-Identifier: CC0-1.0 -f https://openxla.github.io/iree/pip-release-links.html -iree-tools-tf==20230815.614 -iree-tools-tflite==20230815.614 +iree-tools-tf==20231004.665 +iree-tools-tflite==20231004.665 diff --git a/samples/simple_embedding/simple_embedding_float.c b/samples/simple_embedding/simple_embedding_float.c index 38560fa..1ea23d3 100644 --- a/samples/simple_embedding/simple_embedding_float.c +++ b/samples/simple_embedding/simple_embedding_float.c @@ -78,16 +78,16 @@ iree_status_t Run() { iree_hal_dim_t shape[1] = {IREE_ARRAYSIZE(kFloat4)}; iree_hal_buffer_view_t* arg0_buffer_view = NULL; iree_hal_buffer_view_t* arg1_buffer_view = NULL; - IREE_RETURN_IF_ERROR(iree_hal_buffer_view_allocate_buffer( - iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, + IREE_RETURN_IF_ERROR(iree_hal_buffer_view_allocate_buffer_copy( + device, iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, IREE_HAL_ELEMENT_TYPE_FLOAT_32, IREE_HAL_ENCODING_TYPE_DENSE_ROW_MAJOR, (iree_hal_buffer_params_t){ .type = IREE_HAL_MEMORY_TYPE_DEVICE_LOCAL, .usage = IREE_HAL_BUFFER_USAGE_DEFAULT, }, iree_make_const_byte_span(kFloat4, sizeof(kFloat4)), &arg0_buffer_view)); - IREE_RETURN_IF_ERROR(iree_hal_buffer_view_allocate_buffer( - iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, + IREE_RETURN_IF_ERROR(iree_hal_buffer_view_allocate_buffer_copy( + device, iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, IREE_HAL_ELEMENT_TYPE_FLOAT_32, IREE_HAL_ENCODING_TYPE_DENSE_ROW_MAJOR, (iree_hal_buffer_params_t){ .type = IREE_HAL_MEMORY_TYPE_DEVICE_LOCAL, diff --git a/samples/simple_embedding/simple_embedding_int.c b/samples/simple_embedding/simple_embedding_int.c index ddf7f6e..0e63842 100644 --- a/samples/simple_embedding/simple_embedding_int.c +++ b/samples/simple_embedding/simple_embedding_int.c @@ -78,16 +78,16 @@ iree_status_t Run() { iree_hal_dim_t shape[1] = {IREE_ARRAYSIZE(kInt4)}; iree_hal_buffer_view_t* arg0_buffer_view = NULL; iree_hal_buffer_view_t* arg1_buffer_view = NULL; - IREE_RETURN_IF_ERROR(iree_hal_buffer_view_allocate_buffer( - iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, + IREE_RETURN_IF_ERROR(iree_hal_buffer_view_allocate_buffer_copy( + device, iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, IREE_HAL_ELEMENT_TYPE_SINT_32, IREE_HAL_ENCODING_TYPE_DENSE_ROW_MAJOR, (iree_hal_buffer_params_t){ .type = IREE_HAL_MEMORY_TYPE_DEVICE_LOCAL, .usage = IREE_HAL_BUFFER_USAGE_DEFAULT, }, iree_make_const_byte_span(kInt4, sizeof(kInt4)), &arg0_buffer_view)); - IREE_RETURN_IF_ERROR(iree_hal_buffer_view_allocate_buffer( - iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, + IREE_RETURN_IF_ERROR(iree_hal_buffer_view_allocate_buffer_copy( + device, iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, IREE_HAL_ELEMENT_TYPE_SINT_32, IREE_HAL_ENCODING_TYPE_DENSE_ROW_MAJOR, (iree_hal_buffer_params_t){ .type = IREE_HAL_MEMORY_TYPE_DEVICE_LOCAL, diff --git a/samples/simple_vec_mul/simple_mul_int.c b/samples/simple_vec_mul/simple_mul_int.c index 3c73243..72bcc40 100644 --- a/samples/simple_vec_mul/simple_mul_int.c +++ b/samples/simple_vec_mul/simple_mul_int.c @@ -132,16 +132,16 @@ iree_status_t Run() { iree_hal_dim_t shape[1] = {IREE_ARRAYSIZE(kInt0)}; iree_hal_buffer_view_t* arg0_buffer_view = NULL; iree_hal_buffer_view_t* arg1_buffer_view = NULL; - IREE_RETURN_IF_ERROR(iree_hal_buffer_view_allocate_buffer( - iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, + IREE_RETURN_IF_ERROR(iree_hal_buffer_view_allocate_buffer_copy( + device, iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, IREE_HAL_ELEMENT_TYPE_SINT_32, IREE_HAL_ENCODING_TYPE_DENSE_ROW_MAJOR, (iree_hal_buffer_params_t){ .type = IREE_HAL_MEMORY_TYPE_DEVICE_LOCAL, .usage = IREE_HAL_BUFFER_USAGE_DEFAULT, }, iree_make_const_byte_span(kInt0, sizeof(kInt0)), &arg0_buffer_view)); - IREE_RETURN_IF_ERROR(iree_hal_buffer_view_allocate_buffer( - iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, + IREE_RETURN_IF_ERROR(iree_hal_buffer_view_allocate_buffer_copy( + device, iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, IREE_HAL_ELEMENT_TYPE_SINT_32, IREE_HAL_ENCODING_TYPE_DENSE_ROW_MAJOR, (iree_hal_buffer_params_t){ .type = IREE_HAL_MEMORY_TYPE_DEVICE_LOCAL, diff --git a/samples/static_library/static_library_demo.c b/samples/static_library/static_library_demo.c index dd2a440..525a8a1 100644 --- a/samples/static_library/static_library_demo.c +++ b/samples/static_library/static_library_demo.c @@ -123,8 +123,8 @@ iree_status_t Run() { float kFloat2[] = {2.0f, 2.0f, 2.0f, 2.0f}; if (iree_status_is_ok(status)) { - status = iree_hal_buffer_view_allocate_buffer( - iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, + status = iree_hal_buffer_view_allocate_buffer_copy( + device, iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, IREE_HAL_ELEMENT_TYPE_FLOAT_32, IREE_HAL_ENCODING_TYPE_DENSE_ROW_MAJOR, (iree_hal_buffer_params_t){ .type = IREE_HAL_MEMORY_TYPE_DEVICE_LOCAL, @@ -135,8 +135,8 @@ iree_status_t Run() { &arg0_buffer_view); } if (iree_status_is_ok(status)) { - status = iree_hal_buffer_view_allocate_buffer( - iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, + status = iree_hal_buffer_view_allocate_buffer_copy( + device, iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, IREE_HAL_ELEMENT_TYPE_FLOAT_32, IREE_HAL_ENCODING_TYPE_DENSE_ROW_MAJOR, (iree_hal_buffer_params_t){ .type = IREE_HAL_MEMORY_TYPE_DEVICE_LOCAL, diff --git a/samples/vision_inference/static_library_mnist.c b/samples/vision_inference/static_library_mnist.c index 94bab98..7951844 100644 --- a/samples/vision_inference/static_library_mnist.c +++ b/samples/vision_inference/static_library_mnist.c @@ -130,8 +130,8 @@ iree_status_t Run() { iree_hal_buffer_view_t* arg0_buffer_view = NULL; if (iree_status_is_ok(status)) { - status = iree_hal_buffer_view_allocate_buffer( - iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, + status = iree_hal_buffer_view_allocate_buffer_copy( + device, iree_hal_device_allocator(device), IREE_ARRAYSIZE(shape), shape, IREE_HAL_ELEMENT_TYPE_FLOAT_32, IREE_HAL_ENCODING_TYPE_DENSE_ROW_MAJOR, (iree_hal_buffer_params_t){ .type = IREE_HAL_MEMORY_TYPE_DEVICE_LOCAL, diff --git a/third_party/iree b/third_party/iree index 48f7394..bb51f6f 160000 --- a/third_party/iree +++ b/third_party/iree @@ -1 +1 @@ -Subproject commit 48f7394c6e24171da688095ee3427e0f36f271c8 +Subproject commit bb51f6f1a1b4ee619fb09a7396f449dadb211447