Skip to content

[rocjitsu] Isolate cache locks to reduce false sharing - #13109

Merged
kuhar merged 1 commit into
developfrom
users/kuhar/sync-layout
Oct 8, 2026
Merged

kuhar merged 1 commit into
developfrom
users/kuhar/sync-layout

Conversation

@kuhar

@kuhar kuhar commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Align L2 set mutexes and sparse-memory page stripes to 64-byte boundaries so independent accesses do not write the same host cache line. Preserve set-range deduplication, lock ordering and existing mutex protocols.

On Linux x86-64, add 48 KiB per L2Cache and 16,408 bytes per SparseMemory. Across three perf captures with 32 pinned workers, controlled probes show the following reductions:

Probe User cycles L2 store/state-change requests
L2 adjacent locks 72.5% 83.7%
Sparse adjacent reads 53.6% 53.1%

Sparse-read instruction counts are unchanged. Spaced controls show no cycle benefit. Probe counters include setup and teardown. These probes force adjacent lock or stripe indices. The sparse page hash makes adjacent stripes uncommon for sequential pages. The probes show the mechanism; the application results below measure both changes together and do not establish either change's individual contribution.

For an actual HIP gather over 4,194,304 floats on simulated gfx1250 with 48 host cores, the five-pair screen gives 1.056x process and 1.093x warm speedups. Ten fresh interleaved pairs confirm 1.045x process and 1.091x warm speedups. Descriptive paired bootstrap 95% intervals are 1.007-1.084x and 1.043-1.150x, respectively.

Compare against develop 923570c with matching Clang 23 Release -O3, x86-64-v4 builds on reserved Threadripper PRO 9995WX cores. Process time includes startup and validation; warm time is the median of five launch-plus-synchronization samples after one warmup. Report paired geometric means. The gather validates every output element.

Twenty-pair gfx1201 and gfx950 IREE checks give 1.021x and 0.994x process ratios. Other results are small or inconclusive; this does not establish a general simulator speedup.

Validation: 412 focused native tests and 260 measured processes pass their checks. The existing L2 admission suite also passes 45 GCC 13 TSan test executions. A broader 37-case five-target smoke matrix also passes (correctness only, run concurrently with review). Pre-commit passes for both changed headers.

Align L2 set mutexes and sparse-memory page stripes to 64-byte boundaries
so independent accesses do not write the same host cache line. Preserve
set-range deduplication, lock ordering and existing mutex protocols.

On Linux x86-64, add 48 KiB per L2Cache and 16,408 bytes per SparseMemory.
Across three perf captures with 32 pinned workers, controlled probes
show the following reductions:

| Probe | User cycles | L2 store/state-change requests |
| --- | ---: | ---: |
| L2 adjacent locks | 72.5% | 83.7% |
| Sparse adjacent reads | 53.6% | 53.1% |

Sparse-read instruction counts are unchanged. Spaced controls show no
cycle benefit. Probe counters include setup and teardown.
These probes force adjacent lock or stripe indices. The sparse page hash
makes adjacent stripes uncommon for sequential pages. The probes show
the mechanism; the application results below measure both changes
together and do not establish either change's individual contribution.

For an actual HIP gather over 4,194,304 floats on simulated gfx1250 with
48 host cores, the five-pair screen gives 1.056x process and 1.093x warm
speedups. Ten fresh interleaved pairs confirm 1.045x process and 1.091x
warm speedups. Descriptive paired bootstrap 95% intervals are
1.007-1.084x and 1.043-1.150x, respectively.

Compare against develop 923570c with matching Clang 23 Release -O3,
x86-64-v4 builds on reserved Threadripper PRO 9995WX cores. Process time
includes startup and validation; warm time is the median of five
launch-plus-synchronization samples after one warmup. Report paired
geometric means. The gather validates every output element.

Twenty-pair gfx1201 and gfx950 IREE checks give 1.021x and 0.994x process
ratios. Other results are small or inconclusive; this does not establish
a general simulator speedup.

