-
-
Notifications
You must be signed in to change notification settings - Fork 9k
Make AMF encoder utilize all VCNs #11752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
VCNs are HW units which can process encoders in parallel boosting performance if several encoders are run simultaneously. Added controller to balance load of VCNs. Made AMF context and D3D11 device and context shared between all encoder instances. Using KeyedMutex to synchronize copying from texture from OBS core to texture allocated and used in encoder caused submitting a lot of HW fences to all HW queues leading to parallel encode queues waiting for other queue's job's done and hence significant performance degradation. To work this around, encoder's texture is created as shared, it's opened and copy is done on a device used in OBS core, using synchronization on CPU.
b8364e7 to
262a981
Compare
|
Addressed comments above, squashed commits and rebased on the latest master |
|
This really should be two separate commits, if not PRs entirely. Because there are two independent changes:
I do also have to wonder if this is even necessary anymore, at least on my machine with a 7700 XT and the latest driver I can observe that multiple FFmpeg sessions will automatically be balanced among VCN units without manual intervention. Additoinally, the number of sessions per VCN should be global, not per-codec, as all codecs share throughput on AMD cards. Ideally it should also track the configured pixels per second to more smartly balance across instances. Though of course ideally driver/SDK should do this automatically. |
|
It will be separated into two PRs. Auto-balancing works automatically only if hardware scheduler (HAGS) is enabled. It is not always the case and in-app balancing gives the app more control. In the future the app can decide on VCN instance selection based on more parameters like projected VCN load derived from resolution, framerate, etc. |
|
Any update on getting this merged? HAGS does not seem available on Win 10 with AMD cards unfortunately. |
Description
Make AMF encoder utilize all VCNs (HW encoding units in AMD GPUs) which are present in used GPU, currently only one VCN is used. Reduce amount of D3D devices being created by making one shared device being used by all AMF encode sessions.
Motivation and Context
When use obs-multi-rtmp plugin to run multiple streams at once this change significantly increases performance allowing to run more streams simultaneously.
How Has This Been Tested?
Run OBS on Windows 10, AMD Radeon RX 6800, and run multiple streams with obs-multi-rtmp plugin
Types of changes
Checklist: