AVISynth+ CUDA support

These CUDA filters are packaged into DGDecodeNV, which is part of DGDecNV.
Post Reply
DAE avatar
Guest 2
Posts: 903
Joined: Mon Sep 20, 2010 2:18 pm

AVISynth+ CUDA support

Post by Guest 2 »

Rocky wrote:
Fri Aug 26, 2022 11:45 am
That's the whole point of the (DG)CUDASynth proposal. How to make it happen?
I see, thanks for the clarification. :salute:

Isn't the AVS+ CUDA framework use feasible?
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Port Cube

Post by Rocky »

Guest 2 wrote:
Fri Aug 26, 2022 12:14 pm
Isn't the AVS+ CUDA framework use feasible?
Enlighten us all about what that is. Google search for "AVS+ CUDA support" is not bringing up anything interesting.
DAE avatar
reel.deal
Posts: 8
Joined: Fri Aug 19, 2022 1:44 pm

Port Cube

Post by reel.deal »

Maybe the information from pinterf is helpful.

https://forum.doom9.org/showthread.php? ... ost1964833
Such an Avisynth+ build does not use CUDA at all, it is just able to host such filters; the only known plugin set which is compatible with this interface is https://github.com/pinterf/AviSynthCUDAFilters which is there for people/developers who'd like to play with this interface.
https://forum.doom9.org/showthread.php? ... ost1943973
CUDA-capable Avisynth+ is simply an Avisynth+ which can support CUDA-aware filters. Nothing is accelerated inside.
https://github.com/pinterf/AviSynthCUDA ... umentation
AvisynthCUDAFilters.txt, AvisynthNeoFeatures.txt, build_help.txt
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Port Cube

Post by Rocky »

CUDA-capable Avisynth+ is simply an Avisynth+ which can support CUDA-aware filters.
I don't know what that means and reading the links doesn't tell me. Setting up a pipeline of filters that all run on the GPU without transferring data except at the start and end of the chain is what is needed. How would that be done?

Where do I download this CUDA-aware version of AVS+? Is it being maintained? Where is the filter API documented?
DAE avatar
reel.deal
Posts: 8
Joined: Fri Aug 19, 2022 1:44 pm

Port Cube

Post by reel.deal »

I don't have any experience the CUDA filters but maybe the documentation below can offer some help. I believe AviSynth+ 3.7.2 is compiled with CUDA support, I see that the filters OnCuda/OnCPU and others are available. I don't think the API is documented but section #7 has information for developers and section #9 offers a CUDA InvertNeg sample that was written by Nekopanda. As for it being maintained, back when pinterf announced the integration of the Neo fork he said that he would look into any problems people found, but so far only a few people have tried out this new feature, mainly because the only filters that are compatible are the ones originally offered by Nekopanda: https://github.com/pinterf/AviSynthCUDAFilters

I would not mind testing it out and documenting it so it can be useful for others.

To try to keep this short I removed some sections, full document can be found here: https://github.com/pinterf/AviSynthCUDA ... atures.txt
This documentation in the English translation of https://github.com/nekopanda/AviSynthPlus/wiki

1. Avisynth is CUDA compatible!

[snipped for readability -- admin]

8. CUDA compatible Avisynth filters (some by external AvsCUDA.dll)

A filter that can be used inside OnCPU() and OnCUDA().
This is the case when AvsCUDA.dll included in KFM is added.

<INFO REMOVED>

9. Sample Avisynth Filter (needs update for Avisynth+ 3.7 level)
https://github.com/nekopanda/AviSynthPlusCUDASample
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Port Cube

Post by Rocky »

That's information I already said is inadequate. And the sample filter you cited:

"needs update for Avisynth+ 3.7 level"

So it's useless. Am I supposed to guess how to update it? Go to the link. There is ZERO documentation, not even any useful comments in the code.

I did look at the code a bit and see that it always returns the frame to the CPU and back to avisynth. I see no way it could work with a following filter passing the frame without copying it back to the CPU. It uses CUDA runtime interface instead of driver interface, which reduces its flexibility and capability. An avisynth script is run from a single process, e.g., VirtualDub (or whatever application invoked the script). The runtime API gives a single primary context for the process. But we need per-thread contexts to multiply instantiate CUDA filters and have them communicate and run without interfering with each other. I discovered this the hard way and was advised by nVidia to use the driver API.