Validation: 412 focused native tests and 260 measured processes pass their
checks. The existing L2 admission suite also passes 45 GCC 13 TSan test
executions. A broader 37-case five-target smoke matrix also passes
(correctness only, run concurrently with review). Pre-commit passes for
both changed headers.
Copilot AI balanced review requested due to automatic review settings October 8, 2026 14:10
@kuhar
kuhar requested review from a team and atgutier as code owners October 8, 2026 14:10

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@therock-pr-bot

therock-pr-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

❌ PR Check — Action Required

Check Status Details
📝 PR Description ❌ Fail Error: PR description must reference a JIRA ID, ISSUE ID, or a GitHub closing keyword.
Expected: include a JIRA ID / ISSUE ID line (separator : or -, or omitted; value may be a JIRA key, a number with/without #, or a link), OR a closing keyword + issue reference. Accepted examples:
• JIRA ID : TESTAUTO-6039
• JIRA ID - #330
• JIRA ID #330
• JIRA ID (on separate line)
ROCM-25757
• ISSUE ID : TESTUTO-3334
• ISSUE ID #3334
• ISSUE ID - TESTAUTO-3433
• ISSUE ID (on separate line)
AIRUNTIME-2352
• ISSUE ID : https://github.com/<org_name>/<repo_name>/issues/1234
• Closes #10
• Fixes octo-org/octo-repo#100
• Resolves: #123
• #123
• https://github.com/<org_name>/<repo_name>/issues/123
Current: no valid JIRA/ISSUE/closing-keyword reference found
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ⚠️ Warning Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: emulation/rocjitsu/lib/rocjitsu/src/rocjitsu/vm/amdgpu/l2_cache.h, emulation/rocjitsu/lib/simdojo/include/simdojo/components/sparse_memory.h; no test file found
🔎 pre-commit ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

⚠️ 1 policy check(s) failed. Please address the issues above before this PR can be Reviewed.

🚫 Please fix the failed policies

  • ❌ PR Description

The Not ready to Review label was added to this PR. Once all policies pass, the label is removed automatically.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

therock-pr-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ PR Description

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

@kuhar
kuhar merged commit a19d1c2 into develop Oct 8, 2026
152 of 164 checks passed
@kuhar
kuhar deleted the users/kuhar/sync-layout branch October 8, 2026 18:27
@systems-assistant

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

anujshuk-amd pushed a commit that referenced this pull request Oct 12, 2026
Align L2 set mutexes and sparse-memory page stripes to 64-byte
boundaries so independent accesses do not write the same host cache
line. Preserve set-range deduplication, lock ordering and existing mutex
protocols.

On Linux x86-64, add 48 KiB per L2Cache and 16,408 bytes per
SparseMemory. Across three perf captures with 32 pinned workers,
controlled probes show the following reductions:

| Probe | User cycles | L2 store/state-change requests |
| --- | ---: | ---: |
| L2 adjacent locks | 72.5% | 83.7% |
| Sparse adjacent reads | 53.6% | 53.1% |

Sparse-read instruction counts are unchanged. Spaced controls show no
cycle benefit. Probe counters include setup and teardown. These probes
force adjacent lock or stripe indices. The sparse page hash makes
adjacent stripes uncommon for sequential pages. The probes show the
mechanism; the application results below measure both changes together
and do not establish either change's individual contribution.

For an actual HIP gather over 4,194,304 floats on simulated gfx1250 with
48 host cores, the five-pair screen gives 1.056x process and 1.093x warm
speedups. Ten fresh interleaved pairs confirm 1.045x process and 1.091x
warm speedups. Descriptive paired bootstrap 95% intervals are
1.007-1.084x and 1.043-1.150x, respectively.

Compare against develop 923570c with matching Clang 23 Release -O3,
x86-64-v4 builds on reserved Threadripper PRO 9995WX cores. Process time
includes startup and validation; warm time is the median of five
launch-plus-synchronization samples after one warmup. Report paired
geometric means. The gather validates every output element.

Twenty-pair gfx1201 and gfx950 IREE checks give 1.021x and 0.994x
process ratios. Other results are small or inconclusive; this does not
establish a general simulator speedup.

Validation: 412 focused native tests and 260 measured processes pass
their checks. The existing L2 admission suite also passes 45 GCC 13 TSan
test executions. A broader 37-case five-target smoke matrix also passes
(correctness only, run concurrently with review). Pre-commit passes for
both changed headers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants