Skip to content

feat(ult): implement creation-bound condition variables - #5942

Open
JJenkx wants to merge 2 commits into
boykopovar:mainfrom
JJenkx:feat/ult-bound-condition-variables
Open

JJenkx wants to merge 2 commits into
boykopovar:mainfrom
JJenkx:feat/ult-bound-condition-variables

Conversation

@JJenkx

@JJenkx JJenkx commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What

Implement _sceUltConditionVariableCreate, sceUltConditionVariableWait, sceUltConditionVariableSignal and sceUltConditionVariableDestroy with a creation-time bound mutex. Wait atomically queues the caller and releases its logical mutex, then reacquires it before successful return. Signal selects one current waiter and is not retained without a waiter. Live conditions and reacquiring waiters prevent mutex destruction. Finalization invalidates conditions and wakes queued and reacquiring waiters.

Depends on #6838, exact head 5ccf926f09ddd435285f79858f94ff79cf50799e. This branch carries that single commit with original authorship, rebased onto main f03a2da5eec6ff0fc9de5c65e6835e7a0d28b0d4, followed by this implementation. It replaces three throwing stubs from that dependency, corrects its obsolete no-argument destroy test, and removes those implemented functions from its throwing-stub debt list. Merge #6838 first; after it merges, retain only the implementation commit. This supersedes the earlier standalone version of this PR.

The bound-mutex ABI is inferred from Earthion PPSA28061 callers. Error precedence, busy/state results, FIFO selection and recursive waits have not been measured on PS5 hardware. Non-null condition options and waits at recursion depth above one throw. Scheduling priority and build-version validation remain unimplemented and documented. The existing per-mutex locking, ownership and recursive mutex behavior are preserved.

Tested

Linux x86-64, GCC Release, Ryzen 9 7950X. Refreshed head 977418f2d271c5eb370826e3f093478f3218dbc9 on main f03a2da5ee plus #6838:

  • Full runtime libs and guest_ult_condition_tests, guest_ult_queue_tests, guest_ult_thread_tests build with the official bundled submodule pins.
  • ctest --test-dir build-full -R '^guest_ult_' --output-on-failure: 17/17 pass, zero skipped, 1.01 seconds. Six condition cases cover validation, handoff, non-retained signals, signal-one behavior, 5,000 handoffs, queued finalization, finalization during mutex reacquisition and object reuse. Existing queue and thread cases also pass, including the dependency's updated destroy check.
  • The standalone implementation on the same main also builds full libs and passes 17/17 cases in 1.00 seconds, before stacking the export dependency.
  • Conventions (--base origin/main) and whitespace checks pass. No private dependency patch is used. No current-head native title run, Windows run, full project test-suite run or performance claim.
  • Ran the overlap checker. feat(libSceUlt): export missing firmware functions from database #6838 is deliberately included and declared as a dependency. Manual review of test: organize library tests and label CTest suites #6044's ULT CMake diff shows a separate test-directory/category migration; no condition implementation. If it merges first, migrate the new condition test consistently. No dependency on its test reorganization is required.

Historical title evidence remains tied to its earlier revisions: on main 385ed71f2, the same default-converted Earthion executable exits 127 with undefined symbol: jnKaHGkrxZ4 (_sceUltConditionVariableCreate); the other three condition imports are unresolved too. With implementation 8435f3bb3, the executable resolves those imports, reaches stage/combat imagery and closes normally. Later captures become identical; input-controlled gameplay and complete title correctness remain unproven. These are not current-head or performance results. Original game files are preserved; no game-derived binaries or raw title logs are published.

Earlier negative-control and hosted CI results belong to their recorded old heads: removing queued-condition finalization notification failed its regression; historical Windows CI passed all 17 ULT cases, while Linux had one unresolved graphics-suite failure outside this focused set. No full green CI claim is made for this refresh.

Evidence: tests, conventions, report and implementation patch, assets prefixed ult-f03a-.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: feat(libSceUlt): export missing firmware functions from database #6838
  • Fixes: none
  • Unblocks: none; historical Earthion PPSA28061 loader progress described above
  • GPUs tested: n/a; CPU synchronization APIs
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Progress report (19bb30c → 977418f)

