-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding experimental synchronous executor using inline command buffers.
This is mostly just the plumbing to enable #4680 by defining a new `dylib-sync` runtime driver (pending #4298 to cleanup drivers). This driver does not support recording/replaying command buffers and has some gotchas with semaphores (no deadline waits, probably bugs, etc).
- Loading branch information
Showing
27 changed files
with
1,381 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Copyright 2020 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "iree/hal/dylib/registration/driver_module_sync.h" | ||
|
||
#include <inttypes.h> | ||
|
||
#include "iree/hal/local/loaders/legacy_library_loader.h" | ||
#include "iree/hal/local/sync_driver.h" | ||
|
||
// TODO(#4298): remove this driver registration and wrapper. | ||
// By having a single iree/hal/local/registration that then has the loaders | ||
// added to it based on compilation settings we can have a single set of flags | ||
// for everything. | ||
|
||
#define IREE_HAL_DYLIB_SYNC_DRIVER_ID 0x53444C4Cu // SDLL | ||
|
||
static iree_status_t iree_hal_dylib_sync_driver_factory_enumerate( | ||
void* self, const iree_hal_driver_info_t** out_driver_infos, | ||
iree_host_size_t* out_driver_info_count) { | ||
static const iree_hal_driver_info_t default_driver_info = { | ||
.driver_id = IREE_HAL_DYLIB_SYNC_DRIVER_ID, | ||
.driver_name = iree_string_view_literal("dylib-sync"), | ||
.full_name = iree_string_view_literal("AOT compiled dynamic libraries"), | ||
}; | ||
*out_driver_info_count = 1; | ||
*out_driver_infos = &default_driver_info; | ||
return iree_ok_status(); | ||
} | ||
|
||
static iree_status_t iree_hal_dylib_sync_driver_factory_try_create( | ||
void* self, iree_hal_driver_id_t driver_id, iree_allocator_t allocator, | ||
iree_hal_driver_t** out_driver) { | ||
if (driver_id != IREE_HAL_DYLIB_SYNC_DRIVER_ID) { | ||
return iree_make_status(IREE_STATUS_UNAVAILABLE, | ||
"no driver with ID %016" PRIu64 | ||
" is provided by this factory", | ||
driver_id); | ||
} | ||
|
||
iree_hal_sync_device_params_t default_params; | ||
iree_hal_sync_device_params_initialize(&default_params); | ||
|
||
iree_hal_executable_loader_t* dylib_loader = NULL; | ||
iree_status_t status = | ||
iree_hal_legacy_library_loader_create(allocator, &dylib_loader); | ||
iree_hal_executable_loader_t* loaders[1] = {dylib_loader}; | ||
|
||
if (iree_status_is_ok(status)) { | ||
status = iree_hal_sync_driver_create( | ||
iree_make_cstring_view("dylib"), &default_params, | ||
IREE_ARRAYSIZE(loaders), loaders, allocator, out_driver); | ||
} | ||
|
||
iree_hal_executable_loader_release(dylib_loader); | ||
return status; | ||
} | ||
|
||
IREE_API_EXPORT iree_status_t IREE_API_CALL | ||
iree_hal_dylib_sync_driver_module_register( | ||
iree_hal_driver_registry_t* registry) { | ||
static const iree_hal_driver_factory_t factory = { | ||
.self = NULL, | ||
.enumerate = iree_hal_dylib_sync_driver_factory_enumerate, | ||
.try_create = iree_hal_dylib_sync_driver_factory_try_create, | ||
}; | ||
return iree_hal_driver_registry_register_factory(registry, &factory); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2021 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef IREE_HAL_DYLIB_REGISTRATION_DRIVER_MODULE_SYNC_H_ | ||
#define IREE_HAL_DYLIB_REGISTRATION_DRIVER_MODULE_SYNC_H_ | ||
|
||
#include "iree/hal/api.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif // __cplusplus | ||
|
||
// DEPRECATED: this entire driver will be removed soon. | ||
// TODO(#3580): remove this entire driver w/ iree_hal_executable_library_t. | ||
IREE_API_EXPORT iree_status_t IREE_API_CALL | ||
iree_hal_dylib_sync_driver_module_register( | ||
iree_hal_driver_registry_t* registry); | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
#endif // __cplusplus | ||
|
||
#endif // IREE_HAL_DYLIB_REGISTRATION_DRIVER_MODULE_SYNC_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.