Enable building OpenCL-CTS with Intel DPC++/C++ compiler ICX on Windows (#2088)

Currently Intel® C++ Compiler Classic (ICC) is supported to build
OpenCL-CTS on Windows. This compiler has been discontinued since the
second half of 2023. Instead, Intel recommends that users transition to
use the LLVM-based Intel® oneAPI DPC++/C++ Compiler (ICX).
This change is to enable users to build OpenCL-CTS with ICX on Windows.
This commit is contained in:
Qichao Gu
2024-11-06 00:52:16 +08:00
committed by GitHub
parent 6563c9062c
commit ccd455040a
14 changed files with 63 additions and 61 deletions

View File

@@ -24,7 +24,7 @@ int context_create(cl_device_id deviceID, cl_context context,
CResult result;
// create device
std::auto_ptr<CDeviceWrapper> deviceWrapper;
std::unique_ptr<CDeviceWrapper> deviceWrapper;
if (!DeviceCreate(adapterType, deviceWrapper))
{
result.ResultSub(CResult::TEST_ERROR);
@@ -68,7 +68,7 @@ int context_create(cl_device_id deviceID, cl_context context,
}
void *objectSharedHandle = 0;
std::auto_ptr<CSurfaceWrapper> surface;
std::unique_ptr<CSurfaceWrapper> surface;
if (!MediaSurfaceCreate(
adapterType, width, height, surfaceFormat, *deviceWrapper,
surface, (sharedHandle == SHARED_HANDLE_ENABLED) ? true : false,

View File

@@ -27,7 +27,7 @@ int api_functions(cl_device_id deviceID, cl_context context,
CResult result;
// create device
std::auto_ptr<CDeviceWrapper> deviceWrapper;
std::unique_ptr<CDeviceWrapper> deviceWrapper;
if (!DeviceCreate(adapterType, deviceWrapper))
{
result.ResultSub(CResult::TEST_ERROR);
@@ -87,7 +87,7 @@ int api_functions(cl_device_id deviceID, cl_context context,
}
void *objectSharedHandle = 0;
std::auto_ptr<CSurfaceWrapper> surface;
std::unique_ptr<CSurfaceWrapper> surface;
// create surface
if (!MediaSurfaceCreate(

View File

@@ -48,7 +48,7 @@ int kernel_functions(cl_device_id deviceID, cl_context context,
CResult result;
std::auto_ptr<CDeviceWrapper> deviceWrapper;
std::unique_ptr<CDeviceWrapper> deviceWrapper;
if (!DeviceCreate(adapterType, deviceWrapper))
{
result.ResultSub(CResult::TEST_ERROR);
@@ -102,7 +102,7 @@ int kernel_functions(cl_device_id deviceID, cl_context context,
}
void *objectSrcHandle = 0;
std::auto_ptr<CSurfaceWrapper> surfaceSrc;
std::unique_ptr<CSurfaceWrapper> surfaceSrc;
if (!MediaSurfaceCreate(adapterType, width, height, surfaceFormat,
*deviceWrapper, surfaceSrc,
(sharedHandle == SHARED_HANDLE_ENABLED) ? true
@@ -116,7 +116,7 @@ int kernel_functions(cl_device_id deviceID, cl_context context,
}
void *objectDstHandle = 0;
std::auto_ptr<CSurfaceWrapper> surfaceDst;
std::unique_ptr<CSurfaceWrapper> surfaceDst;
if (!MediaSurfaceCreate(adapterType, width, height, surfaceFormat,
*deviceWrapper, surfaceDst,
(sharedHandle == SHARED_HANDLE_ENABLED) ? true

View File

@@ -21,7 +21,7 @@ int get_device_ids(cl_device_id deviceID, cl_context context,
{
CResult result;
std::auto_ptr<CDeviceWrapper> deviceWrapper;
std::unique_ptr<CDeviceWrapper> deviceWrapper;
if (!DeviceCreate(adapterType, deviceWrapper))
{
result.ResultSub(CResult::TEST_ERROR);

View File

@@ -26,7 +26,7 @@ int interop_user_sync(cl_device_id deviceID, cl_context context,
CResult result;
// create device
std::auto_ptr<CDeviceWrapper> deviceWrapper;
std::unique_ptr<CDeviceWrapper> deviceWrapper;
if (!DeviceCreate(adapterType, deviceWrapper))
{
result.ResultSub(CResult::TEST_ERROR);
@@ -72,7 +72,7 @@ int interop_user_sync(cl_device_id deviceID, cl_context context,
}
void *objectSharedHandle = 0;
std::auto_ptr<CSurfaceWrapper> surface;
std::unique_ptr<CSurfaceWrapper> surface;
if (!MediaSurfaceCreate(
adapterType, width, height, surfaceFormat, *deviceWrapper,
surface, (sharedHandle == SHARED_HANDLE_ENABLED) ? true : false,

View File

@@ -23,7 +23,7 @@ int memory_access(cl_device_id deviceID, cl_context context,
{
CResult result;
std::auto_ptr<CDeviceWrapper> deviceWrapper;
std::unique_ptr<CDeviceWrapper> deviceWrapper;
// creates device
if (!DeviceCreate(adapterType, deviceWrapper))
{
@@ -74,7 +74,7 @@ int memory_access(cl_device_id deviceID, cl_context context,
}
void *objectSharedHandle = 0;
std::auto_ptr<CSurfaceWrapper> surface;
std::unique_ptr<CSurfaceWrapper> surface;
// creates surface
if (!MediaSurfaceCreate(

View File

@@ -57,7 +57,7 @@ int other_data_types(cl_device_id deviceID, cl_context context,
return result.Result();
}
std::auto_ptr<CDeviceWrapper> deviceWrapper;
std::unique_ptr<CDeviceWrapper> deviceWrapper;
if (!DeviceCreate(adapterType, deviceWrapper))
{
result.ResultSub(CResult::TEST_ERROR);
@@ -158,7 +158,7 @@ int other_data_types(cl_device_id deviceID, cl_context context,
}
void *objectSrcHandle = 0;
std::auto_ptr<CSurfaceWrapper> surfaceSrc;
std::unique_ptr<CSurfaceWrapper> surfaceSrc;
if (!MediaSurfaceCreate(adapterType, width, height, surfaceFormat,
*deviceWrapper, surfaceSrc,
(sharedHandle == SHARED_HANDLE_ENABLED) ? true
@@ -172,7 +172,7 @@ int other_data_types(cl_device_id deviceID, cl_context context,
}
void *objectDstHandle = 0;
std::auto_ptr<CSurfaceWrapper> surfaceDst;
std::unique_ptr<CSurfaceWrapper> surfaceDst;
if (!MediaSurfaceCreate(adapterType, width, height, surfaceFormat,
*deviceWrapper, surfaceDst,
(sharedHandle == SHARED_HANDLE_ENABLED) ? true

View File

@@ -224,7 +224,7 @@ bool YUVGenerate(TSurfaceFormat surfaceFormat, std::vector<cl_uchar> &yuv,
return true;
}
bool YUVSurfaceSetNV12(std::auto_ptr<CSurfaceWrapper> &surface,
bool YUVSurfaceSetNV12(std::unique_ptr<CSurfaceWrapper> &surface,
const std::vector<cl_uchar> &yuv, unsigned int width,
unsigned int height)
{
@@ -257,7 +257,7 @@ bool YUVSurfaceSetNV12(std::auto_ptr<CSurfaceWrapper> &surface,
#endif
}
bool YUVSurfaceSetYV12(std::auto_ptr<CSurfaceWrapper> &surface,
bool YUVSurfaceSetYV12(std::unique_ptr<CSurfaceWrapper> &surface,
const std::vector<cl_uchar> &yuv, unsigned int width,
unsigned int height)
{
@@ -305,7 +305,7 @@ bool YUVSurfaceSetYV12(std::auto_ptr<CSurfaceWrapper> &surface,
}
bool YUVSurfaceSet(TSurfaceFormat surfaceFormat,
std::auto_ptr<CSurfaceWrapper> &surface,
std::unique_ptr<CSurfaceWrapper> &surface,
const std::vector<cl_uchar> &yuv, unsigned int width,
unsigned int height)
{
@@ -326,7 +326,7 @@ bool YUVSurfaceSet(TSurfaceFormat surfaceFormat,
return true;
}
bool YUVSurfaceGetNV12(std::auto_ptr<CSurfaceWrapper> &surface,
bool YUVSurfaceGetNV12(std::unique_ptr<CSurfaceWrapper> &surface,
std::vector<cl_uchar> &yuv, unsigned int width,
unsigned int height)
{
@@ -363,7 +363,7 @@ bool YUVSurfaceGetNV12(std::auto_ptr<CSurfaceWrapper> &surface,
#endif
}
bool YUVSurfaceGetYV12(std::auto_ptr<CSurfaceWrapper> &surface,
bool YUVSurfaceGetYV12(std::unique_ptr<CSurfaceWrapper> &surface,
std::vector<cl_uchar> &yuv, unsigned int width,
unsigned int height)
{
@@ -411,7 +411,7 @@ bool YUVSurfaceGetYV12(std::auto_ptr<CSurfaceWrapper> &surface,
}
bool YUVSurfaceGet(TSurfaceFormat surfaceFormat,
std::auto_ptr<CSurfaceWrapper> &surface,
std::unique_ptr<CSurfaceWrapper> &surface,
std::vector<cl_uchar> &yuv, unsigned int width,
unsigned int height)
{
@@ -1078,7 +1078,7 @@ bool GetImageInfo(cl_mem object, cl_image_format formatExp,
}
bool GetMemObjInfo(cl_mem object, cl_dx9_media_adapter_type_khr adapterType,
std::auto_ptr<CSurfaceWrapper> &surface,
std::unique_ptr<CSurfaceWrapper> &surface,
void *shareHandleExp)
{
bool result = true;
@@ -1172,7 +1172,7 @@ bool GetMemObjInfo(cl_mem object, cl_dx9_media_adapter_type_khr adapterType,
bool ImageInfoVerify(cl_dx9_media_adapter_type_khr adapterType,
const std::vector<cl_mem> &memObjList, unsigned int width,
unsigned int height,
std::auto_ptr<CSurfaceWrapper> &surface,
std::unique_ptr<CSurfaceWrapper> &surface,
void *sharedHandle)
{
if (memObjList.size() != 2 && memObjList.size() != 3)
@@ -1379,19 +1379,19 @@ D3DFORMAT SurfaceFormatToD3D(TSurfaceFormat surfaceFormat)
#endif
bool DeviceCreate(cl_dx9_media_adapter_type_khr adapterType,
std::auto_ptr<CDeviceWrapper> &device)
std::unique_ptr<CDeviceWrapper> &device)
{
switch (adapterType)
{
#if defined(_WIN32)
case CL_ADAPTER_D3D9_KHR:
device = std::auto_ptr<CDeviceWrapper>(new CD3D9Wrapper());
device = std::unique_ptr<CDeviceWrapper>(new CD3D9Wrapper());
break;
case CL_ADAPTER_D3D9EX_KHR:
device = std::auto_ptr<CDeviceWrapper>(new CD3D9ExWrapper());
device = std::unique_ptr<CDeviceWrapper>(new CD3D9ExWrapper());
break;
case CL_ADAPTER_DXVA_KHR:
device = std::auto_ptr<CDeviceWrapper>(new CDXVAWrapper());
device = std::unique_ptr<CDeviceWrapper>(new CDXVAWrapper());
break;
#endif
default:
@@ -1551,7 +1551,7 @@ void SurfaceFormatToString(TSurfaceFormat surfaceFormat, std::string &str)
bool MediaSurfaceCreate(cl_dx9_media_adapter_type_khr adapterType,
unsigned int width, unsigned int height,
TSurfaceFormat surfaceFormat, CDeviceWrapper &device,
std::auto_ptr<CSurfaceWrapper> &surface,
std::unique_ptr<CSurfaceWrapper> &surface,
bool sharedHandle, void **objectSharedHandle)
{
switch (adapterType)
@@ -1559,7 +1559,7 @@ bool MediaSurfaceCreate(cl_dx9_media_adapter_type_khr adapterType,
#if defined(_WIN32)
case CL_ADAPTER_D3D9_KHR: {
surface =
std::auto_ptr<CD3D9SurfaceWrapper>(new CD3D9SurfaceWrapper);
std::unique_ptr<CD3D9SurfaceWrapper>(new CD3D9SurfaceWrapper);
CD3D9SurfaceWrapper *d3dSurface =
static_cast<CD3D9SurfaceWrapper *>(surface.get());
HRESULT hr = 0;
@@ -1578,7 +1578,7 @@ bool MediaSurfaceCreate(cl_dx9_media_adapter_type_khr adapterType,
break;
case CL_ADAPTER_D3D9EX_KHR: {
surface =
std::auto_ptr<CD3D9SurfaceWrapper>(new CD3D9SurfaceWrapper);
std::unique_ptr<CD3D9SurfaceWrapper>(new CD3D9SurfaceWrapper);
CD3D9SurfaceWrapper *d3dSurface =
static_cast<CD3D9SurfaceWrapper *>(surface.get());
HRESULT hr = 0;
@@ -1598,7 +1598,7 @@ bool MediaSurfaceCreate(cl_dx9_media_adapter_type_khr adapterType,
break;
case CL_ADAPTER_DXVA_KHR: {
surface =
std::auto_ptr<CD3D9SurfaceWrapper>(new CD3D9SurfaceWrapper);
std::unique_ptr<CD3D9SurfaceWrapper>(new CD3D9SurfaceWrapper);
CD3D9SurfaceWrapper *d3dSurface =
static_cast<CD3D9SurfaceWrapper *>(surface.get());
HRESULT hr = 0;

View File

@@ -116,24 +116,24 @@ void YUVGenerateYV12(std::vector<cl_uchar> &yuv, unsigned int width,
bool YUVGenerate(TSurfaceFormat surfaceFormat, std::vector<cl_uchar> &yuv,
unsigned int width, unsigned int height, cl_uchar valueMin,
cl_uchar valueMax, double valueAdd = 0.0);
bool YUVSurfaceSetNV12(std::auto_ptr<CSurfaceWrapper> &surface,
bool YUVSurfaceSetNV12(std::unique_ptr<CSurfaceWrapper> &surface,
const std::vector<cl_uchar> &yuv, unsigned int width,
unsigned int height);
bool YUVSurfaceSetYV12(std::auto_ptr<CSurfaceWrapper> &surface,
bool YUVSurfaceSetYV12(std::unique_ptr<CSurfaceWrapper> &surface,
const std::vector<cl_uchar> &yuv, unsigned int width,
unsigned int height);
bool YUVSurfaceSet(TSurfaceFormat surfaceFormat,
std::auto_ptr<CSurfaceWrapper> &surface,
std::unique_ptr<CSurfaceWrapper> &surface,
const std::vector<cl_uchar> &yuv, unsigned int width,
unsigned int height);
bool YUVSurfaceGetNV12(std::auto_ptr<CSurfaceWrapper> &surface,
bool YUVSurfaceGetNV12(std::unique_ptr<CSurfaceWrapper> &surface,
std::vector<cl_uchar> &yuv, unsigned int width,
unsigned int height);
bool YUVSurfaceGetYV12(std::auto_ptr<CSurfaceWrapper> &surface,
bool YUVSurfaceGetYV12(std::unique_ptr<CSurfaceWrapper> &surface,
std::vector<cl_uchar> &yuv, unsigned int width,
unsigned int height);
bool YUVSurfaceGet(TSurfaceFormat surfaceFormat,
std::auto_ptr<CSurfaceWrapper> &surface,
std::unique_ptr<CSurfaceWrapper> &surface,
std::vector<cl_uchar> &yuv, unsigned int width,
unsigned int height);
bool YUVCompareNV12(const std::vector<cl_uchar> &yuvTest,
@@ -178,12 +178,12 @@ bool GetImageInfo(cl_mem object, cl_image_format formatExp,
size_t slicePitchExp, size_t widthExp, size_t heightExp,
size_t depthExp, unsigned int planeExp);
bool GetMemObjInfo(cl_mem object, cl_dx9_media_adapter_type_khr adapterType,
std::auto_ptr<CSurfaceWrapper> &surface,
std::unique_ptr<CSurfaceWrapper> &surface,
void *shareHandleExp);
bool ImageInfoVerify(cl_dx9_media_adapter_type_khr adapterType,
const std::vector<cl_mem> &memObjList, unsigned int width,
unsigned int height,
std::auto_ptr<CSurfaceWrapper> &surface,
std::unique_ptr<CSurfaceWrapper> &surface,
void *sharedHandle);
bool ImageFormatCheck(cl_context context, cl_mem_object_type imageType,
const cl_image_format imageFormatCheck);
@@ -195,7 +195,7 @@ D3DFORMAT SurfaceFormatToD3D(TSurfaceFormat surfaceFormat);
#endif
bool DeviceCreate(cl_dx9_media_adapter_type_khr adapterType,
std::auto_ptr<CDeviceWrapper> &device);
std::unique_ptr<CDeviceWrapper> &device);
bool SurfaceFormatCheck(cl_dx9_media_adapter_type_khr adapterType,
const CDeviceWrapper &device,
TSurfaceFormat surfaceFormat);
@@ -204,7 +204,7 @@ void SurfaceFormatToString(TSurfaceFormat surfaceFormat, std::string &str);
bool MediaSurfaceCreate(cl_dx9_media_adapter_type_khr adapterType,
unsigned int width, unsigned int height,
TSurfaceFormat surfaceFormat, CDeviceWrapper &device,
std::auto_ptr<CSurfaceWrapper> &surface,
std::unique_ptr<CSurfaceWrapper> &surface,
bool sharedHandle, void **objectSharedHandle);
cl_int