📉 System libraries: 89.28% (-0.96%, +4 implemented, +42 declared functions)

✅ 4 implemented
Library Name
libSceUlt _sceUltConditionVariableCreate
libSceUlt sceUltConditionVariableDestroy
libSceUlt sceUltConditionVariableSignal
libSceUlt sceUltConditionVariableWait
🆕 42 declared as stubs
Library Name
libSceUlt sceUltAbstractThreadFactoryCreateThread
libSceUlt sceUltAbstractThreadFactoryGetNumMaxThreads
libSceUlt sceUltAbstractThreadFactoryJoinThread
libSceUlt sceUltConditionVariableCreate
libSceUlt sceUltConditionVariableOptParamInitialize
libSceUlt sceUltConditionVariableSignalAll
libSceUlt sceUltGetConditionVariableInfo
libSceUlt sceUltGetMutexInfo
libSceUlt sceUltGetQueueDataResourcePoolInfo
libSceUlt sceUltGetQueueInfo
libSceUlt sceUltGetReaderWriterLockInfo
libSceUlt sceUltGetSemaphoreInfo
libSceUlt sceUltGetUlthreadInfo
libSceUlt sceUltGetUlthreadRuntimeInfo
libSceUlt sceUltGetWaitingQueueResourcePoolInfo
libSceUlt sceUltKernelThreadFactoryFinalize
libSceUlt sceUltKernelThreadFactoryGetFactoryPointer
libSceUlt sceUltKernelThreadFactoryInitialize
libSceUlt sceUltModuleFinalize
libSceUlt sceUltModuleInitialize
libSceUlt sceUltMutexTryLock
libSceUlt sceUltQueueDataResourcePoolOptParamInitialize
libSceUlt sceUltQueueOptParamInitialize
libSceUlt sceUltReaderWriterLockCreate
libSceUlt sceUltReaderWriterLockDestroy
libSceUlt sceUltReaderWriterLockLockRead
libSceUlt sceUltReaderWriterLockLockWrite
libSceUlt sceUltReaderWriterLockOptParamInitialize
libSceUlt sceUltReaderWriterLockTryLockRead
libSceUlt sceUltReaderWriterLockTryLockWrite
libSceUlt sceUltReaderWriterLockUnlockRead
libSceUlt sceUltReaderWriterLockUnlockWrite
libSceUlt sceUltSemaphoreOptParamInitialize
libSceUlt sceUltUlthreadExit
libSceUlt sceUltUlthreadFactoryFinalize
libSceUlt sceUltUlthreadFactoryGetFactoryPointer
libSceUlt sceUltUlthreadFactoryGetWorkAreaSize
libSceUlt sceUltUlthreadFactoryInitialize
libSceUlt sceUltUlthreadGetSelf
libSceUlt sceUltUlthreadOptParamInitialize
libSceUlt sceUltUlthreadYield
libSceUlt sceUltWaitingQueueResourcePoolOptParamInitialize

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 6044 core/libs/prx/libSceUlt/CMakeLists.txt
core/libs/tests/GuestUltThread.cpp

@JJenkx
JJenkx force-pushed the feat/ult-bound-condition-variables branch from 73b761a to 581eea1 Compare October 15, 2026 13:02
@JJenkx

JJenkx commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Closing this draft to stay within the 20-open-PR limit while prioritizing the Cocoon shader-fusion fix with a reproduced native stop and a regression checked on current main. The implementation is preserved on feat/ult-bound-condition-variables at 581eea1; no code is discarded. It can be revisited when a title needs this path and a slot is available.

@JJenkx JJenkx closed this Oct 16, 2026
@JJenkx JJenkx reopened this Oct 18, 2026
@JJenkx
JJenkx force-pushed the feat/ult-bound-condition-variables branch from 581eea1 to 977418f Compare October 18, 2026 17:27
@JJenkx
JJenkx marked this pull request as ready for review October 18, 2026 17:27
@adriadam10 adriadam10 self-assigned this Oct 18, 2026
@github-actions github-actions Bot added unblocks title Names a title ID on the Unblocks line and removed unblocks title Names a title ID on the Unblocks line labels Oct 18, 2026

This branch has not been deployed

No deployments
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