Skip to content

Commit c2a57f0

Browse files
committed
shims: correct the check for newer SLPI enumerators
The previous check did not work as the enumertors are not defines but rather a proper enumerator. This adds a build time check for the support and conditionalises the compilation.
1 parent 34f383d commit c2a57f0

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,22 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows)
2424
include_directories(BEFORE SYSTEM ${DISPATCH_INCLUDES})
2525
dispatch_windows_lib_for_arch(${CMAKE_SYSTEM_PROCESSOR} DISPATCH_LIBDIR)
2626
link_directories(${DISPATCH_LIBDIR})
27+
28+
include(CheckCSourceCompiles)
29+
check_c_source_compiles([=[
30+
#include <Windows.h>
31+
int main(int argc, char *argv[]) {
32+
switch ((LOGICAL_PROCESSOR_RELATIONSHIP)0) {
33+
case RelationProcessorDie:
34+
case RelationNumaNodeEx:
35+
return 0;
36+
}
37+
return 0;
38+
}
39+
]=] DISPATCH_HAVE_EXTENDED_SLPI_20348)
40+
if(DISPATCH_HAVE_EXTENDED_SLPI_20348)
41+
add_compile_definitions(DISPATCH_HAVE_EXTENDED_SLPI_20348)
42+
endif()
2743
endif()
2844

2945
set(CMAKE_C_STANDARD 11)

src/shims/hw_config.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,14 @@ _dispatch_hw_get_config(_dispatch_hw_config_t c)
156156
++dwProcessorPhysicalCount;
157157
dwProcessorLogicalCount += __popcnt64(slpiCurrent->ProcessorMask);
158158
break;
159+
#if defined(DISPATCH_HAVE_EXTENDED_SLPI_20348)
160+
case RelationProcessorDie:
161+
#endif
159162
case RelationProcessorPackage:
160163
case RelationNumaNode:
164+
#if defined(DISPATCH_HAVE_EXTENDED_SLPI_20348)
165+
case RelationNumaNodeEx:
166+
#endif
161167
case RelationCache:
162168
case RelationGroup:
163169
case RelationAll:

0 commit comments

Comments
 (0)