Skip to content
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

Implement multi-threading to fully utilize computing resources #1306

Open
k4yt3x opened this issue Jan 24, 2025 · 6 comments
Open

Implement multi-threading to fully utilize computing resources #1306

k4yt3x opened this issue Jan 24, 2025 · 6 comments
Labels
state:Backlog This issue will be worked on in the future type:Enhancement New feature or request

Comments

@k4yt3x
Copy link
Owner

k4yt3x commented Jan 24, 2025

This ticket tracks the implementation of multi-threading.

Right now only the decoder and encoder are multi-threaded. The processors (Real-ESRGAN, RIFE, etc.) can also be multi-threaded to better utilize the available computing power and VRAM. This requires a major redesign of the processing pipeline. The structure will look something like:

flowchart LR
    A(Decoder Thread) -->|Decoded AVFrames| Q1(Queue)
    Q1 -->|Work stealing| T1(Processor Thread 1)
    Q1 -->|Work stealing| T2(Processor Thread 2)
    Q1 -->|Work stealing| T3(Processor Thread 3)
    T1 -->|Processed AVFrames| Q2(Queue)
    T2 -->|Processed AVFrames| Q2
    T3 -->|Processed AVFrames| Q2
    Q2 --> E(Encoder Thread)
Loading
@k4yt3x k4yt3x added the type:Enhancement New feature or request label Jan 24, 2025
@github-actions github-actions bot added the state:Backlog This issue will be worked on in the future label Jan 24, 2025
@Pete4K
Copy link

Pete4K commented Jan 25, 2025

That would be totally great. My Processors are all cold and don't do anything. Only my GPU is working. Btw.: Thanks for the upload. I will test it.

@Pete4K
Copy link

Pete4K commented Jan 25, 2025

Would it be an idea to combine TensorRT and NCNN for efficient inference across many GPUs for still better speed, too? I don't know if TensorRT works with this.

@Pete4K
Copy link

Pete4K commented Jan 25, 2025

It seems that TensorRT could possibly make Real ESRGAN x4 Plus faster: https://github.com/yuvraj108c/ComfyUI-Upscaler-Tensorrt

@k4yt3x
Copy link
Owner Author

k4yt3x commented Jan 26, 2025

My Processors are all cold and don't do anything. Only my GPU is working.

I don't think I'll do multi-GPU support just yet. The workload will still be on on GPU.

Would it be an idea to combine TensorRT and NCNN for efficient inference across many GPUs for still better speed, too?

TensorRT only works on NVIDIA GPUs. If we need to support it then we'll need to support multiple backends simultaneously and dynamically select which one to use during runtme. We'll also need to include multiple versions of models. I don't think that's ideal. This better belongs under #1231.

@Pete4K
Copy link

Pete4K commented Jan 27, 2025

Sorry, I don't mean GPU-Multi Support. I meant only implementing multi-threading would be a great Idea.

@Pete4K
Copy link

Pete4K commented Jan 27, 2025

Ok, when the Models are supported ist the best thing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:Backlog This issue will be worked on in the future type:Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants