-
Notifications
You must be signed in to change notification settings - Fork 430
Fix binding of co-locales to architectural features #27243
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
Draft
jhh67
wants to merge
9
commits into
chapel-lang:main
Choose a base branch
from
jhh67:T27220
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
+416
−165
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-locales should be bound to architectural features (such as sockets) only if those features have the same (non-zero) number of PUs. For example, the Apple M3 Pro has two L2 caches, one with only efficiency cores and one with only performance cores. By default, the Chapel runtime only uses performance cores, so if co-locales are bound to L2 caches then one won't have any PUs. This commit corrects the problem by checking that all features of the same type have the same (non-zero) number of PUs. Signed-off-by: John H. Hartman <jhh67@users.noreply.github.com>
Signed-off-by: John H. Hartman <jhh67@users.noreply.github.com>
Here is the XML of my machine topography for a test case <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topology SYSTEM "hwloc2.dtd">
<topology version="2.0">
<object type="Machine" os_index="0" cpuset="0x000003ff" complete_cpuset="0x000003ff" allowed_cpuset="0x000003ff" nodeset="0x00000001" complete_nodeset="0x00000001" allowed_nodeset="0x00000001" gp_index="1">
<info name="Backend" value="Darwin"/>
<info name="OSName" value="Darwin"/>
<info name="OSRelease" value="24.4.0"/>
<info name="OSVersion" value="Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:47 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6000"/>
<info name="HostName" value="HPE-D2RLK75V43"/>
<info name="Architecture" value="arm64"/>
<info name="hwlocVersion" value="2.12.0"/>
<info name="ProcessName" value="lstopo"/>
<object type="Package" os_index="0" cpuset="0x000003ff" complete_cpuset="0x000003ff" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="2">
<info name="CPUModel" value="Apple M1 Pro"/>
<object type="NUMANode" os_index="0" cpuset="0x000003ff" complete_cpuset="0x000003ff" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="36" local_memory="3624288256">
<page_type size="16384" count="0"/>
</object>
<object type="L2Cache" cpuset="0x00000003" complete_cpuset="0x00000003" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="17" cache_size="4194304" depth="2" cache_linesize="128" cache_associativity="0" cache_type="0">
<object type="L1Cache" cpuset="0x00000001" complete_cpuset="0x00000001" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="15" cache_size="65536" depth="1" cache_linesize="128" cache_associativity="0" cache_type="1">
<object type="L1iCache" cpuset="0x00000001" complete_cpuset="0x00000001" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="13" cache_size="131072" depth="1" cache_linesize="128" cache_associativity="0" cache_type="2">
<object type="Core" os_index="0" cpuset="0x00000001" complete_cpuset="0x00000001" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="3">
<object type="PU" os_index="0" cpuset="0x00000001" complete_cpuset="0x00000001" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="37"/>
</object>
</object>
</object>
<object type="L1Cache" cpuset="0x00000002" complete_cpuset="0x00000002" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="16" cache_size="65536" depth="1" cache_linesize="128" cache_associativity="0" cache_type="1">
<object type="L1iCache" cpuset="0x00000002" complete_cpuset="0x00000002" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="14" cache_size="131072" depth="1" cache_linesize="128" cache_associativity="0" cache_type="2">
<object type="Core" os_index="1" cpuset="0x00000002" complete_cpuset="0x00000002" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="4">
<object type="PU" os_index="1" cpuset="0x00000002" complete_cpuset="0x00000002" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="38"/>
</object>
</object>
</object>
</object>
<object type="L2Cache" cpuset="0x0000003c" complete_cpuset="0x0000003c" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="34" cache_size="12582912" depth="2" cache_linesize="128" cache_associativity="0" cache_type="0">
<object type="L1Cache" cpuset="0x00000004" complete_cpuset="0x00000004" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="26" cache_size="131072" depth="1" cache_linesize="128" cache_associativity="0" cache_type="1">
<object type="L1iCache" cpuset="0x00000004" complete_cpuset="0x00000004" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="18" cache_size="196608" depth="1" cache_linesize="128" cache_associativity="0" cache_type="2">
<object type="Core" os_index="2" cpuset="0x00000004" complete_cpuset="0x00000004" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="5">
<object type="PU" os_index="2" cpuset="0x00000004" complete_cpuset="0x00000004" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="39"/>
</object>
</object>
</object>
<object type="L1Cache" cpuset="0x00000008" complete_cpuset="0x00000008" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="27" cache_size="131072" depth="1" cache_linesize="128" cache_associativity="0" cache_type="1">
<object type="L1iCache" cpuset="0x00000008" complete_cpuset="0x00000008" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="19" cache_size="196608" depth="1" cache_linesize="128" cache_associativity="0" cache_type="2">
<object type="Core" os_index="3" cpuset="0x00000008" complete_cpuset="0x00000008" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="6">
<object type="PU" os_index="3" cpuset="0x00000008" complete_cpuset="0x00000008" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="40"/>
</object>
</object>
</object>
<object type="L1Cache" cpuset="0x00000010" complete_cpuset="0x00000010" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="28" cache_size="131072" depth="1" cache_linesize="128" cache_associativity="0" cache_type="1">
<object type="L1iCache" cpuset="0x00000010" complete_cpuset="0x00000010" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="20" cache_size="196608" depth="1" cache_linesize="128" cache_associativity="0" cache_type="2">
<object type="Core" os_index="4" cpuset="0x00000010" complete_cpuset="0x00000010" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="7">
<object type="PU" os_index="4" cpuset="0x00000010" complete_cpuset="0x00000010" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="41"/>
</object>
</object>
</object>
<object type="L1Cache" cpuset="0x00000020" complete_cpuset="0x00000020" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="29" cache_size="131072" depth="1" cache_linesize="128" cache_associativity="0" cache_type="1">
<object type="L1iCache" cpuset="0x00000020" complete_cpuset="0x00000020" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="21" cache_size="196608" depth="1" cache_linesize="128" cache_associativity="0" cache_type="2">
<object type="Core" os_index="5" cpuset="0x00000020" complete_cpuset="0x00000020" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="8">
<object type="PU" os_index="5" cpuset="0x00000020" complete_cpuset="0x00000020" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="42"/>
</object>
</object>
</object>
</object>
<object type="L2Cache" cpuset="0x000003c0" complete_cpuset="0x000003c0" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="35" cache_size="12582912" depth="2" cache_linesize="128" cache_associativity="0" cache_type="0">
<object type="L1Cache" cpuset="0x00000040" complete_cpuset="0x00000040" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="30" cache_size="131072" depth="1" cache_linesize="128" cache_associativity="0" cache_type="1">
<object type="L1iCache" cpuset="0x00000040" complete_cpuset="0x00000040" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="22" cache_size="196608" depth="1" cache_linesize="128" cache_associativity="0" cache_type="2">
<object type="Core" os_index="6" cpuset="0x00000040" complete_cpuset="0x00000040" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="9">
<object type="PU" os_index="6" cpuset="0x00000040" complete_cpuset="0x00000040" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="43"/>
</object>
</object>
</object>
<object type="L1Cache" cpuset="0x00000080" complete_cpuset="0x00000080" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="31" cache_size="131072" depth="1" cache_linesize="128" cache_associativity="0" cache_type="1">
<object type="L1iCache" cpuset="0x00000080" complete_cpuset="0x00000080" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="23" cache_size="196608" depth="1" cache_linesize="128" cache_associativity="0" cache_type="2">
<object type="Core" os_index="7" cpuset="0x00000080" complete_cpuset="0x00000080" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="10">
<object type="PU" os_index="7" cpuset="0x00000080" complete_cpuset="0x00000080" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="44"/>
</object>
</object>
</object>
<object type="L1Cache" cpuset="0x00000100" complete_cpuset="0x00000100" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="32" cache_size="131072" depth="1" cache_linesize="128" cache_associativity="0" cache_type="1">
<object type="L1iCache" cpuset="0x00000100" complete_cpuset="0x00000100" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="24" cache_size="196608" depth="1" cache_linesize="128" cache_associativity="0" cache_type="2">
<object type="Core" os_index="8" cpuset="0x00000100" complete_cpuset="0x00000100" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="11">
<object type="PU" os_index="8" cpuset="0x00000100" complete_cpuset="0x00000100" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="45"/>
</object>
</object>
</object>
<object type="L1Cache" cpuset="0x00000200" complete_cpuset="0x00000200" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="33" cache_size="131072" depth="1" cache_linesize="128" cache_associativity="0" cache_type="1">
<object type="L1iCache" cpuset="0x00000200" complete_cpuset="0x00000200" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="25" cache_size="196608" depth="1" cache_linesize="128" cache_associativity="0" cache_type="2">
<object type="Core" os_index="9" cpuset="0x00000200" complete_cpuset="0x00000200" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="12">
<object type="PU" os_index="9" cpuset="0x00000200" complete_cpuset="0x00000200" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="46"/>
</object>
</object>
</object>
</object>
</object>
<object type="OSDev" gp_index="47" name="opencl0d0" subtype="OpenCL" osdev_type="5">
<info name="Backend" value="OpenCL"/>
<info name="OpenCLDeviceType" value="GPU"/>
<info name="GPUVendor" value="Apple"/>
<info name="GPUModel" value="Apple M1 Pro"/>
<info name="OpenCLPlatformIndex" value="0"/>
<info name="OpenCLPlatformName" value="Apple"/>
<info name="OpenCLPlatformDeviceIndex" value="0"/>
<info name="OpenCLComputeUnits" value="16"/>
<info name="OpenCLGlobalMemorySize" value="11184816"/>
</object>
</object>
<support name="discovery.pu"/>
<support name="discovery.numa"/>
<support name="discovery.cpukind_efficiency"/>
<support name="custom.exported_support"/>
<cpukind cpuset="0x00000003" forced_efficiency="0">
<info name="DarwinCompatible" value="apple,icestorm;ARM,v8"/>
</cpukind>
<cpukind cpuset="0x000003fc" forced_efficiency="1">
<info name="DarwinCompatible" value="apple,firestorm;ARM,v8"/>
</cpukind>
</topology>
|
jabraham17
approved these changes
May 22, 2025
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.
The code changes look good, this just needs the test case and its good to go
Changed the logic in the previous commit so that co-locales are bound to an architectural feature if the number of non-empty instances of that feature equals the number of co-locales, and if the non-empty instances have an equal number of cores. For example, the Apple M1Pro has three L2 caches, one of which has efficiency cores and other two have performance cores. With this change "-nl 1x2" will bind the two co-locales to the two L2 caches with performance cores, and ignore the L2 cache that has efficiency cores. Signed-off-by: John H. Hartman <jhh67@users.noreply.github.com>
Signed-off-by: John H. Hartman <jhh67@users.noreply.github.com>
Don't ask the topology layer which GPUs the locale should use when there are no GPUs. Signed-off-by: John H. Hartman <jhh67@users.noreply.github.com>
Signed-off-by: John H. Hartman <jhh67@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Co-locales should be bound to architectural features (such as sockets) only if those features have the same (non-zero) number of PUs. For example, the Apple M3 Pro has two L2 caches, one with only efficiency cores and one with only performance cores. By default, the Chapel runtime only uses performance cores, so if co-locales are bound to L2 caches then one won't have any PUs. This commit corrects the problem by checking that all features of the same type have the same (non-zero) number of PUs.
Resolves #27220.