Summary: This patch reorganizes a lot of the code used to check for compatibility with the current environment. The main bulk of this patch involves moving from using a separate `__tgt_image_info` struct (which just contains a string for the architecture) to instead simply checking this information from the ELF directly. Checking information in the ELF is very inexpensive as creating an ELF file is simply writing a base pointer. The main desire to do this was to reorganize everything into the ELF image. We can then do the majority of these checks without first initializing the plugin. A future patch will move the first ELF checks to happen without initializing the plugin so we no longer need to initialize and plugins that don't have needed images. This patch also adds a lot more sanity checks for whether or not the ELF is actually compatible. Such as if the images have a valid ABI, 64-bit width, executable, etc.
50 lines
2.0 KiB
C++
50 lines
2.0 KiB
C++
//===-- Shared/PluginAPI.inc - Target independent plugin API ----*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file defines the names of the interface functions between target
|
|
// independent offload runtime library and target dependent plugins.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// No include guards!
|
|
|
|
PLUGIN_API_HANDLE(init_plugin, true);
|
|
PLUGIN_API_HANDLE(is_valid_binary, true);
|
|
PLUGIN_API_HANDLE(is_data_exchangable, false);
|
|
PLUGIN_API_HANDLE(number_of_devices, true);
|
|
PLUGIN_API_HANDLE(init_device, true);
|
|
PLUGIN_API_HANDLE(load_binary, true);
|
|
PLUGIN_API_HANDLE(data_alloc, true);
|
|
PLUGIN_API_HANDLE(data_submit, true);
|
|
PLUGIN_API_HANDLE(data_submit_async, false);
|
|
PLUGIN_API_HANDLE(data_retrieve, true);
|
|
PLUGIN_API_HANDLE(data_retrieve_async, false);
|
|
PLUGIN_API_HANDLE(data_exchange, false);
|
|
PLUGIN_API_HANDLE(data_exchange_async, false);
|
|
PLUGIN_API_HANDLE(data_delete, true);
|
|
PLUGIN_API_HANDLE(launch_kernel, true);
|
|
PLUGIN_API_HANDLE(init_requires, false);
|
|
PLUGIN_API_HANDLE(synchronize, false);
|
|
PLUGIN_API_HANDLE(query_async, false);
|
|
PLUGIN_API_HANDLE(supports_empty_images, false);
|
|
PLUGIN_API_HANDLE(set_info_flag, false);
|
|
PLUGIN_API_HANDLE(print_device_info, false);
|
|
PLUGIN_API_HANDLE(create_event, false);
|
|
PLUGIN_API_HANDLE(record_event, false);
|
|
PLUGIN_API_HANDLE(wait_event, false);
|
|
PLUGIN_API_HANDLE(sync_event, false);
|
|
PLUGIN_API_HANDLE(destroy_event, false);
|
|
PLUGIN_API_HANDLE(init_async_info, false);
|
|
PLUGIN_API_HANDLE(init_device_info, false);
|
|
PLUGIN_API_HANDLE(data_lock, false);
|
|
PLUGIN_API_HANDLE(data_unlock, false);
|
|
PLUGIN_API_HANDLE(data_notify_mapped, false);
|
|
PLUGIN_API_HANDLE(data_notify_unmapped, false);
|
|
PLUGIN_API_HANDLE(set_device_offset, false);
|
|
PLUGIN_API_HANDLE(initialize_record_replay, false);
|