Aligning heap buffers wrapped in tests.
diff --git a/iree/runtime/demo/hello_world_explained.c b/iree/runtime/demo/hello_world_explained.c index 886aec1..2a981aa 100644 --- a/iree/runtime/demo/hello_world_explained.c +++ b/iree/runtime/demo/hello_world_explained.c
@@ -191,7 +191,8 @@ iree_hal_buffer_view_t* arg0 = NULL; if (iree_status_is_ok(status)) { static const iree_hal_dim_t arg0_shape[1] = {4}; - static const float arg0_data[4] = {1.0f, 1.1f, 1.2f, 1.3f}; + static const float iree_alignas(64) + arg0_data[4] = {1.0f, 1.1f, 1.2f, 1.3f}; status = iree_hal_buffer_view_wrap_or_clone_heap_buffer( device_allocator, // Shape dimensions and rank: @@ -230,7 +231,8 @@ iree_hal_buffer_view_t* arg1 = NULL; if (iree_status_is_ok(status)) { static const iree_hal_dim_t arg1_shape[1] = {4}; - static const float arg1_data[4] = {10.0f, 100.0f, 1000.0f, 10000.0f}; + static const float iree_alignas(64) + arg1_data[4] = {10.0f, 100.0f, 1000.0f, 10000.0f}; status = iree_hal_buffer_view_wrap_or_clone_heap_buffer( device_allocator, arg1_shape, IREE_ARRAYSIZE(arg1_shape), IREE_HAL_ELEMENT_TYPE_FLOAT_32,
diff --git a/iree/runtime/demo/hello_world_terse.c b/iree/runtime/demo/hello_world_terse.c index 2f715bc..121a2e5 100644 --- a/iree/runtime/demo/hello_world_terse.c +++ b/iree/runtime/demo/hello_world_terse.c
@@ -78,7 +78,8 @@ // %arg0: tensor<4xf32> iree_hal_buffer_view_t* arg0 = NULL; static const iree_hal_dim_t arg0_shape[1] = {4}; - static const float arg0_data[4] = {1.0f, 1.1f, 1.2f, 1.3f}; + static const float iree_alignas(IREE_HAL_HEAP_BUFFER_ALIGNMENT) + arg0_data[4] = {1.0f, 1.1f, 1.2f, 1.3f}; IREE_CHECK_OK(iree_hal_buffer_view_wrap_or_clone_heap_buffer( iree_runtime_session_device_allocator(session), arg0_shape, IREE_ARRAYSIZE(arg0_shape), IREE_HAL_ELEMENT_TYPE_FLOAT_32, @@ -102,7 +103,8 @@ // %arg1: tensor<4xf32> iree_hal_buffer_view_t* arg1 = NULL; static const iree_hal_dim_t arg1_shape[1] = {4}; - static const float arg1_data[4] = {10.0f, 100.0f, 1000.0f, 10000.0f}; + static const float iree_alignas(IREE_HAL_HEAP_BUFFER_ALIGNMENT) + arg1_data[4] = {10.0f, 100.0f, 1000.0f, 10000.0f}; IREE_CHECK_OK(iree_hal_buffer_view_wrap_or_clone_heap_buffer( iree_runtime_session_device_allocator(session), arg1_shape, IREE_ARRAYSIZE(arg1_shape), IREE_HAL_ELEMENT_TYPE_FLOAT_32,
diff --git a/iree/samples/custom_modules/custom_modules_test.cc b/iree/samples/custom_modules/custom_modules_test.cc index cf4e306..df2f190 100644 --- a/iree/samples/custom_modules/custom_modules_test.cc +++ b/iree/samples/custom_modules/custom_modules_test.cc
@@ -131,8 +131,8 @@ TEST_F(CustomModulesTest, PrintTensor) { // Allocate the buffer we'll be printing. static iree_hal_dim_t kShape[] = {2, 4}; - static float kBufferContents[2 * 4] = {0.0f, 1.0f, 2.0f, 3.0f, - 4.0f, 5.0f, 6.0f, 7.0f}; + static float iree_alignas(IREE_HAL_HEAP_BUFFER_ALIGNMENT) + kBufferContents[2 * 4] = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f}; iree_hal_buffer_params_t params = {0}; params.type = IREE_HAL_MEMORY_TYPE_HOST_LOCAL | IREE_HAL_MEMORY_TYPE_DEVICE_VISIBLE; @@ -179,8 +179,8 @@ TEST_F(CustomModulesTest, RoundTripTensor) { // Allocate the buffer we'll be printing/parsing. static iree_hal_dim_t kShape[] = {2, 4}; - static float kBufferContents[2 * 4] = {0.0f, 1.0f, 2.0f, 3.0f, - 4.0f, 5.0f, 6.0f, 7.0f}; + static float iree_alignas(IREE_HAL_HEAP_BUFFER_ALIGNMENT) + kBufferContents[2 * 4] = {0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f}; iree_hal_buffer_params_t params = {0}; params.type = IREE_HAL_MEMORY_TYPE_HOST_LOCAL | IREE_HAL_MEMORY_TYPE_DEVICE_VISIBLE;