diff options
| author | shdann <28006689+shdann@users.noreply.github.com> | 2026-11-23 04:50:46 +0300 |
|---|---|---|
| committer | shdann <28006689+shdann@users.noreply.github.com> | 2026-11-23 04:50:46 +0300 |
| commit | a1ec0cbca988e31347f1ca81df8e53367b0798bf (patch) | |
| tree | 031bd7969c9127f25370364a0c3d512b6005ac79 /runtime/test/device_proxy_test.cpp | |
| parent | 03b09a086592a197db64d91655c6e65c30764d96 (diff) | |
d3d12_xs: a proxied call writes no shared atomic after the first call of its slot
note_slot, note_heap_slot and note_child_slot did a fetch_add on the slot's hit
counter and a compare_exchange_strong on its first-call flag for each proxied
call. The compare-exchange takes the cache line for writing also when it
fails, and the flags of all slots share one or two lines, so threads that
call different slots slowed each other.
The first-call flag is now read before the compare-exchange. The hit counters
are test helpers: they count from the first call of a *_slot_hits reader or
of reset_device_proxy_stats, so a title's calls do not write them.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/device_proxy_test.cpp')
| -rw-r--r-- | runtime/test/device_proxy_test.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/test/device_proxy_test.cpp b/runtime/test/device_proxy_test.cpp index 70cae9a89..29975c363 100644 --- a/runtime/test/device_proxy_test.cpp +++ b/runtime/test/device_proxy_test.cpp | |||
| @@ -166,6 +166,15 @@ int main() { | |||
| 166 | if (slots > 67) check(proxy_vtbl[67] != real_vtbl[67], "slot 67 thunk differs from PC CreateProtectedResourceSession1"); | 166 | if (slots > 67) check(proxy_vtbl[67] != real_vtbl[67], "slot 67 thunk differs from PC CreateProtectedResourceSession1"); |
| 167 | if (slots > 76) check(proxy_vtbl[76] != real_vtbl[76], "slot 76 thunk differs from PC CreateCommittedResource3"); | 167 | if (slots > 76) check(proxy_vtbl[76] != real_vtbl[76], "slot 76 thunk differs from PC CreateCommittedResource3"); |
| 168 | 168 | ||
| 169 | // The hit counters are for tests and count from the first read or reset, so that a title's calls write no | ||
| 170 | // shared counter. The QueryInterface of the creation above was before that: its flag is set, its hit is not. | ||
| 171 | check(rt::d3d12_xs::device_slot_first_call_seen(0), "slot 0 first-call flag is set by the creation"); | ||
| 172 | check(rt::d3d12_xs::device_slot_hits(0) == 0, "slot 0 has no hit before the first read of a counter"); | ||
| 173 | device->AddRef(); | ||
| 174 | device->Release(); | ||
| 175 | check(rt::d3d12_xs::device_slot_hits(1) == 1 && rt::d3d12_xs::device_slot_hits(2) == 1, | ||
| 176 | "slots 1 and 2 count the calls after the first read"); | ||
| 177 | |||
| 169 | rt::d3d12_xs::reset_device_proxy_stats(); | 178 | rt::d3d12_xs::reset_device_proxy_stats(); |
| 170 | 179 | ||
| 171 | // QI/refcount behaviour: device interfaces resolve to the same proxy, non-device IIDs do not. | 180 | // QI/refcount behaviour: device interfaces resolve to the same proxy, non-device IIDs do not. |