Device driver change for accommodating IREE API change

There has been a recent upstream change on IREE API function call
"iree_hal_sync_device_create". This is a necessary subsequent downstream change.

Change-Id: I9cc6d023ae8ad80db31c47962c447372e06ab435
diff --git a/samples/device/device.h b/samples/device/device.h
index df7fe29..2fb2b9d 100644
--- a/samples/device/device.h
+++ b/samples/device/device.h
@@ -7,6 +7,7 @@
 // Create the HAL device from the different backend targets.
 // The HAL device is returned based on the implementation, and it must be
 // released by the caller.
-iree_status_t create_sample_device(iree_hal_device_t **device);
+iree_status_t create_sample_device(iree_allocator_t host_allocator,
+                                   iree_hal_device_t** out_device);
 
 #endif  // SAMPLES_DEVICE_H
diff --git a/samples/device/device_embedded_sync.c b/samples/device/device_embedded_sync.c
index dd47484..f511098 100644
--- a/samples/device/device_embedded_sync.c
+++ b/samples/device/device_embedded_sync.c
@@ -7,22 +7,30 @@
 #include "iree/hal/local/sync_device.h"
 #include "samples/device/device.h"
 
-iree_status_t create_sample_device(iree_hal_device_t **device) {
+iree_status_t create_sample_device(iree_allocator_t host_allocator,
+                                   iree_hal_device_t** out_device) {
   // Set parameters for the device created in the next step.
   iree_hal_sync_device_params_t params;
   iree_hal_sync_device_params_initialize(&params);
 
-  iree_hal_executable_loader_t *loader = NULL;
+  iree_hal_executable_loader_t* loader = NULL;
   IREE_RETURN_IF_ERROR(iree_hal_embedded_library_loader_create(
-      iree_hal_executable_import_provider_null(), iree_allocator_system(),
-      &loader));
+      iree_hal_executable_import_provider_null(), host_allocator, &loader));
 
+  // Use the default host allocator for buffer allocations.
   iree_string_view_t identifier = iree_make_cstring_view("dylib");
+  iree_hal_allocator_t* device_allocator = NULL;
+  iree_status_t status = iree_hal_allocator_create_heap(
+      identifier, host_allocator, host_allocator, &device_allocator);
 
   // Create the synchronous device and release the loader afterwards.
-  iree_status_t status =
-      iree_hal_sync_device_create(identifier, &params, /*loader_count=*/1,
-                                  &loader, iree_allocator_system(), device);
+  if (iree_status_is_ok(status)) {
+    status = iree_hal_sync_device_create(
+        identifier, &params, /*loader_count=*/1, &loader, device_allocator,
+        host_allocator, out_device);
+  }
+
+  iree_hal_allocator_release(device_allocator);
   iree_hal_executable_loader_release(loader);
   return status;
 }
diff --git a/samples/util/util.c b/samples/util/util.c
index 8d04abd..b0b514a 100644
--- a/samples/util/util.c
+++ b/samples/util/util.c
@@ -55,7 +55,7 @@
 
   iree_hal_device_t *device = NULL;
   if (iree_status_is_ok(result)) {
-    result = create_sample_device(&device);
+    result = create_sample_device(iree_allocator_system(), &device);
   }
   iree_vm_module_t *hal_module = NULL;
   if (iree_status_is_ok(result)) {