From 6668d4c975af6bbe155180ba0437e1e620cdc082 Mon Sep 17 00:00:00 2001 From: R0D4X Date: Tue, 1 Dec 2026 18:45:09 +0100 Subject: [PATCH] runtime: track queued and CPU fence rewinds via monotonic queue order fence --- CMakePresets.json | 4 +- src/startup_stubs/d3d12_xs_device.cpp | 127 +++++++++++---- tests/cmake/startup_fence_rewind.cmake | 9 ++ tests/startup_fence_rewind.cpp | 207 +++++++++++++++++++++++++ 4 files changed, 317 insertions(+), 30 deletions(-) create mode 100644 tests/cmake/startup_fence_rewind.cmake create mode 100644 tests/startup_fence_rewind.cpp diff --git a/CMakePresets.json b/CMakePresets.json index 6bd4804f08..19179cecca 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -35,7 +35,7 @@ "xmem_run_break_readers_check", "xmem_run_break_readers_control", "xmem_cross_call_merge_check", "xmem_placeholder_split_check", "xmem_map_split_first_check", "startup_dstorage_break_window_check", "xmem_page_runs_device_check", "linear_buffer_backing_check", - "bcpack_formats_check", "startup_stub_consumer", "startup_inline_retire", "startup_resource_retire_title", "startup_table_lock", + "bcpack_formats_check", "startup_stub_consumer", "startup_inline_retire", "startup_resource_retire_title", "startup_table_lock", "startup_fence_rewind", "native_compute_ir_dump", "native_pixel_ir_dump", "native_store_replay", "native_raw_buffer_view_check" ] }, @@ -50,7 +50,7 @@ "displayName": "Windows pull request smoke tests", "filter": { "include": { - "name": "^(bcpack_all_formats(_golden_control)?|startup_bcpack_storage|desktop_root_signature|era_heap_(allocation|failure)|xmem_shim_mapped_pages|cpu_aot_fuzz_smoke|cpu_archive_texture_gpu_warp|dual_uav_warp|spirv_.*_warp|static_exe_intake|descriptor_heap_paging(_swapped)?_warp|startup_launch|startup_mesh57_real_shape|startup_mesh57_runtime(_[a-z]+)?_warp|native_fixed_mesh57_published_pair(_refusal)?_warp|startup_tools_lint|startup_gfx2hlsl_cvt_off_f32_i4_controls|startup_gfx2hlsl_sad_hi_msad_controls|startup_indirect_(dispatch|count_split|draw(_indexed)?|mesh(_xmem_arguments(_skip_wait)?)?|counts_control)_warp|startup_indirect_(dispatch|constants|count)_inline_warp|startup_inline_retire_(on|control)_warp|startup_resource_retire_title_inline_warp_debug0|startup_table_lock_(control_)?warp|startup_indirect_mesh_lease_warp_dual(-trace(-disabled)?)?|startup_indirect_mesh_cache_heap(_wide)?_warp|runtime_mesh86_cache_cli_check|startup_shader_cache_key|startup_present_readback|startup_present_planes(_control)?|startup_present_composite_(warp|overlay_removed_control_warp)|startup_mesh_title_snapshot_warp|startup_list_copy_(warp|title_snapshot_warp|validation(_[a-z_]+_control)?)|xmem_(run_break_readers|cross_call_merge|placeholder_split|map_split_first)(_[a-z_]+)?|startup_dstorage_break_window(_[a-z_]+)?|xmem_page_runs_device(_join)?_warp|linear_buffer_backing_share_warp|startup_stage_package|startup_compute_packed_d16_x_uav_reference|native_.*_(ir|dxil|controls)|native_direct_mesh|startup_triage_run)$" + "name": "^(bcpack_all_formats(_golden_control)?|startup_bcpack_storage|desktop_root_signature|era_heap_(allocation|failure)|xmem_shim_mapped_pages|cpu_aot_fuzz_smoke|cpu_archive_texture_gpu_warp|dual_uav_warp|spirv_.*_warp|static_exe_intake|descriptor_heap_paging(_swapped)?_warp|startup_launch|startup_mesh57_real_shape|startup_mesh57_runtime(_[a-z]+)?_warp|native_fixed_mesh57_published_pair(_refusal)?_warp|startup_tools_lint|startup_gfx2hlsl_cvt_off_f32_i4_controls|startup_gfx2hlsl_sad_hi_msad_controls|startup_indirect_(dispatch|count_split|draw(_indexed)?|mesh(_xmem_arguments(_skip_wait)?)?|counts_control)_warp|startup_indirect_(dispatch|constants|count)_inline_warp|startup_inline_retire_(on|control)_warp|startup_resource_retire_title_inline_warp_debug0|startup_table_lock_(control_)?warp|startup_fence_rewind_warp|startup_indirect_mesh_lease_warp_dual(-trace(-disabled)?)?|startup_indirect_mesh_cache_heap(_wide)?_warp|runtime_mesh86_cache_cli_check|startup_shader_cache_key|startup_present_readback|startup_present_planes(_control)?|startup_present_composite_(warp|overlay_removed_control_warp)|startup_mesh_title_snapshot_warp|startup_list_copy_(warp|title_snapshot_warp|validation(_[a-z_]+_control)?)|xmem_(run_break_readers|cross_call_merge|placeholder_split|map_split_first)(_[a-z_]+)?|startup_dstorage_break_window(_[a-z_]+)?|xmem_page_runs_device(_join)?_warp|linear_buffer_backing_share_warp|startup_stage_package|startup_compute_packed_d16_x_uav_reference|native_.*_(ir|dxil|controls)|native_direct_mesh|startup_triage_run)$" } } }, diff --git a/src/startup_stubs/d3d12_xs_device.cpp b/src/startup_stubs/d3d12_xs_device.cpp index 0a3ddf5832..6533661ba5 100644 --- a/src/startup_stubs/d3d12_xs_device.cpp +++ b/src/startup_stubs/d3d12_xs_device.cpp @@ -237,6 +237,10 @@ struct alignas(16) WrapperOwn { // Fence: the completed value the title polls through the address from slot 12 (monitorx/mwaitx). // Updated when the fence is signaled; GPU work counts as complete at once while lists are no-ops. volatile LONG64 completed; + SRWLOCK fence_lock; // Fence: serializes Signal() and completion shadow updates + SRWLOCK queue_order_lock; // CommandQueue: pairs queue->Signal(fence) with queue_order_fence + ID3D12Fence* queue_order_fence; // CommandQueue: strictly monotonic tracker for queued signal completion + u64 queue_order_next; // CommandQueue: next monotonic value on queue_order_fence bool list_open; // CommandList (render mode): recording between reset and close x2w_upload::Arena* list_uploads; // Current recording's allocations, owned by its desktop allocator. ID3D12Resource* list_scratch; // Current recording's rectangle-list argument scratch, owned by its desktop allocator. @@ -295,14 +299,25 @@ struct Wrapper { WrapperOwn& own() const { return const_cast(reinterpret_cast(this))[-1]; } }; -void fence_reached(Wrapper* fence, std::uint64_t value) noexcept +// Reads the actual desktop fence value and updates the cached completion word under fence_lock. +// Using the desktop value instead of a cached target prevents delayed callbacks or concurrent CPU +// signals from publishing a stale value over a newer advance or rewind (#3280). +void publish_fence_completed(Wrapper* fence) noexcept { - LONG64 seen = fence->own().completed; - while (static_cast(seen) < value || seen == -1) { - const LONG64 previous = InterlockedCompareExchange64(&fence->own().completed, static_cast(value), seen); - if (previous == seen) break; - seen = previous; - } + if (!fence || !fence->own().real) return; + AcquireSRWLockExclusive(&fence->own().fence_lock); + const UINT64 actual = static_cast(fence->own().real)->GetCompletedValue(); + InterlockedExchange64(&fence->own().completed, static_cast(actual)); + ReleaseSRWLockExclusive(&fence->own().fence_lock); +} + +// Direct publication for the non-render no-op path where no GPU work is submitted. +void publish_fence_value(Wrapper* fence, std::uint64_t value) noexcept +{ + if (!fence) return; + AcquireSRWLockExclusive(&fence->own().fence_lock); + InterlockedExchange64(&fence->own().completed, static_cast(value)); + ReleaseSRWLockExclusive(&fence->own().fence_lock); } // Descriptor heaps created over title memory: title CPU handles in [title, title + bytes) map to @@ -2537,31 +2552,89 @@ HRESULT __stdcall list_close(Wrapper* self) return hr; } -// A fence signalled on a queue completes when the desktop GPU reaches it. +// A fence signalled on a queue completes when the desktop GPU reaches a strictly monotonic +// per-queue order fence signalled immediately after the guest fence. Waiting on the order fence +// prevents SetEventOnCompletion from firing early when the guest fence rewinds below its current +// completed value (#3280). struct PendingSignal { Wrapper* fence; - UINT64 value; + ID3D12Fence* order_fence; HANDLE event; + HMODULE module; }; -void CALLBACK signal_reached(PTP_CALLBACK_INSTANCE, void* context, PTP_WAIT wait, TP_WAIT_RESULT) +void CALLBACK signal_reached(PTP_CALLBACK_INSTANCE instance, void* context, PTP_WAIT wait, TP_WAIT_RESULT) { auto* pending = static_cast(context); - fence_reached(pending->fence, pending->value); + FreeLibraryWhenCallbackReturns(instance, pending->module); + publish_fence_completed(pending->fence); + if (pending->order_fence) pending->order_fence->Release(); CloseHandle(pending->event); delete pending; CloseThreadpoolWait(wait); } -void complete_when_reached(Wrapper* fence, UINT64 value) +HRESULT queue_signal_and_track(Wrapper* queue_wrapper, Wrapper* fence, UINT64 value, bool async_track) { - auto* pending = new PendingSignal{fence, value, CreateEventW(nullptr, FALSE, FALSE, nullptr)}; - if (FAILED(static_cast(fence->own().real)->SetEventOnCompletion(value, pending->event))) { - fence_reached(fence, value); - CloseHandle(pending->event); - delete pending; - return; + auto* queue = static_cast(queue_wrapper->own().real); + auto* desktop_fence = static_cast(fence->own().real); + if (!async_track) { + const HRESULT hr = queue->Signal(desktop_fence, value); + if (SUCCEEDED(hr)) publish_fence_value(fence, value); + return hr; } - PTP_WAIT wait = CreateThreadpoolWait(&signal_reached, pending, nullptr); - SetThreadpoolWait(wait, pending->event, nullptr); + ID3D12Fence* order_fence = nullptr; + u64 order_seq = 0; + HRESULT hr = E_FAIL; + HRESULT order_hr = E_FAIL; + { + AcquireSRWLockExclusive(&queue_wrapper->own().queue_order_lock); + hr = queue->Signal(desktop_fence, value); + if (SUCCEEDED(hr)) { + if (!queue_wrapper->own().queue_order_fence) { + ID3D12Device* dev = nullptr; + if (SUCCEEDED(queue->GetDevice(IID_PPV_ARGS(&dev))) && dev) { + dev->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&queue_wrapper->own().queue_order_fence)); + dev->Release(); + } + } + if (queue_wrapper->own().queue_order_fence) { + order_seq = ++queue_wrapper->own().queue_order_next; + order_hr = queue->Signal(queue_wrapper->own().queue_order_fence, order_seq); + if (SUCCEEDED(order_hr)) { + order_fence = queue_wrapper->own().queue_order_fence; + order_fence->AddRef(); + } + } + } + ReleaseSRWLockExclusive(&queue_wrapper->own().queue_order_lock); + } + if (FAILED(hr)) return hr; + if (FAILED(order_hr) || !order_fence) { + publish_fence_completed(fence); + return hr; + } + HANDLE event = CreateEventW(nullptr, FALSE, FALSE, nullptr); + HMODULE module = nullptr; + auto* pending = event ? new (std::nothrow) PendingSignal{fence, order_fence, event, nullptr} : nullptr; + PTP_WAIT wait = nullptr; + if (pending && + GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, + reinterpret_cast(&signal_reached), &module)) { + pending->module = module; + wait = CreateThreadpoolWait(&signal_reached, pending, nullptr); + if (wait) { + SetThreadpoolWait(wait, event, nullptr); + if (SUCCEEDED(order_fence->SetEventOnCompletion(order_seq, event))) return hr; + SetThreadpoolWait(wait, nullptr, nullptr); + WaitForThreadpoolWaitCallbacks(wait, TRUE); + CloseThreadpoolWait(wait); + } + FreeLibrary(module); + } + delete pending; + if (event) CloseHandle(event); + order_fence->Release(); + publish_fence_completed(fence); + return hr; } // The queued diagnostic readback's ownership: the submitted surface and queue references, the @@ -5831,8 +5904,11 @@ void __stdcall queue_execute(Wrapper* self, UINT count, void* const* lists) // Fence slot 10, desktop Signal(value) (also used by the DirectStorage stand-in's EnqueueSignal). HRESULT __stdcall fence_signal(Wrapper* self, UINT64 value) { + AcquireSRWLockExclusive(&self->own().fence_lock); const HRESULT hr = static_cast(self->own().real)->Signal(value); - fence_reached(self, value); + const UINT64 actual = static_cast(self->own().real)->GetCompletedValue(); + InterlockedExchange64(&self->own().completed, static_cast(actual)); + ReleaseSRWLockExclusive(&self->own().fence_lock); return hr; } // Fence slot 8, desktop GetCompletedValue(). @@ -5891,13 +5967,8 @@ __declspec(noinline) u64 queue_dynamic(Wrapper* self, u64 rdx, u64 r8, u64 r9) static LONG calls; const bool log_it = first_calls(calls, 2); if (Wrapper* fence = as_wrapper(reinterpret_cast(rdx)); fence && fence->own().kind == fence_kind) { - const HRESULT hr = static_cast(self->own().real)->Signal(static_cast(fence->own().real), r8); - if (SUCCEEDED(hr)) { - if (render_mode() || InterlockedCompareExchange(&self->own().queue_wait_seen, 0, 0)) - complete_when_reached(fence, r8); - else - fence_reached(fence, r8); - } + const bool async_track = render_mode() || InterlockedCompareExchange(&self->own().queue_wait_seen, 0, 0) != 0; + const HRESULT hr = queue_signal_and_track(self, fence, r8, async_track); if (log_it) log("x2w-d3d12 CommandQueue::slot%d(fence=%p, value=0x%llx) -> Signal 0x%08lx", N, static_cast(fence), r8, static_cast(hr)); diff --git a/tests/cmake/startup_fence_rewind.cmake b/tests/cmake/startup_fence_rewind.cmake new file mode 100644 index 0000000000..a0848acc3a --- /dev/null +++ b/tests/cmake/startup_fence_rewind.cmake @@ -0,0 +1,9 @@ +# Queued and CPU fence rewinds through the D3D12 stand-in (Fixes #3280). +add_executable(startup_fence_rewind tests/startup_fence_rewind.cpp) +target_compile_features(startup_fence_rewind PRIVATE cxx_std_17) +target_link_libraries(startup_fence_rewind PRIVATE d3d12_xs_shim d3d12 dxgi) +foreach(backend IN ITEMS warp hardware) + add_test(NAME startup_fence_rewind_${backend} COMMAND startup_fence_rewind ${backend}) + set_tests_properties(startup_fence_rewind_${backend} PROPERTIES TIMEOUT 60 SKIP_RETURN_CODE 77 + ENVIRONMENT "X2W_D3D12_PERMISSIVE=1;X2W_D3D12_LIST_NOOP=1;X2W_D3D12_RENDER=1;X2W_D3D12_DEBUG=1") +endforeach() diff --git a/tests/startup_fence_rewind.cpp b/tests/startup_fence_rewind.cpp new file mode 100644 index 0000000000..9ef4b02486 --- /dev/null +++ b/tests/startup_fence_rewind.cpp @@ -0,0 +1,207 @@ +// Queued and CPU fence rewinds through the D3D12 stand-in (Fixes #3280). +// +// startup_fence_rewind +// +// Exercises: +// 1. CPU Signal rewinds (9 -> 2 -> 0 -> 7) and 64-bit values on both slot 8 +// (GetCompletedValue) and slot 12 (the polled completion word). +// 2. Queued Signal rewind while blocked on a separate gate fence: +// Wait(gate, 1), Signal(target, 3), Signal(marker, 1). While gate is 0, +// target must remain 7 (SetEventOnCompletion must not fire early). After +// gate is signalled and marker completes, both the completion word and +// GetCompletedValue must reach 3. +// 3. Queued advance after rewind (Signal(target, 11)). +// 4. Mixed queue-then-CPU rewind (queued Signal(20), then CPU Signal(4)). +// 5. Concurrent CPU signals on one fence leave the completion word consistent. +// +// Exit codes: 0 pass, 77 no physical adapter, other values name the failing step. +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +using Microsoft::WRL::ComPtr; +extern "C" __declspec(dllimport) HRESULT WINAPI D3D12XboxCreateDevice(IUnknown*, const void*, REFIID, void**); + +namespace { +using Word = std::uint64_t; +template Word arg(T* value) { return reinterpret_cast(value); } +Word invoke(void* object, unsigned index, Word a = 0, Word b = 0, Word c = 0, Word d = 0) +{ + using Slot = Word (WINAPI*)(void*, Word, Word, Word, Word); + return reinterpret_cast((*static_cast(object))[index])(object, a, b, c, d); +} + +void* make_fence(void* device) +{ + void* fence = nullptr; + if (FAILED(static_cast(invoke(device, 36, 0, 0, arg(&__uuidof(ID3D12Fence)), arg(&fence))))) return nullptr; + return fence; +} + +Word completed(void* fence) { return invoke(fence, 8); } + +volatile LONG64* completed_address(void* fence) +{ + return reinterpret_cast(invoke(fence, 12, 0, 0, 0)); +} + +Word read_word(volatile LONG64* address) +{ + return static_cast(InterlockedCompareExchange64(address, 0, 0)); +} + +bool wait_word(volatile LONG64* address, Word expected, DWORD milliseconds) +{ + const auto deadline = GetTickCount64() + milliseconds; + while (read_word(address) != expected) { + if (GetTickCount64() >= deadline) return false; + Sleep(1); + } + return true; +} + +bool wait_at_least(void* fence, Word expected, DWORD milliseconds) +{ + const auto deadline = GetTickCount64() + milliseconds; + while (completed(fence) < expected) { + if (GetTickCount64() >= deadline) return false; + Sleep(1); + } + return true; +} +} // namespace + +int main(int argc, char** argv) +{ + if (argc != 2) return 2; + ComPtr factory; + if (FAILED(CreateDXGIFactory1(IID_PPV_ARGS(&factory)))) return 3; + ComPtr adapter; + if (std::strcmp(argv[1], "hardware") == 0) { + for (UINT n = 0;; ++n) { + ComPtr candidate; + const HRESULT hr = factory->EnumAdapterByGpuPreference(n, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, IID_PPV_ARGS(&candidate)); + if (hr == DXGI_ERROR_NOT_FOUND) return 77; + if (FAILED(hr)) return 3; + DXGI_ADAPTER_DESC1 desc{}; + if (FAILED(candidate->GetDesc1(&desc))) return 3; + if (!(desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) && + SUCCEEDED(D3D12CreateDevice(candidate.Get(), D3D_FEATURE_LEVEL_12_0, __uuidof(ID3D12Device), nullptr))) { + adapter = candidate; + break; + } + } + } else if (std::strcmp(argv[1], "warp") != 0 || FAILED(factory->EnumWarpAdapter(IID_PPV_ARGS(&adapter)))) { + return 3; + } + DXGI_ADAPTER_DESC desc{}; + if (FAILED(adapter->GetDesc(&desc))) return 3; + std::printf("adapter=%ls\n", desc.Description); + + std::array parameters{}; + void* device = nullptr; + if (FAILED(D3D12XboxCreateDevice(adapter.Get(), parameters.data(), __uuidof(ID3D12Device), &device))) return 4; + D3D12_COMMAND_QUEUE_DESC queue_desc{}; + void* queue = nullptr; + if (FAILED(static_cast(invoke(device, 8, arg(&queue_desc), arg(&__uuidof(ID3D12CommandQueue)), arg(&queue))))) + return 5; + + void* target = make_fence(device); + void* gate = make_fence(device); + void* marker = make_fence(device); + void* mixed = make_fence(device); + void* gate2 = make_fence(device); + void* marker2 = make_fence(device); + void* race = make_fence(device); + if (!target || !gate || !marker || !mixed || !gate2 || !marker2 || !race) return 6; + + volatile LONG64* target_word = completed_address(target); + volatile LONG64* mixed_word = completed_address(mixed); + volatile LONG64* race_word = completed_address(race); + if (!target_word || !mixed_word || !race_word) return 7; + + // 1. CPU Signal rewinds (including a 64-bit value) must update both method and completion word. + for (const Word value : {Word{0x100000009ULL}, Word{9}, Word{2}, Word{0}, Word{7}}) { + if (FAILED(static_cast(invoke(target, 10, value)))) return 8; + const Word method = completed(target); + const Word address = read_word(target_word); + std::printf("cpu Signal(%llu): method=%llu address=%llu\n", + static_cast(value), + static_cast(method), + static_cast(address)); + if (method != value || address != value) return 9; + } + + // 2. Queued rewind while blocked: Wait(gate, 1), Signal(target, 3), Signal(marker, 1). + if (FAILED(static_cast(invoke(queue, 17, arg(gate), 1)))) return 10; + if (FAILED(static_cast(invoke(queue, 16, arg(target), 3)))) return 11; + if (FAILED(static_cast(invoke(queue, 16, arg(marker), 1)))) return 12; + Sleep(250); + const Word blocked_word = read_word(target_word); + const Word blocked_method = completed(target); + std::printf("queue Signal(3) while blocked: method=%llu address=%llu\n", + static_cast(blocked_method), + static_cast(blocked_word)); + if (blocked_word != 7 || blocked_method != 7) return 13; + + if (FAILED(static_cast(invoke(gate, 10, 1)))) return 14; + if (!wait_at_least(marker, 1, 10000)) return 15; + // Poll the completion address before calling GetCompletedValue, matching #3280. + const bool rewound = wait_word(target_word, 3, 5000); + const Word after_word = read_word(target_word); + const Word after_method = completed(target); + std::printf("queue Signal(3) after unblock: method=%llu address=%llu\n", + static_cast(after_method), + static_cast(after_word)); + if (!rewound || after_word != 3 || after_method != 3) return 16; + + // 3. Queued advance after rewind. + if (FAILED(static_cast(invoke(queue, 16, arg(target), 11)))) return 17; + if (!wait_word(target_word, 11, 5000) || completed(target) != 11) return 18; + std::printf("queue Signal(11) after rewind: method=%llu address=%llu\n", + static_cast(completed(target)), + static_cast(read_word(target_word))); + + // 4. Mixed queue-then-CPU rewind: queued Signal(20), then CPU Signal(4) must not be overwritten. + if (FAILED(static_cast(invoke(queue, 17, arg(gate2), 1)))) return 19; + if (FAILED(static_cast(invoke(queue, 16, arg(mixed), 20)))) return 20; + if (FAILED(static_cast(invoke(queue, 16, arg(marker2), 1)))) return 21; + if (FAILED(static_cast(invoke(gate2, 10, 1)))) return 22; + if (!wait_at_least(marker2, 1, 10000)) return 23; + if (!wait_word(mixed_word, 20, 5000)) return 24; + if (FAILED(static_cast(invoke(mixed, 10, 4)))) return 25; + Sleep(100); + if (read_word(mixed_word) != 4 || completed(mixed) != 4) return 26; + std::printf("mixed queue(20) then cpu(4): method=%llu address=%llu\n", + static_cast(completed(mixed)), + static_cast(read_word(mixed_word))); + + // 5. Concurrent CPU signals leave method and completion word in agreement. + std::atomic failed{false}; + auto worker = [&](Word base) { + for (Word i = 1; i <= 500; ++i) { + if (FAILED(static_cast(invoke(race, 10, base + i)))) { + failed.store(true, std::memory_order_relaxed); + return; + } + } + }; + std::thread t1(worker, 1000), t2(worker, 2000); + t1.join(); + t2.join(); + if (failed.load()) return 27; + const Word race_m = completed(race); + const Word race_a = read_word(race_word); + if (race_m != race_a || (race_m != 1500 && race_m != 2500)) return 28; + std::printf("concurrent cpu signals: method=%llu address=%llu\n", + static_cast(race_m), + static_cast(race_a)); + return 0; +}