') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Add processor affinity option for BDN runs by LoopedBard3 · Pull Request #3020 · dotnet/performance · GitHub
Skip to content

Add processor affinity option for BDN runs - #3020

Merged
LoopedBard3 merged 6 commits into
dotnet:mainfrom
LoopedBard3:AddProcessorAffinityOptions
May 12, 2023
Merged

Add processor affinity option for BDN runs#3020
LoopedBard3 merged 6 commits into
dotnet:mainfrom
LoopedBard3:AddProcessorAffinityOptions

Conversation

@LoopedBard3

Copy link
Copy Markdown
Member

This adds processor affinity passthrough option for BDN runs that is defined in the yml files. This also sets up Roslyn and Ml.NET to us this affinity parameter. This will likely be quickly iterated on once a path forward for passing environment variables through is figured out.

@LoopedBard3LoopedBard3 added the enhancement New feature or request label May 11, 2023
@LoopedBard3LoopedBard3 self-assigned this May 11, 2023
@LoopedBard3

Copy link
Copy Markdown
MemberAuthor

@LoopedBard3
LoopedBard3 marked this pull request as ready for review May 12, 2023 04:18

@cincuranetcincuranet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please split out the "PERFLAB_DATA" in Reporter into separate PR, to have nice/clean history. We can merge that first and then this.

@LoopedBard3

Copy link
Copy Markdown
MemberAuthor

Of course: #3021.

@LoopedBard3
LoopedBard3force-pushed the AddProcessorAffinityOptions branch from 7f49e8d to 03b0bb5CompareMay 12, 2023 18:03
@LoopedBard3
LoopedBard3 merged commit b694588 into dotnet:mainMay 12, 2023
@LoopedBard3
LoopedBard3 deleted the AddProcessorAffinityOptions branch May 12, 2023 19:16
@LoopedBard3

Copy link
Copy Markdown
MemberAuthor

FYI @kunalspathak, this gets in the processor affinity for MLNET and ROSLYN tests, expect to see this in the PowerBI.

Comment threadazure-pipelines.yml
runCategories: 'mldotnet'
channels:
- main
affinity: '15'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be worth mentioning the binary equivalent of them to specify that we are affinitizing every other cores for x64 because we assume hyper-threading is ON for them. Likewise for arm64.

Comment threadscripts/ci_setup.py
out_file.write(variable_format % ('UseSharedCompilation', 'false'))
out_file.write(variable_format % ('DOTNET_ROOT', dotnet_path))
out_file.write(variable_format % ('MAUI_VERSION', args.maui_version))
if args.affinity:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LoopedBard3 or @cincuranet - can one of you confirm how does this get used to set the affinity during benchmark launch?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamsitnik - I checked the BDN code, but just want to confirm my understanding. We launch the process, set the affinity mask and then start the benchmark execution, right? Because, ProcessorAffinity field of Process object can only be set after the process is launched.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We launch the process, set the affinity mask and then start the benchmark execution, right?

@kunalspathak that is correct:

start->priority->affinity

https://github.com/dotnet/BenchmarkDotNet/blob/40305b402ff795992ac9d926c8ad1aee853d8492/src/BenchmarkDotNet/Toolchains/Executor.cs#L87

@adamsitnik

Copy link
Copy Markdown
Member

This also sets up Roslyn and Ml.NET to us this affinity parameter.

May I ask what was the reason behind making this change? I am just curious.

@kunalspathak

Copy link
Copy Markdown
Contributor

This also sets up Roslyn and Ml.NET to us this affinity parameter.

May I ask what was the reason behind making this change? I am just curious.

We want to check if Arm64 has performance parity with x64 and we want to measure it in a similar configuration environment. Setting the affinity will make sure that they both are executed with same core count (since hyper threading is ON in x64, it is set to 0x55 and for Arm64 it is 0xF). Hope that helps!

@adamsitnik

Copy link
Copy Markdown
Member

@kunalspathak thanks! It makes sense now ;)

CopilotAI mentioned this pull request Mar 3, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementNew feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@LoopedBard3@adamsitnik@kunalspathak@cincuranet