| 1 |
/* |
| 2 |
* Copyright (C) 2019-2023 Intel Corporation |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: MIT |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
#include "opencl/source/sharings/unified/enable_unified.h" |
| 9 |
|
| 10 |
#include "shared/source/debug_settings/debug_settings_manager.h" |
| 11 |
|
| 12 |
#include "opencl/source/context/context.h" |
| 13 |
#include "opencl/source/context/context.inl" |
| 14 |
#include "opencl/source/sharings/sharing_factory.h" |
| 15 |
#include "opencl/source/sharings/sharing_factory.inl" |
| 16 |
#include "opencl/source/sharings/unified/unified_sharing.h" |
| 17 |
#include "opencl/source/sharings/unified/unified_sharing_types.h" |
| 18 |
|
| 19 |
#include <memory> |
| 20 |
|
| 21 |
namespace NEO { |
| 22 |
|
| 23 |
bool UnifiedSharingContextBuilder::processProperties(cl_context_properties &propertyType, cl_context_properties &propertyValue) { |
| 24 |
switch (propertyType) { |
| 25 |
case static_cast<cl_context_properties>(UnifiedSharingContextType::deviceHandle): |
| 26 |
case static_cast<cl_context_properties>(UnifiedSharingContextType::deviceGroup): |
| 27 |
this->contextData = std::make_unique<UnifiedCreateContextProperties>(); |
| 28 |
return true; |
| 29 |
default: |
| 30 |
return false; |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
bool UnifiedSharingContextBuilder::finalizeProperties(Context &context, int32_t &errcodeRet) { |
| 35 |
if (contextData.get() != nullptr) { |
| 36 |
if (context.getInteropUserSyncEnabled()) { |
| 37 |
context.registerSharing(new UnifiedSharingFunctions()); |
| 38 |
} |
| 39 |
contextData.reset(nullptr); |
| 40 |
} |
| 41 |
return true; |
| 42 |
} |
| 43 |
|
| 44 |
std::unique_ptr<SharingContextBuilder> UnifiedSharingBuilderFactory::createContextBuilder() { |
| 45 |
return std::make_unique<UnifiedSharingContextBuilder>(); |
| 46 |
}; |
| 47 |
|
| 48 |
std::string UnifiedSharingBuilderFactory::getExtensions(DriverInfo *driverInfo) { |
| 49 |
return ""; |
| 50 |
} |
| 51 |
|
| 52 |
void *UnifiedSharingBuilderFactory::getExtensionFunctionAddress(const std::string &functionName) { |
| 53 |
return nullptr; |
| 54 |
} |
| 55 |
|
| 56 |
static SharingFactory::RegisterSharing<UnifiedSharingBuilderFactory, UnifiedSharingFunctions> unifiedSharing; |
| 57 |
} // namespace NEO |