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

Error Processing DaVinci CTL #2

Open
whothe opened this issue Nov 26, 2023 · 9 comments
Open

Error Processing DaVinci CTL #2

whothe opened this issue Nov 26, 2023 · 9 comments

Comments

@whothe
Copy link

whothe commented Nov 26, 2023

Hi sobotka,

thank you for the AgX DCTL.
Unfortunately Resolve is throwing an error for me when I attempt to use it:

"Error Processing DaVinci CTL"

I created the AgX folder in LUTs with the two files and set up a CST to output ArriWideGammut3 as instructed
Might there be an issue using OpenCL instead of CUDA?

Im just interested in playing with AgX in Resolve as a final transform after my grades.
If you have an idea how to fix this I'd be most greatful.

Either way, awsome work with AgX! <3
Thank you!

@sobotka
Copy link
Owner

sobotka commented Nov 26, 2023

That’s odd. It should work with either in theory, although there are some fun bits around the wretched landscape known as shaders.

Are you able to find the Resolve log and find the error that it dumps?

@whothe
Copy link
Author

whothe commented Nov 27, 2023

[0x00003694]` | DVIP | ERROR | 2023-11-26 16:31:39,101 | DaVinci CTL compilation failed.
[0x00003694] | DVIP | ERROR | 2023-11-26 16:31:39,101 | Failed to build program.
Build Status: -2
Build Options: -w -DDEVICE_IS_OPENCL -DCOMPILER_IS_DVIP_RT -DKERNEL_TYPE_IS_DCTL -DVENDOR_IS_AMD -cl-mad-enable -cl-fast-relaxed-math
Build Log: C:\Users\Fox\AppData\Local\Temp\comgr-cddc56\input\CompileSource:1740:10: fatal error: 'C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT\AgX\Camera-AgX-Lib.h' file not found
#include "C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT\AgX\Camera-AgX-Lib.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Error: Failed to compile source (from CL or HIP source to LLVM IR).

C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT\AgX\Camera-AgX-Lib.h:703:88: error: expected ';' at end of declaration
float Bound = angle > Gangle && angle <= Bangle ? RGBBoundaries.blue.y : angle > Bangle or angle <= Rangle ? RGBBoundaries.green.y : angle > Rangle && angle <= Gangle ? RGBBoundaries.red.y: 1;

6 errors generated.
Error: Failed to compile source (from CL or HIP source to LLVM IR).

[0x00007b68] | DVIP | ERROR | 2023-11-26 16:37:18,896 | DaVinci CTL compilation failed.
[0x00007b68] | DVIP | ERROR | 2023-11-26 16:37:18,896 | Failed to build program.
Build Status: -2
Build Options: -w -DDEVICE_IS_OPENCL -DCOMPILER_IS_DVIP_RT -DKERNEL_TYPE_IS_DCTL -DUSE_HALFFLOAT -DVENDOR_IS_AMD -cl-mad-enable -cl-fast-relaxed-math
Build Log: In file included from C:\Users\Fox\AppData\Local\Temp\comgr-4f143e\input\CompileSource:1740:
C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT\AgX\Camera-AgX-Lib.h:702:88: error: expected ';' at end of declaration
float slope = angle > Gangle && angle <= Bangle ? RGBBoundaries.blue.x : angle > Bangle or angle <= Rangle ? RGBBoundaries.green.x : angle > Rangle && angle <= Gangle ? RGBBoundaries.red.x : 1;

Extracted some bits that seemed related... Hope this is usefull...
"Lib.h file not found" suggests file not present in folder, which is false.
One of them looks like syntax error in the lib.h, though unclear why this would break my compile and not urs.
If you want me to send the full log let me know.

In the meantime I tried deleting the OpenCL cache to force a recompile with no effect...
Would do a clean reinstall, but working on a project that does not allow for such shenanigans.

Thanks for taking the time!

@sobotka
Copy link
Owner

sobotka commented Nov 27, 2023

Thanks for taking the time to trace the log.

My rule of thumb is ignore all errors except for the very first one, which is this rather reasonable looking snippet:
lib.h:703:88 error:` expected ';' at end of declaration float Bound = angle > Gangle && angle <= Bangle ? RGBBoundaries.blue.y : angle > Bangle or angle <= Rangle ? RGBBoundaries.green.y : angle > Rangle && angle <= Gangle ? RGBBoundaries.red.y: 1;

That’s this line here.

Now this particular line is interesting because the compiler seemed to handle the earlier line perfectly fine, and it is very similar. But a hint is that it is not quite identical in structure. If you look right toward the end of the line, you will see that there is a subtle whitespace between the RGBBoundaries.red.x : that is not present in the problem line RGBBoundaries.red.y:. And we know that white space can trip up compilers…

So, try adding a space between that colon and the y on the problematic line, save, and reload.

If it still flakes out, the compiler is probably tripping up on those ternary operators, and we’d need to dig a little deeper.

@whothe
Copy link
Author

whothe commented Nov 28, 2023

Unfortunately, it still errors out...
Just refactoring the two lines to avoid ternary operators also has not worked for me (assuming I didn't make a mistake which admittedly is a bit of a long shot).

I'd be more than happy if you could give me another pointer where to look next.

Thank you!

@sobotka
Copy link
Owner

sobotka commented Nov 29, 2023

What were the errors in the log?

@whothe
Copy link
Author

whothe commented Nov 30, 2023

Fixed it!
Had to replace the ternary operators. Didn't work 1st time because the same code apears 3 times and I overlooked which lines got called in the error log. Sorry for the oversight.

Replaced lines 702, 703, 764, 765, 844, 845 with this:

float slope, Bound;

if (angle > Gangle && angle <= Bangle) {
    slope = RGBBoundaries.blue.x;
    Bound = RGBBoundaries.blue.y;
} else if (angle > Bangle || angle <= Rangle) {
    slope = RGBBoundaries.green.x;
    Bound = RGBBoundaries.green.y;
} else if (angle > Rangle && angle <= Gangle) {
    slope = RGBBoundaries.red.x;
    Bound = RGBBoundaries.red.y;
} else {
    slope = 1;
    Bound = 1;
}

Works like a charm now. Thanks!

PS: I have never created a pull request before, so it will take me a while till I have the time to sit down and figure out how to do that correctly, if u want me to.

@sobotka
Copy link
Owner

sobotka commented Dec 1, 2023

I am happy to integrate a pull request.

The easiest way is to fork the branch locally using git, and then push back to your GitHub. In the GitHub interface, you can create a pull request.

The code is a bit of a hodge podge from Jed Smith’s original blueprints I believe, which Juan Pablo Zambrano added and modified to cram the whole AgX-like bits into. I kludged in my garbage on top of that, and set the tunings to default for a reasonable AWGv3 / LogCv3 chain.

I have a significantly cleaner attempt from the ground up, but it is unfinished and I have not pushed it. I’d like to eventually do so as a historical marker for the next thing that I hope to squeeze out, Flying Spaghetti Monster willing.

TL;DR: I am happy to take a PR given this is a bit of a shibboleth.

@dracoroot7
Copy link

dracoroot7 commented Feb 22, 2024

getting the same error

C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT\AgX\Camera-AgX-Lib.h:702:88: error: expected ';' at end of declaration
float slope = angle > Gangle && angle <= Bangle ? RGBBoundaries.blue.x : angle > Bangle or angle <= Rangle ? RGBBoundaries.green.x : angle > Rangle && angle <= Gangle ? RGBBoundaries.red.x : 1;
                                                                                       ^
                                                                                       ;
C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT\AgX\Camera-AgX-Lib.h:703:88: error: expected ';' at end of declaration
float Bound = angle > Gangle && angle <= Bangle ? RGBBoundaries.blue.y : angle > Bangle or angle <= Rangle ? RGBBoundaries.green.y : angle > Rangle && angle <= Gangle ? RGBBoundaries.red.y: 1;
                                                                                       ^
                                                                                       ;
C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT\AgX\Camera-AgX-Lib.h:764:88: error: expected ';' at end of declaration
float slope = angle > Gangle && angle <= Bangle ? RGBBoundaries.blue.x : angle > Bangle or angle <= Rangle ? RGBBoundaries.green.x : angle > Rangle && angle <= Gangle ? RGBBoundaries.red.x : 1;
                                                                                       ^
                                                                                       ;
C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT\AgX\Camera-AgX-Lib.h:765:88: error: expected ';' at end of declaration
float Bound = angle > Gangle && angle <= Bangle ? RGBBoundaries.blue.y : angle > Bangle or angle <= Rangle ? RGBBoundaries.green.y : angle > Rangle && angle <= Gangle ? RGBBoundaries.red.y: 1;
                                                                                       ^
                                                                                       ;
C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT\AgX\Camera-AgX-Lib.h:844:88: error: expected ';' at end of declaration
float slope = angle > Gangle && angle <= Bangle ? RGBBoundaries.blue.x : angle > Bangle or angle <= Rangle ? RGBBoundaries.green.x : angle > Rangle && angle <= Gangle ? RGBBoundaries.red.x : 1;
                                                                                       ^
                                                                                       ;
C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT\AgX\Camera-AgX-Lib.h:845:88: error: expected ';' at end of declaration
float Bound = angle > Gangle && angle <= Bangle ? RGBBoundaries.blue.y : angle > Bangle or angle <= Rangle ? RGBBoundaries.green.y : angle > Rangle && angle <= Gangle ? RGBBoundaries.red.y: 1;
                                                                                       ^
                                                                                       ;
6 errors generated.
Error: Failed to compile source (from CL or HIP source to LLVM IR).


Urgent message: Error Processing DaVinci CTL||AgX\Camera-AgX.dctl

[0x00003178] | DVIP                 | ERROR | 2024-02-22 11:24:59,564 | DaVinci CTL compilation failed.
[0x00003178] | DVIP                 | ERROR | 2024-02-22 11:24:59,564 | Failed to build program.
Build Status: -2
Build Options:  -w -DDEVICE_IS_OPENCL -DCOMPILER_IS_DVIP_RT -DKERNEL_TYPE_IS_DCTL -DUSE_HALFFLOAT -DVENDOR_IS_AMD -cl-mad-enable -cl-fast-relaxed-math
Build Log: In file included from C:\Users\chops\AppData\Local\Temp\comgr-086cfc\input\CompileSource:1736:
C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT\AgX\Camera-AgX-Lib.h:702:88: error: expected ';' at end of declaration
float slope = angle > Gangle && angle <= Bangle ? RGBBoundaries.blue.x : angle > Bangle or angle <= Rangle ? RGBBoundaries.green.x : angle > Rangle && angle <= Gangle ? RGBBoundaries.red.x : 1;
                                                                                       ^
                                                                                       ;
C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT\AgX\Camera-AgX-Lib.h:703:88: error: expected ';' at end of declaration
float Bound = angle > Gangle && angle <= Bangle ? RGBBoundaries.blue.y : angle > Bangle or angle <= Rangle ? RGBBoundaries.green.y : angle > Rangle && angle <= Gangle ? RGBBoundaries.red.y: 1;
                                                                                       ^
                                                                                       ;
C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT\AgX\Camera-AgX-Lib.h:764:88: error: expected ';' at end of declaration
float slope = angle > Gangle && angle <= Bangle ? RGBBoundaries.blue.x : angle > Bangle or angle <= Rangle ? RGBBoundaries.green.x : angle > Rangle && angle <= Gangle ? RGBBoundaries.red.x : 1;
                                                                                       ^
                                                                                       ;
C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT\AgX\Camera-AgX-Lib.h:765:88: error: expected ';' at end of declaration
float Bound = angle > Gangle && angle <= Bangle ? RGBBoundaries.blue.y : angle > Bangle or angle <= Rangle ? RGBBoundaries.green.y : angle > Rangle && angle <= Gangle ? RGBBoundaries.red.y: 1;
                                                                                       ^
                                                                                       ;
C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT\AgX\Camera-AgX-Lib.h:844:88: error: expected ';' at end of declaration
float slope = angle > Gangle && angle <= Bangle ? RGBBoundaries.blue.x : angle > Bangle or angle <= Rangle ? RGBBoundaries.green.x : angle > Rangle && angle <= Gangle ? RGBBoundaries.red.x : 1;
                                                                                       ^
                                                                                       ;
C:\ProgramData\Blackmagic Design\DaVinci Resolve\Support\LUT\AgX\Camera-AgX-Lib.h:845:88: error: expected ';' at end of declaration
float Bound = angle > Gangle && angle <= Bangle ? RGBBoundaries.blue.y : angle > Bangle or angle <= Rangle ? RGBBoundaries.green.y : angle > Rangle && angle <= Gangle ? RGBBoundaries.red.y: 1;
                                                                                       ^
                                                                                       ;
6 errors generated.
Error: Failed to compile source (from CL or HIP source to LLVM IR)

@sobotka
Copy link
Owner

sobotka commented Feb 22, 2024

I will try to find a timeslice to fix the ternary operator to generic shader code.

I really should muster up the willpower to get the streamlined DCTL done, with HDR bullshit. Le sigh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants