diff options
author | Nikhil Joshi <nikhilj@nvidia.com> | 2020-09-28 09:54:46 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-28 09:54:46 +0530 |
commit | 97f0eb551154ac28decc89f546eb9f4082948887 (patch) | |
tree | c2708452d24708c4208bf7819920f043c86c52cf | |
parent | 98ca71fb9f8484f1cd1999f55224bf9e8d18693b (diff) | |
parent | 8f7f56d19d5a69e8ac4b5742b18b9b299b68c71d (diff) | |
download | OpenCL-ICD-Loader-97f0eb551154ac28decc89f546eb9f4082948887.tar.gz OpenCL-ICD-Loader-97f0eb551154ac28decc89f546eb9f4082948887.tar.bz2 OpenCL-ICD-Loader-97f0eb551154ac28decc89f546eb9f4082948887.zip |
Merge branch 'master' into master
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | loader/icd.h | 5 | ||||
-rw-r--r-- | loader/windows/OpenCL.rc | 5 | ||||
-rw-r--r-- | loader/windows/icd_windows.c | 26 | ||||
-rw-r--r-- | loader/windows/icd_windows_dxgk.c | 7 | ||||
-rw-r--r-- | loader/windows/icd_windows_hkr.c | 6 | ||||
-rw-r--r-- | test/loader_test/test_buffer_object.c | 1 | ||||
-rw-r--r-- | test/loader_test/test_kernel.c | 2 |
8 files changed, 34 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a0da4d3..1cf4013 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,6 +84,7 @@ if (WIN32) # only required in rare cases. if (DEFINED ENV{DXSDK_DIR} AND NOT (MINGW OR MSYS OR CYGWIN)) include_directories ($ENV{DXSDK_DIR}/Include) + include_directories ($ENV{WDK}/km) endif () else () # By default don't include OpenCL 3.0 symbol definitions (i.e. comment them @@ -112,6 +113,7 @@ set_target_properties (OpenCL PROPERTIES VERSION "1.2" SOVERSION "1") target_include_directories(OpenCL SYSTEM PUBLIC ${OPENCL_ICD_LOADER_HEADERS_DIR}) if (WIN32) + target_link_libraries (OpenCL cfgmgr32.lib runtimeobject.lib) option (OPENCL_ICD_LOADER_DISABLE_OPENCLON12 "Disable support for OpenCLOn12. Support for OpenCLOn12 should only be disabled when building an import lib to link with, and must be enabled when building an ICD loader for distribution!" OFF) diff --git a/loader/icd.h b/loader/icd.h index 34751e9..fc6f819 100644 --- a/loader/icd.h +++ b/loader/icd.h @@ -122,6 +122,11 @@ void khrIcdContextPropertiesGetPlatform( const cl_context_properties *properties, cl_platform_id *outPlatform); +// translate device type to platform +void khrIcdDeviceTypeGetPlatform( + cl_device_type device_type, + cl_platform_id *outPlatform); + // internal tracing macros #if 0 #include <stdio.h> diff --git a/loader/windows/OpenCL.rc b/loader/windows/OpenCL.rc index 3353fd4..a0f2084 100644 --- a/loader/windows/OpenCL.rc +++ b/loader/windows/OpenCL.rc @@ -32,8 +32,13 @@ OPENCL_ICD_LOADER_TOSTRING(OPENCL_ICD_LOADER_VERSION_REV) VS_VERSION_INFO VERSIONINFO +<<<<<<< HEAD +FILEVERSION 2,2,2,0 +PRODUCTVERSION 2,2,2,0 +======= FILEVERSION OPENCL_ICD_LOADER_VERSION_MAJOR,OPENCL_ICD_LOADER_VERSION_MINOR,OPENCL_ICD_LOADER_VERSION_REV,0 PRODUCTVERSION OPENCL_ICD_LOADER_VERSION_MAJOR,OPENCL_ICD_LOADER_VERSION_MINOR,OPENCL_ICD_LOADER_VERSION_REV,0 +>>>>>>> KhronosGroup-master FILETYPE VFT_DLL BEGIN diff --git a/loader/windows/icd_windows.c b/loader/windows/icd_windows.c index 25f1b9b..da884f6 100644 --- a/loader/windows/icd_windows.c +++ b/loader/windows/icd_windows.c @@ -22,7 +22,6 @@ #include "icd_windows_dxgk.h" #include "icd_windows_apppackage.h" #include <stdio.h> -#include <windows.h> #include <winreg.h> #include <initguid.h> @@ -45,7 +44,7 @@ static WinAdapter* pWinAdapterCapacity = NULL; BOOL adapterAdd(const char* szName, LUID luid) { - BOOL result = TRUE; + BOOL result = TRUE; if (pWinAdapterEnd == pWinAdapterCapacity) { size_t oldCapacity = pWinAdapterCapacity - pWinAdapterBegin; @@ -55,20 +54,15 @@ BOOL adapterAdd(const char* szName, LUID luid) newCapacity = 1; } else if(newCapacity < UINT_MAX/2) - { + { newCapacity *= 2; } - WinAdapter* pNewBegin = malloc(newCapacity * sizeof(*pWinAdapterBegin)); + WinAdapter* pNewBegin = realloc(pWinAdapterBegin, newCapacity * sizeof(*pWinAdapterBegin)); if (!pNewBegin) result = FALSE; else { - if (pWinAdapterBegin) - { - memcpy(pNewBegin, pWinAdapterBegin, oldCapacity * sizeof(*pWinAdapterBegin)); - free(pWinAdapterBegin); - } pWinAdapterCapacity = pNewBegin + newCapacity; pWinAdapterEnd = pNewBegin + oldCapacity; pWinAdapterBegin = pNewBegin; @@ -80,8 +74,8 @@ BOOL adapterAdd(const char* szName, LUID luid) pWinAdapterEnd->szName = malloc(nameLen); if (!pWinAdapterEnd->szName) result = FALSE; - else - { + else + { memcpy(pWinAdapterEnd->szName, szName, nameLen); pWinAdapterEnd->luid = luid; ++pWinAdapterEnd; @@ -94,6 +88,7 @@ void adapterFree(WinAdapter *pWinAdapter) { free(pWinAdapter->szName); pWinAdapter->szName = NULL; + pWinAdapter->luid = ZeroLuid; } /* @@ -119,7 +114,7 @@ BOOL CALLBACK khrIcdOsVendorsEnumerate(PINIT_ONCE InitOnce, PVOID Parameter, PVO { KHR_ICD_TRACE("Failed to load via DXGK interface on RS4, continuing\n"); status |= khrIcdOsVendorsEnumerateHKR(); - if (!status) + if (!status) { KHR_ICD_TRACE("Failed to enumerate HKR entries, continuing\n"); } @@ -190,8 +185,8 @@ BOOL CALLBACK khrIcdOsVendorsEnumerate(PINIT_ONCE InitOnce, PVOID Parameter, PVO { IDXGIFactory* pFactory = NULL; PFN_CREATE_DXGI_FACTORY pCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY)GetProcAddress(hDXGI, "CreateDXGIFactory"); - if (pCreateDXGIFactory) - { + if (pCreateDXGIFactory) + { HRESULT hr = pCreateDXGIFactory(&IID_IDXGIFactory, &pFactory); if (SUCCEEDED(hr)) { @@ -210,10 +205,11 @@ BOOL CALLBACK khrIcdOsVendorsEnumerate(PINIT_ONCE InitOnce, PVOID Parameter, PVO khrIcdVendorAdd(iterAdapter->szName); break; } - } + } } pAdapter->lpVtbl->Release(pAdapter); + pAdapter->lpVtbl->Release(pAdapter); } pFactory->lpVtbl->Release(pFactory); } diff --git a/loader/windows/icd_windows_dxgk.c b/loader/windows/icd_windows_dxgk.c index 6f1568e..65e896a 100644 --- a/loader/windows/icd_windows_dxgk.c +++ b/loader/windows/icd_windows_dxgk.c @@ -33,7 +33,6 @@ bool khrIcdOsVendorsEnumerateDXGK(void) { bool ret = false; int result = 0; - // Get handle to GDI Runtime HMODULE h = LoadLibrary("gdi32.dll"); if (h == NULL) @@ -42,6 +41,7 @@ bool khrIcdOsVendorsEnumerateDXGK(void) if(GetProcAddress(h, "D3DKMTSubmitPresentBltToHwQueue")) // OS Version check { LoaderEnumAdapters2 EnumAdapters; + NTSTATUS status = STATUS_SUCCESS; char cszLibraryName[MAX_PATH] = { 0 }; @@ -63,6 +63,7 @@ bool khrIcdOsVendorsEnumerateDXGK(void) { EnumAdapters.adapter_count = 0; EnumAdapters.adapters = NULL; + status = pEnumAdapters2(&EnumAdapters); if (status == STATUS_BUFFER_TOO_SMALL) { @@ -82,6 +83,7 @@ bool khrIcdOsVendorsEnumerateDXGK(void) KHR_ICD_TRACE("Allocation failure for adapters buffer\n"); goto out; } + status = pEnumAdapters2(&EnumAdapters); if (!NT_SUCCESS(status)) { @@ -90,7 +92,9 @@ bool khrIcdOsVendorsEnumerateDXGK(void) } const char* cszOpenCLRegKeyName = getOpenCLRegKeyName(); const int szOpenCLRegKeyName = (int)(strlen(cszOpenCLRegKeyName) + 1)*sizeof(cszOpenCLRegKeyName[0]); + for (UINT AdapterIndex = 0; AdapterIndex < EnumAdapters.adapter_count; AdapterIndex++) + { LoaderQueryRegistryInfo queryArgs = {0}; LoaderQueryRegistryInfo* pQueryArgs = &queryArgs; @@ -132,6 +136,7 @@ bool khrIcdOsVendorsEnumerateDXGK(void) continue; } } + if (NT_SUCCESS(status) && pQueryArgs->status == LOADER_QUERY_REGISTRY_STATUS_BUFFER_OVERFLOW) { ULONG queryBufferSize = sizeof(LoaderQueryRegistryInfo) + queryArgs.output_value_size; diff --git a/loader/windows/icd_windows_hkr.c b/loader/windows/icd_windows_hkr.c index 58d5c0c..cc57574 100644 --- a/loader/windows/icd_windows_hkr.c +++ b/loader/windows/icd_windows_hkr.c @@ -17,7 +17,6 @@ */ #include "icd.h" -#include "icd_windows_hkr.h" #include <windows.h> #include "icd_windows_dxgk.h" #include <cfgmgr32.h> @@ -129,7 +128,7 @@ static bool ReadOpenCLKey(DEVINST dnDevNode) goto out; } - if (REG_SZ != dwLibraryNameType) + if (REG_MULTI_SZ != dwLibraryNameType) { if (REG_MULTI_SZ == dwLibraryNameType) { @@ -174,6 +173,7 @@ static DeviceProbeResult ProbeDevice(DEVINST devnode) devnode, 0); + // TODO: consider extracting warning messages out of this function if (CR_SUCCESS != ret) { KHR_ICD_TRACE(" WARNING: failed to probe the status of the device 0x%x\n", ret); @@ -346,6 +346,8 @@ bool khrIcdOsVendorsEnumerateHKR(void) &szGuid, 0); + KHR_ICD_ASSERT(devpropType == DEVPROP_TYPE_GUID); + if (CR_SUCCESS != ret || !IsEqualGUID(&OCL_GUID_DEVCLASS_SOFTWARECOMPONENT, &guid)) { diff --git a/test/loader_test/test_buffer_object.c b/test/loader_test/test_buffer_object.c index 1710e88..1de6ddb 100644 --- a/test/loader_test/test_buffer_object.c +++ b/test/loader_test/test_buffer_object.c @@ -1,5 +1,4 @@ #include <stdlib.h> - #include <CL/cl.h> #include "param_struct.h" #include <platform/icd_test_log.h> diff --git a/test/loader_test/test_kernel.c b/test/loader_test/test_kernel.c index a53e980..ab63932 100644 --- a/test/loader_test/test_kernel.c +++ b/test/loader_test/test_kernel.c @@ -154,7 +154,7 @@ int test_clEnqueueMigrateMemObjects(const struct clEnqueueMigrateMemObjects_st* &event); ret_val=clEnqueueMigrateMemObjects(command_queue, - data->num_mem_objects, + (cl_uint)data->num_mem_objects, data->mem_objects, data->flags, data->num_events_in_wait_list, |