google / filament

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
https://google.github.io/filament/
Apache License 2.0
17.7k stars 1.87k forks source link

Repeated calls to sched_setaffinity slow down rendering #7748

Closed nimrod-gileadi closed 5 months ago

nimrod-gileadi commented 5 months ago

I have a program that performs off-screen rendering of a simple scene repeatedly, as fast as possible. When I run it, I get 450 fps. Looking at a CPU profiler, I noticed that the sched_setaffinity system call was taking a lot of time.

When I comment out this line, I get 600 fps on the same benchmark:

https://github.com/google/filament/blob/05ce5ead8d93b3adc30e78941f56550bdf9f885d/libs/utils/src/JobSystem.cpp#L442

Given the comments, it sounds like this is working around an Android issue. Would it be possible to make this build-configurable, to avoid paying this cost on other linux platforms?

Logs

WARNING: Using soft CircularBuffer (6144 KiB)
FEngine (64 bits) created at 0x56514cc73500 (threading is enabled)
FEngine resolved backend: Vulkan
Vulkan device driver: NVIDIA 525.147.05
Selected physical device 'NVIDIA GeForce RTX 2080 Ti' from 2 physical devices. (vendor 0x10de, device 0x1e04, driver 0x8364c140, api 1.3)
Backend feature level: 1
FEngine feature level: 1

Desktop (please complete the following information):

pixelflinger commented 5 months ago

note: Similar to b/333949404