Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 30th January 2017, 06:04   #61  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by Myrsloik View Post
Now you see why asm is kinda your friend.

There's a pile of pitfalls here you missed. And some you found.

1. You compile the whole file with avx2/whatever instrction set you selected. That means avx2 instructions may be emitted for you plain C++ code too. Solve it by placing the avx2 code in a separate file and use different compiler settings.

2. You can't put sse and avx intrinsics in the same file either. For example subps can get turned into vsubps to reduce register copies. So then the sse path needs avx too...

3. Cpuid is horrible in intrinsics, that's why I use asm. Lrn2yasm. Or write code that requires gcc or clang where convenient intrinsics are available. Clang is even available as a simple dropin for visual studio nowadays.
1. got it
2. got it
3. the thing is I can't set it up... yasm doesn't seem to have an installer like clang that gets everything done automatically, also the manual setting-up documentation on the yasm website is obsolete, the visual studio folders it mentioned don't even exist anymore! I could switch to clang but that won't solve the xgetbv problem cuz it's not defined in clang's immintrin.h... and back to square one, I have to set up yasm first which is impossible.
feisty2 is offline   Reply With Quote
Old 30th January 2017, 07:39   #62  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
Quote:
Originally Posted by feisty2 View Post
yeah


blankclip is okay, long as it's not crashing.
Ok, but how? Xd
__________________
[AUR] Vapoursynth Stuff
[AUR] Avisynth Stuff
sl1pkn07 is offline   Reply With Quote
Old 30th January 2017, 12:37   #63  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by sl1pkn07 View Post
Ok, but how? Xd
I separated the source code into 2 files.
just compile "Source.cpp" with "-march=native" and "Source_AVX_FMA.cpp" with "-march=haswell" and it should work, you don't have to edit the source code this time, I added the conditional compilation macros and it would pick "cpufeatures_gnu.hpp" automatically if you're on GCC

test script
Code:
import vapoursynth as vs
core = vs.get_core()
clp = core.std.BlankClip(width=1920, height=1080, format=vs.GRAYS, length=20000)
clp = core.ftf.FixFades(clp)
clp.set_output()
feisty2 is offline   Reply With Quote
Old 30th January 2017, 14:00   #64  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
http://stackoverflow.com/questions/6...nstruction-set

if help you
__________________
[AUR] Vapoursynth Stuff
[AUR] Avisynth Stuff
sl1pkn07 is offline   Reply With Quote
Old 30th January 2017, 14:09   #65  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by sl1pkn07 View Post
I know how to do that SIMD extension detecting at runtime and it's already there in the source code, I don't need any help

I'm asking if it's working cuz I'm not sure about that..
feisty2 is offline   Reply With Quote
Old 30th January 2017, 14:58   #66  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
Code:
Failed to evaluate the script:
Python exception: No attribute with the name ftf exists. Did you mistype a plugin namespace?
Traceback (most recent call last):
File "src/cython/vapoursynth.pyx", line 1712, in vapoursynth.vpy_evaluateScript (src/cython/vapoursynth.c:34991)
File "/home/sl1pkn07/aplicaciones/vapoursynth-test/fixtelecided-test.vpy", line 4, in 
clp = core.ftf.FixFades(clp)
File "src/cython/vapoursynth.pyx", line 1306, in vapoursynth.Core.__getattr__ (src/cython/vapoursynth.c:28067)
AttributeError: No attribute with the name ftf exists. Did you mistype a plugin namespace?
Code:
all:
	  g++ -c -std=c++14 -fPIC -march=native -O2 -pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I. -I/usr/include/vapoursynth -o fixtelecinedfades.o Source.cpp
	  yasm -f elf -m amd64 -DARCH_X86_64=1 -o cpu.o cpu.asm
	  g++ -shared -fPIC -Wl,-O1,--sort-common,--as-needed,-z,relro -o libvsfixtelecinedfades.so fixtelecinedfades.o cpu.o
__________________
[AUR] Vapoursynth Stuff
[AUR] Avisynth Stuff
sl1pkn07 is offline   Reply With Quote
Old 2nd February 2017, 18:50   #67  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by sl1pkn07 View Post
Code:
Failed to evaluate the script:
Python exception: No attribute with the name ftf exists. Did you mistype a plugin namespace?
Traceback (most recent call last):
File "src/cython/vapoursynth.pyx", line 1712, in vapoursynth.vpy_evaluateScript (src/cython/vapoursynth.c:34991)
File "/home/sl1pkn07/aplicaciones/vapoursynth-test/fixtelecided-test.vpy", line 4, in 
clp = core.ftf.FixFades(clp)
File "src/cython/vapoursynth.pyx", line 1306, in vapoursynth.Core.__getattr__ (src/cython/vapoursynth.c:28067)
AttributeError: No attribute with the name ftf exists. Did you mistype a plugin namespace?
Code:
all:
	  g++ -c -std=c++14 -fPIC -march=native -O2 -pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I. -I/usr/include/vapoursynth -o fixtelecinedfades.o Source.cpp
	  yasm -f elf -m amd64 -DARCH_X86_64=1 -o cpu.o cpu.asm
	  g++ -shared -fPIC -Wl,-O1,--sort-common,--as-needed,-z,relro -o libvsfixtelecinedfades.so fixtelecinedfades.o cpu.o
then I think I won't be able to help you with that... sorry
I'm really just not familiar with all that gnu stuff and

1. there's the runtime simd extension detection so the unsupported forcibly-compiled functions won't matter cuz they will never get called.
2. you compiled "Source.cpp" which contains functions that will actually get called with "-march=native", so there should be no unsupported instructions in those functions.

so logically I can't see why your binary failed to work, maybe you should ask others that are more familiar with the whole gnu world..
feisty2 is offline   Reply With Quote
Old 3rd February 2017, 05:26   #68  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
anyways, if you really wanna use this plugin,
manually comment out:
line3
line123
line124
line156 - line161
in "Source.cpp",
line10 - line14 in "Shared.hpp"
and compile it and it should work..
feisty2 is offline   Reply With Quote
Old 6th February 2017, 21:57   #69  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Code:
Python exception: No attribute with the name _____ exists. Did you mistype a plugin namespace?
If you get this error and you know you have the plugin, try to load it manually to find out what's wrong with it:
Code:
core.std.LoadPlugin("/your/plugin/here.so")
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 6th February 2017, 21:58   #70  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
@jackoneill the steps for build the plugin whit yasm is correct?

edit:

Code:
Failed to evaluate the script:
Python exception: Failed to load /usr/lib/vapoursynth/libvsfixtelecinedfades.so. Error given: /usr/lib/vapoursynth/libvsfixtelecinedfades.so: undefined symbol: _Z24fixfadesGetFrame_AVX_FMAiiPPvS0_P14VSFrameContextP6VSCorePK5VSAPI
Traceback (most recent call last):
File "src/cython/vapoursynth.pyx", line 1712, in vapoursynth.vpy_evaluateScript (src/cython/vapoursynth.c:34991)
File "/home/sl1pkn07/aplicaciones/vapoursynth-plugin-fixtelecinedfades-git/fixtelecined-test.vpy", line 3, in 
clp = core.std.BlankClip(width=1920, height=1080, format=vs.GRAYS, length=20000)
File "src/cython/vapoursynth.pyx", line 1604, in vapoursynth.Function.__call__ (src/cython/vapoursynth.c:33131)
vapoursynth.Error: Failed to load /usr/lib/vapoursynth/libvsfixtelecinedfades.so. Error given: /usr/lib/vapoursynth/libvsfixtelecinedfades.so: undefined symbol: _Z24fixfadesGetFrame_AVX_FMAiiPPvS0_P14VSFrameContextP6VSCorePK5VSAPI
__________________
[AUR] Vapoursynth Stuff
[AUR] Avisynth Stuff

Last edited by sl1pkn07; 6th February 2017 at 22:03.
sl1pkn07 is offline   Reply With Quote
Old 6th February 2017, 22:41   #71  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Gah, you made me look at the code.

You forgot to compile Source_AVX_FMA.cpp.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 6th February 2017, 22:45   #72  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
but that is not only for AVX CPU compilant?

Source.cpp -> older CPU
Source_AVX_FMA.cpp -> newer CPU

because Source_AVX_FMA.cpp needs build with -march=haswell, amd my cpu is not capable (don't have AVX or FMA3)
__________________
[AUR] Vapoursynth Stuff
[AUR] Avisynth Stuff

Last edited by sl1pkn07; 6th February 2017 at 22:52.
sl1pkn07 is offline   Reply With Quote
Old 6th February 2017, 23:24   #73  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Quote:
Originally Posted by sl1pkn07 View Post
but that is not only for AVX CPU compilant?

Source.cpp -> older CPU
Source_AVX_FMA.cpp -> newer CPU

because Source_AVX_FMA.cpp needs build with -march=haswell, amd my cpu is not capable (don't have AVX or FMA3)
If the author did everything right, the code from that file will only be used if the CPU has FMA3. You still have to compile it.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 7th February 2017, 09:25   #74  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
ok. done
__________________
[AUR] Vapoursynth Stuff
[AUR] Avisynth Stuff
sl1pkn07 is offline   Reply With Quote
Old 7th February 2017, 09:36   #75  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by sl1pkn07 View Post
ok. done
is it working now?
feisty2 is offline   Reply With Quote
Old 7th February 2017, 09:38   #76  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
i think yes, but i need make more test

if all is ok, then i think you can merge the Source{,_AVX_FMA}.cpp again

sorry :S
__________________
[AUR] Vapoursynth Stuff
[AUR] Avisynth Stuff

Last edited by sl1pkn07; 7th February 2017 at 09:44.
sl1pkn07 is offline   Reply With Quote
Old 7th February 2017, 09:53   #77  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by sl1pkn07 View Post
i think yes, but i need make more test

if all is ok, then i think you can merge the Source{,_AVX_FMA}.cpp again

sorry :S
no, I can't(shouldn't).
if I do merge Source.cpp and Source_AVX_FMA.cpp into one file, you'll have to compile that file with -march=haswell, and the compiler will probably generate unsupported instructions for the C++ functions..
feisty2 is offline   Reply With Quote
Old 7th February 2017, 10:19   #78  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by sl1pkn07 View Post
i think yes, but i need make more test

if all is ok, then i think you can merge the Source{,_AVX_FMA}.cpp again

sorry :S
I think you should make a PR on GitHub so I can merge those GNU compiling files into the repo
feisty2 is offline   Reply With Quote
Old 7th February 2017, 10:25   #79  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
Then need making more refraction in Source.cpp, because as @jackoneill said,build Source.cpp with march=native and build Source_AVX_FMA3.cpp with march=haswell and merge both in the library, the plugin now load without problem. build
__________________
[AUR] Vapoursynth Stuff
[AUR] Avisynth Stuff

Last edited by sl1pkn07; 7th February 2017 at 10:34.
sl1pkn07 is offline   Reply With Quote
Old 7th February 2017, 10:33   #80  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by sl1pkn07 View Post
Then need making more refraction in Source.cpp, because build It with march=native and build source_avx_fma3.cpp with march=haswell and merge both in the library the plugin now load without problem. Like @jackoneill said
what do you mean by "more refraction in Source.cpp"?
feisty2 is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:43.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.