Skip to content

[Libomptarget] Remove requires information from plugin #80345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions offload/plugins-nextgen/common/include/PluginInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -958,8 +958,7 @@ struct GenericPluginTy {

/// Construct a plugin instance.
GenericPluginTy(Triple::ArchType TA)
: RequiresFlags(OMP_REQ_UNDEFINED), GlobalHandler(nullptr), JIT(TA),
RPCServer(nullptr) {}
: GlobalHandler(nullptr), JIT(TA), RPCServer(nullptr) {}

virtual ~GenericPluginTy() {}

Expand Down Expand Up @@ -1028,12 +1027,6 @@ struct GenericPluginTy {
return *RPCServer;
}

/// Get the OpenMP requires flags set for this plugin.
int64_t getRequiresFlags() const { return RequiresFlags; }

/// Set the OpenMP requires flags for this plugin.
void setRequiresFlag(int64_t Flags) { RequiresFlags = Flags; }

/// Initialize a device within the plugin.
Error initDevice(int32_t DeviceId);

Expand Down Expand Up @@ -1074,9 +1067,6 @@ struct GenericPluginTy {
/// Return the number of devices this plugin can support.
int32_t number_of_devices();

/// Initializes the OpenMP register requires information.
int64_t init_requires(int64_t RequiresFlags);

/// Returns non-zero if the data can be exchanged between the two devices.
int32_t is_data_exchangable(int32_t SrcDeviceId, int32_t DstDeviceId);

Expand Down Expand Up @@ -1203,9 +1193,6 @@ struct GenericPluginTy {
/// device was not initialized yet.
llvm::SmallVector<GenericDeviceTy *> Devices;

/// OpenMP requires flags.
int64_t RequiresFlags;

/// Pointer to the global handler for this plugin.
GenericGlobalHandlerTy *GlobalHandler;

Expand Down
10 changes: 0 additions & 10 deletions offload/plugins-nextgen/common/src/PluginInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1618,11 +1618,6 @@ int32_t GenericPluginTy::init_device(int32_t DeviceId) {

int32_t GenericPluginTy::number_of_devices() { return getNumDevices(); }

int64_t GenericPluginTy::init_requires(int64_t RequiresFlags) {
setRequiresFlag(RequiresFlags);
return OFFLOAD_SUCCESS;
}

int32_t GenericPluginTy::is_data_exchangable(int32_t SrcDeviceId,
int32_t DstDeviceId) {
return isDataExchangable(SrcDeviceId, DstDeviceId);
Expand Down Expand Up @@ -1964,11 +1959,6 @@ int32_t GenericPluginTy::set_device_offset(int32_t DeviceIdOffset) {
}

int32_t GenericPluginTy::use_auto_zero_copy(int32_t DeviceId) {
// Automatic zero-copy only applies to programs that did
// not request unified_shared_memory and are deployed on an
// APU with XNACK enabled.
if (getRequiresFlags() & OMP_REQ_UNIFIED_SHARED_MEMORY)
return false;
return getDevice(DeviceId).useAutoZeroCopy();
}

Expand Down
12 changes: 3 additions & 9 deletions offload/src/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,7 @@ DeviceTy::~DeviceTy() {
}

llvm::Error DeviceTy::init() {
// Make call to init_requires if it exists for this plugin.
int32_t Ret = 0;
Ret = RTL->init_requires(PM->getRequirements());
if (Ret != OFFLOAD_SUCCESS)
return llvm::createStringError(
llvm::inconvertibleErrorCode(),
"Failed to initialize requirements for device %d\n", DeviceID);

Ret = RTL->init_device(RTLDeviceID);
int32_t Ret = RTL->init_device(RTLDeviceID);
if (Ret != OFFLOAD_SUCCESS)
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"Failed to initialize device %d\n",
Expand Down Expand Up @@ -285,5 +277,7 @@ void DeviceTy::dumpOffloadEntries() {
}

bool DeviceTy::useAutoZeroCopy() {
if (PM->getRequirements() & OMP_REQ_UNIFIED_SHARED_MEMORY)
return false;
return RTL->use_auto_zero_copy(RTLDeviceID);
}
Loading