When this stuff was created 5 years ago, we had 1920x1080 stuff and PCIe transfer was not such a big deal. The need to run pipelines on the GPU was not anticipated (except by me).

You also said that there is no API documentation. Don't you understand that is a deal-breaker?

IMHO, the whole thing is a mess that was adopted without significant discussion and analysis, and without inclusion of the major players. It's no surprise that it is not being adopted.

My approach of putting everything in the filters themselves with no need for avisynth "support" is the way to go. I can do that for DGCube() and my other filters. If noone wants to use that paradigm for their filters, fine, it won't stop my filters from working. You'll just have to bring the data back to the CPU to use the other filters.

I do appreciate your posts.
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

Port Cube

Post by Rocky »

I installed 3.7.2 avisynth. I downloaded the neko sample invertneg. I built it for CUDA 11.7. My script:

loadplugin("d:\don\Programming\C++\dgdecnv\DGDecodeNV\x64\Release\dgdecodenv.dll")
loadplugin("..\x64\release\invertnegcuda.dll")
dgsource("D:\tmp\Rocky\VTS_01_1.dgi",cl=8,cr=8)
oncpu()
invertneg()
oncuda()

And what happens when I run it?

"This avisynth does not support memory type 2 (CUDA)"

OK, so let's google that error message. Hmm, a user Mitra ran into it and made a thread:

https://forum.doom9.org/showthread.php?t=183811

The response is useless, because there is no response. Do I have to build avisynth myself with some special switch? Who knows? And if so, do I have to ask users to do that too?

Guys, this stuff has apparently been abandoned and is unsupported. I'm going to do it my way. Anyway, CUDA runtime is useless for our application. Maybe that only affects the filter sample, though, and not whatever Avisynth is doing.

Now gonna move this to a separate thread and start coding the DGCube() new stuff we agreed to.
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

AVISynth+ CUDA support

Post by Rocky »

@reel.deal

I saw your message to pinterf. Thanks for that. Maybe you can point him to this thread. Hope he's not too offended by my tone. Always mindful of being a squirrel. I do really respect everything pinterf has done for Avisynth. :salute:

I can give you the compiled invertneg sample if you need it. But things go beyond that into Avisynth itself (see above).
DAE avatar
Guest 2
Posts: 903
Joined: Mon Sep 20, 2010 2:18 pm

AVISynth+ CUDA support

Post by Guest 2 »

Any test release for us to play in the weekend? :)
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

AVISynth+ CUDA support

Post by Rocky »

Maybe tomorrow. For now you can play without it. Keep the inner child alive.

Anyway please keep DGCube stuff in the DGCube thread, not this one. Ta.
DAE avatar
Guest 2
Posts: 903
Joined: Mon Sep 20, 2010 2:18 pm

AVISynth+ CUDA support

Post by Guest 2 »

Rocky wrote:
Sat Aug 27, 2022 10:12 am
I saw your message to pinterf
What forum?
User avatar
Rocky
Posts: 3557
Joined: Fri Sep 06, 2019 12:57 pm

AVISynth+ CUDA support

Post by Rocky »

User avatar
Levi
Posts: 52
Joined: Sat Apr 18, 2020 6:12 pm

AVISynth+ CUDA support

Post by Levi »

User avatar
Baltasar
Posts: 60
Joined: Tue Nov 02, 2021 9:51 am

AVISynth+ CUDA support

Post by Baltasar »

User avatar
Curly
Posts: 712
Joined: Sun Mar 15, 2020 11:05 am

AVISynth+ CUDA support

Post by Curly »

Image
User avatar
Wonder Woman
Posts: 58
Joined: Sun Feb 07, 2021 10:46 am

AVISynth+ CUDA support

Post by Wonder Woman »

I know you all love to look at me, and imagine things, so here I am.
User avatar
Boris
Posts: 92
Joined: Sun Nov 10, 2019 2:55 pm

AVISynth+ CUDA support

Post by Boris »

Wall coming fast. Watch out!

Paint on wall. White here black there. KABOOM!!!
User avatar
Wonder Woman
Posts: 58
Joined: Sun Feb 07, 2021 10:46 am

AVISynth+ CUDA support

Post by Wonder Woman »

Post Reply