-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
windows: provide more accurate result for available_parallelism if cores > 64 #114856
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,6 +203,16 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { | |
)?; | ||
} | ||
|
||
// Number of cores, but more accurate vaulue, than GetSystemInfo.dwNumberOfProcessors | ||
// if number of cores > 64. If called with ALL_PROCESSOR_GROUPS as groupnumber, | ||
// returns total number of cores, instead of number in group, see | ||
// https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getactiveprocessorcount | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This sounds like we should do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
"GetActiveProcessorCount" => { | ||
let [groupnumber] = this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?; | ||
this.read_scalar(groupnumber)?.to_u16()?; | ||
this.write_scalar(Scalar::from_u32(this.machine.num_cpus), dest)?; | ||
} | ||
|
||
// Thread-local storage | ||
"TlsAlloc" => { | ||
// This just creates a key; Windows does not natively support TLS destructors. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
microsoft/win32metadata@8f70180
will be changed to
Windows.Win32.System.Threading.Apis.ALL_PROCESSOR_GROUPS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... I've been thinking about this some more. Could you move the correct definition of
ALL_PROCESSOR_GROUPS
intoc.rs
? That way we can keep all theFIXME
s into one file so they're easier to find and fix when the bindings are next updated. Otherwise it might be easier to forget about it.