[Git][ghc/ghc][wip/T14781] 2 commits: users-guide: Note change in getNumProcessors in users guide
Ben Gamari
gitlab at gitlab.haskell.org
Wed May 27 22:29:34 UTC 2020
Ben Gamari pushed to branch wip/T14781 at Glasgow Haskell Compiler / GHC
Commits:
c5028dd0 by Ben Gamari at 2020-05-27T18:28:04-04:00
users-guide: Note change in getNumProcessors in users guide
- - - - -
c0f4bcc0 by Ben Gamari at 2020-05-27T18:29:24-04:00
rts: Drop compatibility shims for Windows Vista
We can now assume that the thread and processor group interfaces are
available.
- - - - -
5 changed files:
- docs/users_guide/8.12.1-notes.rst
- docs/users_guide/using-concurrent.rst
- hadrian/src/Settings/Packages.hs
- rts/ghc.mk
- rts/win32/OSThreads.c
Changes:
=====================================
docs/users_guide/8.12.1-notes.rst
=====================================
@@ -17,7 +17,7 @@ Highlights
digit improvements in runtime for inner loops.
In the mean this improved runtime by about 0.8%. For details
- see ticket #17823.
+ see ticket :ghc-ticket:`17823`.
Full details
------------
@@ -95,7 +95,7 @@ Language
effectively allows users to choose which variables can or can't be
instantiated through visible type application. More information can be found
here: :ref:`Manually-defining-inferred-variables`.
-
+
Compiler
~~~~~~~~
@@ -105,11 +105,18 @@ GHCi
- The ``:script`` command now allows for file names that contain spaces to
passed as arguments: either by enclosing the file names in double quotes or by
- escaping spaces in file names with a backslash. (#18027)
+ escaping spaces in file names with a backslash. (:ghc-ticket:`18027`)
Runtime system
~~~~~~~~~~~~~~
+- :rts-flag:`-N` without a count now tries to respect the number of processors
+ in the process's affinity mask, making GHC's behavior more predictable in
+ containerized settings (:ghc-ticket:`14781`).
+
+- Support for Windows Vista has been dropped. GHC-compiled programs now require
+ Windows 7 or later.
+
Template Haskell
~~~~~~~~~~~~~~~~
=====================================
docs/users_guide/using-concurrent.rst
=====================================
@@ -111,6 +111,7 @@ There are two ways to run a program on multiple processors: call
use the RTS :rts-flag:`-N ⟨x⟩` options.
.. rts-flag:: -N ⟨x⟩
+ -N
-maxN ⟨x⟩
Use ⟨x⟩ simultaneous threads when running the program.
=====================================
hadrian/src/Settings/Packages.hs
=====================================
@@ -442,4 +442,4 @@ rtsWarnings = mconcat
-- and also centralizes the versioning.
-- | Minimum supported Windows version.
windowsVersion :: String
-windowsVersion = "0x06000100"
+windowsVersion = "0x06010000"
=====================================
rts/ghc.mk
=====================================
@@ -25,7 +25,7 @@ rts_VERSION = 1.0
# If we're compiling on windows, enforce that we only support Vista SP1+
# Adding this here means it doesn't have to be done in individual .c files
# and also centralizes the versioning.
-rts_WINVER = 0x06000100
+rts_WINVER = 0x06010000
# merge GhcLibWays and GhcRTSWays but strip out duplicates
rts_WAYS = $(GhcLibWays) $(filter-out $(GhcLibWays),$(GhcRTSWays))
=====================================
rts/win32/OSThreads.c
=====================================
@@ -252,17 +252,6 @@ forkOS_createThread ( HsStablePtr entry )
(unsigned*)&pId) == 0);
}
-#if defined(x86_64_HOST_ARCH)
-/* We still support Windows Vista, so we can't depend on it
- and must manually resolve these. */
-typedef DWORD(WINAPI *GetItemCountProc)(WORD);
-typedef DWORD(WINAPI *GetGroupCountProc)(void);
-typedef BOOL(WINAPI *SetThreadGroupAffinityProc)(HANDLE, const GROUP_AFFINITY*, PGROUP_AFFINITY);
-#if !defined(ALL_PROCESSOR_GROUPS)
-#define ALL_PROCESSOR_GROUPS 0xffff
-#endif
-#endif
-
void freeThreadingResources (void)
{
if (cpuGroupCache)
@@ -310,13 +299,6 @@ getNumberOfProcessorsGroups (void)
#if defined(x86_64_HOST_ARCH)
if (!n_groups)
{
- /* We still support Windows Vista. Which means we can't rely
- on the API being available. So we'll have to resolve manually. */
- HMODULE kernel = GetModuleHandleW(L"kernel32");
-
- GetGroupCountProc GetActiveProcessorGroupCount
- = (GetGroupCountProc)(void*)
- GetProcAddress(kernel, "GetActiveProcessorGroupCount");
n_groups = GetActiveProcessorGroupCount();
IF_DEBUG(scheduler, debugBelch("[*] Number of processor groups detected: %u\n", n_groups));
@@ -346,21 +328,10 @@ getProcessorsDistribution (void)
cpuGroupDistCache = malloc(n_groups * sizeof(uint8_t));
memset(cpuGroupDistCache, MAXIMUM_PROCESSORS, n_groups * sizeof(uint8_t));
- /* We still support Windows Vista. Which means we can't rely
- on the API being available. So we'll have to resolve manually. */
- HMODULE kernel = GetModuleHandleW(L"kernel32");
-
- GetItemCountProc GetActiveProcessorCount
- = (GetItemCountProc)(void*)
- GetProcAddress(kernel, "GetActiveProcessorCount");
-
- if (GetActiveProcessorCount)
+ for (int i = 0; i < n_groups; i++)
{
- for (int i = 0; i < n_groups; i++)
- {
- cpuGroupDistCache[i] = GetActiveProcessorCount(i);
- IF_DEBUG(scheduler, debugBelch("[*] Number of active processors in group %u detected: %u\n", i, cpuGroupDistCache[i]));
- }
+ cpuGroupDistCache[i] = GetActiveProcessorCount(i);
+ IF_DEBUG(scheduler, debugBelch("[*] Number of active processors in group %u detected: %u\n", i, cpuGroupDistCache[i]));
}
}
@@ -449,14 +420,7 @@ getNumberOfProcessors (void)
static uint32_t nproc = 0;
#if defined(x86_64_HOST_ARCH)
- /* We still support Windows Vista. Which means we can't rely
- on the API being available. So we'll have to resolve manually. */
- HMODULE kernel = GetModuleHandleW(L"kernel32");
-
- GetItemCountProc GetActiveProcessorCount
- = (GetItemCountProc)(void*)
- GetProcAddress(kernel, "GetActiveProcessorCount");
- if (GetActiveProcessorCount && !nproc)
+ if (!nproc)
{
nproc = GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
@@ -517,21 +481,11 @@ setThreadAffinity (uint32_t n, uint32_t m) // cap N of M
mask[group] |= 1 << ix;
}
-#if defined(x86_64_HOST_ARCH)
- /* We still support Windows Vista. Which means we can't rely
- on the API being available. So we'll have to resolve manually. */
- HMODULE kernel = GetModuleHandleW(L"kernel32");
-
- SetThreadGroupAffinityProc SetThreadGroupAffinity
- = (SetThreadGroupAffinityProc)(void*)
- GetProcAddress(kernel, "SetThreadGroupAffinity");
-#endif
-
for (i = 0; i < n_groups; i++)
{
#if defined(x86_64_HOST_ARCH)
// If we support the new API, use it.
- if (mask[i] > 0 && SetThreadGroupAffinity)
+ if (mask[i] > 0)
{
GROUP_AFFINITY hGroup;
ZeroMemory(&hGroup, sizeof(hGroup));
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/876285e76dd44039bc37bd1c8a8b24f8c86b6f83...c0f4bcc07d887fd932e10bff91b372b7142b7050
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/876285e76dd44039bc37bd1c8a8b24f8c86b6f83...c0f4bcc07d887fd932e10bff91b372b7142b7050
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200527/5ff95702/attachment-0001.html>
More information about the ghc-commits
mailing list