diff --git a/level_zero/CMakeLists.txt b/level_zero/CMakeLists.txt index 4c21a9643e..86dec8e2b8 100644 --- a/level_zero/CMakeLists.txt +++ b/level_zero/CMakeLists.txt @@ -107,7 +107,11 @@ if(BUILD_WITH_L0) endif() if(NOT MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -fPIC") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") + endif() + + if(NOT WIN32) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") endif() set(L0_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/level_zero/core/source/fabric/windows/fabric_device_iaf.h b/level_zero/core/source/fabric/windows/fabric_device_iaf.h index 39c5ff7ae3..024abecbad 100644 --- a/level_zero/core/source/fabric/windows/fabric_device_iaf.h +++ b/level_zero/core/source/fabric/windows/fabric_device_iaf.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -20,9 +20,9 @@ class FabricDeviceIaf : public FabricDeviceInterface { ze_result_t enumerate() override { return ZE_RESULT_SUCCESS; } - bool getEdgeProperty(FabricVertex *neighborVertex, ze_fabric_edge_exp_properties_t &edgeProperty) { + bool getEdgeProperty(FabricVertex *neighborVertex, ze_fabric_edge_exp_properties_t &edgeProperty) override { return false; } }; -} // namespace L0 \ No newline at end of file +} // namespace L0 diff --git a/level_zero/core/source/windows/driver_teardown.cpp b/level_zero/core/source/windows/driver_teardown.cpp index 98b84cc60d..7bb1cd1bdb 100644 --- a/level_zero/core/source/windows/driver_teardown.cpp +++ b/level_zero/core/source/windows/driver_teardown.cpp @@ -5,13 +5,13 @@ * */ +#include "shared/source/os_interface/windows/windows_wrapper.h" + #include "level_zero/core/source/driver/driver.h" #include "level_zero/core/source/global_teardown.h" #include "level_zero/tools/source/sysman/os_sysman_driver.h" #include "level_zero/tools/source/sysman/sysman.h" -#include - namespace L0 { ze_result_t setDriverTeardownHandleInLoader(const char *loaderLibraryName) { diff --git a/level_zero/sysman/source/api/fan/windows/sysman_os_fan_imp.h b/level_zero/sysman/source/api/fan/windows/sysman_os_fan_imp.h index e1a983d3c1..9fecd60c69 100644 --- a/level_zero/sysman/source/api/fan/windows/sysman_os_fan_imp.h +++ b/level_zero/sysman/source/api/fan/windows/sysman_os_fan_imp.h @@ -33,8 +33,6 @@ class WddmFanImp : public OsFan, NEO::NonCopyableOrMovableClass { KmdSysManager *pKmdSysManager = nullptr; private: - uint64_t prevTS = 0; - uint32_t prevPulses = 0; int32_t maxPoints = 0; }; diff --git a/level_zero/sysman/source/api/frequency/windows/sysman_os_frequency_imp.h b/level_zero/sysman/source/api/frequency/windows/sysman_os_frequency_imp.h index 10938ad0ef..1dbe056cf9 100644 --- a/level_zero/sysman/source/api/frequency/windows/sysman_os_frequency_imp.h +++ b/level_zero/sysman/source/api/frequency/windows/sysman_os_frequency_imp.h @@ -70,8 +70,6 @@ class WddmFrequencyImp : public OsFrequency, NEO::NonCopyableOrMovableClass { ze_result_t getRange(double *min, double *max); void readOverclockingInfo(); ze_result_t applyOcSettings(); - double minRangeFreq = -1.0; - double maxRangeFreq = -1.0; zes_oc_capabilities_t ocCapabilities = {}; zes_oc_mode_t currentVoltageMode = ZES_OC_MODE_OFF; double currentFrequencyTarget = -1.0; diff --git a/level_zero/sysman/source/api/memory/windows/sysman_os_memory_imp.h b/level_zero/sysman/source/api/memory/windows/sysman_os_memory_imp.h index 5fae71f339..4acf27335c 100644 --- a/level_zero/sysman/source/api/memory/windows/sysman_os_memory_imp.h +++ b/level_zero/sysman/source/api/memory/windows/sysman_os_memory_imp.h @@ -12,7 +12,7 @@ #include "level_zero/sysman/source/sysman_const.h" #include "level_zero/sysman/source/windows/zes_os_sysman_imp.h" -#include +#include typedef PDH_STATUS(__stdcall *fn_PdhOpenQueryW)(LPCWSTR szDataSource, DWORD_PTR dwUserData, PDH_HQUERY *phQuery); typedef PDH_STATUS(__stdcall *fn_PdhAddEnglishCounterW)(PDH_HQUERY hQuery, LPCWSTR szFullCounterPath, DWORD_PTR dwUserData, PDH_HCOUNTER *phCounter); diff --git a/level_zero/sysman/source/windows/sysman_kmd_sys_manager.cpp b/level_zero/sysman/source/windows/sysman_kmd_sys_manager.cpp index a4848eb19b..5ed6c49cc4 100644 --- a/level_zero/sysman/source/windows/sysman_kmd_sys_manager.cpp +++ b/level_zero/sysman/source/windows/sysman_kmd_sys_manager.cpp @@ -146,7 +146,7 @@ NTSTATUS KmdSysManager::escape(uint32_t escapeOp, uint64_t pDataIn, uint32_t dat NTSTATUS status = STATUS_UNSUCCESSFUL; if (pWddmAccess) { D3DKMT_ESCAPE escapeCommand = {0}; - PcEscapeInfo pcEscape = {0}; + PcEscapeInfo pcEscape = {}; escapeCommand.Flags.HardwareAccess = 0; escapeCommand.Flags.Reserved = 0; escapeCommand.hAdapter = (D3DKMT_HANDLE)0; diff --git a/level_zero/tools/source/debug/windows/debug_session.cpp b/level_zero/tools/source/debug/windows/debug_session.cpp index f98e7a3a7a..29c70e88fb 100644 --- a/level_zero/tools/source/debug/windows/debug_session.cpp +++ b/level_zero/tools/source/debug/windows/debug_session.cpp @@ -58,7 +58,7 @@ ze_result_t DebugSessionWindows::initialize() { wddm = connectedDevice->getOsInterface().getDriverModel()->as(); UNRECOVERABLE_IF(wddm == nullptr); - KM_ESCAPE_INFO escapeInfo = {0}; + KM_ESCAPE_INFO escapeInfo = {}; escapeInfo.KmEuDbgL0EscapeInfo.EscapeActionType = DBGUMD_ACTION_ATTACH_DEBUGGER; escapeInfo.KmEuDbgL0EscapeInfo.AttachDebuggerParams.hAdapter = wddm->getAdapter(); escapeInfo.KmEuDbgL0EscapeInfo.AttachDebuggerParams.ProcessId = processId; @@ -98,7 +98,7 @@ bool DebugSessionWindows::closeConnection() { closeAsyncThread(); - KM_ESCAPE_INFO escapeInfo = {0}; + KM_ESCAPE_INFO escapeInfo = {}; escapeInfo.KmEuDbgL0EscapeInfo.EscapeActionType = DBGUMD_ACTION_DETACH_DEBUGGER; escapeInfo.KmEuDbgL0EscapeInfo.DetachDebuggerParams.ProcessID = processId; @@ -136,7 +136,7 @@ void *DebugSessionWindows::asyncThreadFunction(void *arg) { } NTSTATUS DebugSessionWindows::runEscape(KM_ESCAPE_INFO &escapeInfo) { - D3DKMT_ESCAPE escapeCommand = {0}; + D3DKMT_ESCAPE escapeCommand = {}; escapeInfo.Header.EscapeCode = GFX_ESCAPE_KMD; escapeInfo.Header.Size = sizeof(escapeInfo) - sizeof(escapeInfo.Header); @@ -156,11 +156,11 @@ NTSTATUS DebugSessionWindows::runEscape(KM_ESCAPE_INFO &escapeInfo) { } ze_result_t DebugSessionWindows::readAndHandleEvent(uint64_t timeoutMs) { - KM_ESCAPE_INFO escapeInfo = {0}; + KM_ESCAPE_INFO escapeInfo = {}; union { READ_EVENT_PARAMS_BUFFER eventParamsBuffer; - uint8_t rawBytes[8 * READ_EVENT_PARAMS_BUFFER_MIN_SIZE_BYTES] = {0}; + uint8_t rawBytes[8 * READ_EVENT_PARAMS_BUFFER_MIN_SIZE_BYTES] = {}; } eventParamsBuffer; escapeInfo.KmEuDbgL0EscapeInfo.EscapeActionType = DBGUMD_ACTION_READ_EVENT; @@ -210,7 +210,7 @@ ze_result_t DebugSessionWindows::handleModuleCreateEvent(uint32_t seqNo, DBGUMD_ { std::unique_lock lock(asyncThreadMutex); if (moduleCreateParams.IsModuleCreate) { - Module module = {0}; + Module module = {}; module.cpuAddress = moduleCreateParams.hElfAddressPtr; module.gpuAddress = moduleCreateParams.LoadAddress; module.size = moduleCreateParams.ElfModulesize; @@ -302,7 +302,7 @@ ze_result_t DebugSessionWindows::handleAllocationDataEvent(uint32_t seqNo, DBGUM for (uint32_t i = 0; i < allocationDataParams.NumOfDebugData; ++i) { auto dataType = allocationDebugData[i].DataType; PRINT_DEBUGGER_INFO_LOG("DBGUMD_ACTION_READ_ALLOCATION_DATA: DataType=%d DataSize=%d DataPointer=%p\n", dataType, allocationDebugData[i].DataSize, allocationDebugData[i].DataPointer); - NEO::WddmAllocation::RegistrationData registrationData = {0}; + NEO::WddmAllocation::RegistrationData registrationData = {}; auto result = readAllocationDebugData(seqNo, allocationDebugData[i].DataPointer, ®istrationData, sizeof(registrationData)); if (result != ZE_RESULT_SUCCESS) { PRINT_DEBUGGER_ERROR_LOG("DBGUMD_ACTION_READ_ALLOCATION_DATA - Fail!\n"); @@ -350,7 +350,7 @@ ze_result_t DebugSessionWindows::handleDeviceCreateDestroyEvent(DBGUMD_READ_EVEN } ze_result_t DebugSessionWindows::readAllocationDebugData(uint32_t seqNo, uint64_t umdDataBufferPtr, void *outBuf, size_t outBufSize) { - KM_ESCAPE_INFO escapeInfo = {0}; + KM_ESCAPE_INFO escapeInfo = {}; escapeInfo.KmEuDbgL0EscapeInfo.EscapeActionType = DBGUMD_ACTION_READ_ALLOCATION_DATA; escapeInfo.KmEuDbgL0EscapeInfo.ReadAdditionalAllocDataParams.EventSeqNo = seqNo; @@ -397,7 +397,7 @@ ze_result_t DebugSessionWindows::handleCreateDebugDataEvent(DBGUMD_READ_EVENT_CR ze_result_t DebugSessionWindows::acknowledgeEventImp(uint32_t seqNo, uint32_t eventType) { PRINT_DEBUGGER_INFO_LOG("DBGUMD_ACTION_ACKNOWLEDGE_EVENT: seqNo: %d eventType: %d\n", seqNo, eventType); - KM_ESCAPE_INFO escapeInfo = {0}; + KM_ESCAPE_INFO escapeInfo = {}; escapeInfo.KmEuDbgL0EscapeInfo.EscapeActionType = DBGUMD_ACTION_ACKNOWLEDGE_EVENT; escapeInfo.KmEuDbgL0EscapeInfo.AckEventParams.EventSeqNo = seqNo; escapeInfo.KmEuDbgL0EscapeInfo.AckEventParams.ReadEventType = eventType; @@ -452,7 +452,7 @@ ze_result_t DebugSessionWindows::translateEscapeReturnStatusToZeResult(uint32_t ze_result_t DebugSessionWindows::readElfSpace(const zet_debug_memory_space_desc_t *desc, size_t size, void *buffer) { - KM_ESCAPE_INFO escapeInfo = {0}; + KM_ESCAPE_INFO escapeInfo = {}; escapeInfo.KmEuDbgL0EscapeInfo.EscapeActionType = DBGUMD_ACTION_READ_UMD_MEMORY; escapeInfo.KmEuDbgL0EscapeInfo.ReadUmdMemoryParams.hElfHandle = desc->address; escapeInfo.KmEuDbgL0EscapeInfo.ReadUmdMemoryParams.BufferSize = static_cast(size); @@ -588,7 +588,7 @@ ze_result_t DebugSessionWindows::resumeImp(const std::vector l0GfxCoreHelper.getAttentionBitmaskForSingleThreads(threads, hwInfo, bitmask, bitmaskSize); printBitmask(bitmask.get(), bitmaskSize); - KM_ESCAPE_INFO escapeInfo = {0}; + KM_ESCAPE_INFO escapeInfo = {}; escapeInfo.KmEuDbgL0EscapeInfo.EscapeActionType = DBGUMD_ACTION_EU_CONTROL_CLR_ATT_BIT; escapeInfo.KmEuDbgL0EscapeInfo.EuControlClrAttBitParams.BitmaskArrayPtr = reinterpret_cast(bitmask.get()); escapeInfo.KmEuDbgL0EscapeInfo.EuControlClrAttBitParams.BitMaskSizeInBytes = static_cast(bitmaskSize); @@ -609,7 +609,7 @@ ze_result_t DebugSessionWindows::resumeImp(const std::vector } ze_result_t DebugSessionWindows::interruptImp(uint32_t deviceIndex) { - KM_ESCAPE_INFO escapeInfo = {0}; + KM_ESCAPE_INFO escapeInfo = {}; escapeInfo.KmEuDbgL0EscapeInfo.EscapeActionType = DBGUMD_ACTION_EU_CONTROL_INT_ALL; auto status = runEscape(escapeInfo); @@ -632,7 +632,7 @@ ze_result_t DebugSessionWindows::readGpuMemory(uint64_t memoryHandle, char *outp auto gmmHelper = connectedDevice->getNEODevice()->getGmmHelper(); gpuVa = gmmHelper->decanonize(gpuVa); - KM_ESCAPE_INFO escapeInfo = {0}; + KM_ESCAPE_INFO escapeInfo = {}; escapeInfo.KmEuDbgL0EscapeInfo.EscapeActionType = DBGUMD_ACTION_READ_GFX_MEMORY; escapeInfo.KmEuDbgL0EscapeInfo.ReadGfxMemoryParams.hContextHandle = memoryHandle; escapeInfo.KmEuDbgL0EscapeInfo.ReadGfxMemoryParams.GpuVirtualAddr = gpuVa; @@ -653,7 +653,7 @@ ze_result_t DebugSessionWindows::writeGpuMemory(uint64_t memoryHandle, const cha auto gmmHelper = connectedDevice->getNEODevice()->getGmmHelper(); gpuVa = gmmHelper->decanonize(gpuVa); - KM_ESCAPE_INFO escapeInfo = {0}; + KM_ESCAPE_INFO escapeInfo = {}; escapeInfo.KmEuDbgL0EscapeInfo.EscapeActionType = DBGUMD_ACTION_WRITE_GFX_MEMORY; escapeInfo.KmEuDbgL0EscapeInfo.ReadGfxMemoryParams.hContextHandle = memoryHandle; escapeInfo.KmEuDbgL0EscapeInfo.ReadGfxMemoryParams.GpuVirtualAddr = gpuVa; @@ -689,7 +689,7 @@ ze_result_t DebugSessionWindows::readSbaBuffer(EuThread::ThreadId threadId, NEO: } void DebugSessionWindows::getSbaBufferGpuVa(uint64_t &gpuVa) { - KM_ESCAPE_INFO escapeInfo = {0}; + KM_ESCAPE_INFO escapeInfo = {}; escapeInfo.KmEuDbgL0EscapeInfo.EscapeActionType = DBGUMD_ACTION_READ_MMIO; escapeInfo.KmEuDbgL0EscapeInfo.MmioReadParams.MmioOffset = CS_GPR_R15; escapeInfo.KmEuDbgL0EscapeInfo.MmioReadParams.RegisterOutBufferPtr = reinterpret_cast(&gpuVa); diff --git a/level_zero/tools/source/debug/windows/debug_session.h b/level_zero/tools/source/debug/windows/debug_session.h index 12d7a98343..218c072e7e 100644 --- a/level_zero/tools/source/debug/windows/debug_session.h +++ b/level_zero/tools/source/debug/windows/debug_session.h @@ -45,7 +45,7 @@ struct DebugSessionWindows : DebugSessionImp { protected: ze_result_t resumeImp(const std::vector &threads, uint32_t deviceIndex) override; - void DebugSessionWindows::pushApiEvent(zet_debug_event_t &debugEvent, uint32_t seqNo, uint32_t type) { + void pushApiEvent(zet_debug_event_t &debugEvent, uint32_t seqNo, uint32_t type) { std::unique_lock lock(asyncThreadMutex); apiEvents.push(debugEvent); if (debugEvent.flags & ZET_DEBUG_EVENT_FLAG_NEED_ACK) { diff --git a/level_zero/tools/source/metrics/windows/os_metric_oa_enumeration_imp_windows.cpp b/level_zero/tools/source/metrics/windows/os_metric_oa_enumeration_imp_windows.cpp index 83b7a8e713..7c1c8387f9 100644 --- a/level_zero/tools/source/metrics/windows/os_metric_oa_enumeration_imp_windows.cpp +++ b/level_zero/tools/source/metrics/windows/os_metric_oa_enumeration_imp_windows.cpp @@ -59,7 +59,7 @@ MetricsDiscovery::IAdapter_1_9 *MetricEnumeration::getMetricsAdapter() { auto adapterParams = getAdapterParams(adapter); const bool validAdapterInfo = adapterParams->SystemId.Type == MetricsDiscovery::ADAPTER_ID_TYPE_LUID; - const bool validAdapterMatch = (adapterParams->SystemId.Luid.HighPart == major) && + const bool validAdapterMatch = (static_cast(adapterParams->SystemId.Luid.HighPart) == major) && (adapterParams->SystemId.Luid.LowPart == minor); if (validAdapterInfo && validAdapterMatch) { @@ -72,18 +72,13 @@ MetricsDiscovery::IAdapter_1_9 *MetricEnumeration::getMetricsAdapter() { class MetricOAWindowsImp : public MetricOAOsInterface { public: - MetricOAWindowsImp(Device &device); + MetricOAWindowsImp() = default; ~MetricOAWindowsImp() override = default; ze_result_t getMetricsTimerResolution(uint64_t &timerResolution) override; - - private: - Device &device; }; -MetricOAWindowsImp::MetricOAWindowsImp(Device &device) : device(device) {} - std::unique_ptr MetricOAOsInterface::create(Device &device) { - return std::make_unique(device); + return std::make_unique(); } ze_result_t MetricOAWindowsImp::getMetricsTimerResolution(uint64_t &timerResolution) { diff --git a/level_zero/tools/source/metrics/windows/os_metric_oa_query_imp_windows.cpp b/level_zero/tools/source/metrics/windows/os_metric_oa_query_imp_windows.cpp index 300dcde54c..1134be0bd2 100644 --- a/level_zero/tools/source/metrics/windows/os_metric_oa_query_imp_windows.cpp +++ b/level_zero/tools/source/metrics/windows/os_metric_oa_query_imp_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -33,7 +33,7 @@ bool MetricsLibrary::getContextData(Device &device, ContextCreateData_1_0 &conte // Copy escape data (adapter/device/escape function). osData.KmdInstrumentationEnabled = true; osData.Device = reinterpret_cast(static_cast(wddm->getDeviceHandle())); - osData.Escape = wddm->getEscapeHandle(); + osData.Escape = reinterpret_cast(wddm->getEscapeHandle()); osData.Adapter = reinterpret_cast(static_cast(wddm->getAdapter())); diff --git a/level_zero/tools/source/sysman/fan/windows/os_fan_imp.h b/level_zero/tools/source/sysman/fan/windows/os_fan_imp.h index c76fc7c903..8340c9040b 100644 --- a/level_zero/tools/source/sysman/fan/windows/os_fan_imp.h +++ b/level_zero/tools/source/sysman/fan/windows/os_fan_imp.h @@ -32,8 +32,6 @@ class WddmFanImp : public OsFan, NEO::NonCopyableOrMovableClass { KmdSysManager *pKmdSysManager = nullptr; private: - uint64_t prevTS = 0; - uint32_t prevPulses = 0; int32_t maxPoints = 0; }; diff --git a/level_zero/tools/source/sysman/frequency/windows/os_frequency_imp.h b/level_zero/tools/source/sysman/frequency/windows/os_frequency_imp.h index b35aab6e1a..f868464e9a 100644 --- a/level_zero/tools/source/sysman/frequency/windows/os_frequency_imp.h +++ b/level_zero/tools/source/sysman/frequency/windows/os_frequency_imp.h @@ -69,8 +69,6 @@ class WddmFrequencyImp : public OsFrequency, NEO::NonCopyableOrMovableClass { ze_result_t getRange(double *min, double *max); void readOverclockingInfo(); ze_result_t applyOcSettings(); - double minRangeFreq = -1.0; - double maxRangeFreq = -1.0; zes_oc_capabilities_t ocCapabilities = {}; zes_oc_mode_t currentVoltageMode = ZES_OC_MODE_OFF; double currentFrequencyTarget = -1.0; diff --git a/level_zero/tools/source/sysman/memory/windows/os_memory_imp.h b/level_zero/tools/source/sysman/memory/windows/os_memory_imp.h index a00972d861..95f4fbf890 100644 --- a/level_zero/tools/source/sysman/memory/windows/os_memory_imp.h +++ b/level_zero/tools/source/sysman/memory/windows/os_memory_imp.h @@ -12,7 +12,20 @@ #include "level_zero/tools/source/sysman/sysman_const.h" #include "level_zero/tools/source/sysman/windows/os_sysman_imp.h" -#include +#if __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wignored-pragma-intrinsic" +#pragma clang diagnostic ignored "-Wpragma-pack" +#pragma clang diagnostic ignored "-Wignored-attributes" +#pragma clang diagnostic ignored "-Wmacro-redefined" +#define UNICODE +#endif + +#include + +#if __clang__ +#pragma clang diagnostic pop +#endif typedef PDH_STATUS(__stdcall *fn_PdhOpenQueryW)(LPCWSTR szDataSource, DWORD_PTR dwUserData, PDH_HQUERY *phQuery); typedef PDH_STATUS(__stdcall *fn_PdhAddEnglishCounterW)(PDH_HQUERY hQuery, LPCWSTR szFullCounterPath, DWORD_PTR dwUserData, PDH_HCOUNTER *phCounter); diff --git a/level_zero/tools/source/sysman/windows/kmd_sys_manager.cpp b/level_zero/tools/source/sysman/windows/kmd_sys_manager.cpp index 3b896d4e98..d56a56d9f7 100644 --- a/level_zero/tools/source/sysman/windows/kmd_sys_manager.cpp +++ b/level_zero/tools/source/sysman/windows/kmd_sys_manager.cpp @@ -146,7 +146,7 @@ NTSTATUS KmdSysManager::escape(uint32_t escapeOp, uint64_t pDataIn, uint32_t dat NTSTATUS status = STATUS_UNSUCCESSFUL; if (pWddmAccess) { D3DKMT_ESCAPE escapeCommand = {0}; - PcEscapeInfo pcEscape = {0}; + PcEscapeInfo pcEscape = {}; escapeCommand.Flags.HardwareAccess = 0; escapeCommand.Flags.Reserved = 0; escapeCommand.hAdapter = (D3DKMT_HANDLE)0;