Welcome to WSL!

New to the forum? Please read this and this.

Alpha Divide can cause infinite values on GPU

Moderator: Chad

User avatar
UserNoah
Fusioneer
Posts: 194
Joined: Mon Mar 09, 2020 11:43 am
Been thanked: 6 times
Contact:

Alpha Divide can cause infinite values on GPU

#1

Post by UserNoah »

Fusion version:
16+ (including 17.2.2)


OS and version:
Windows 10


Additional relevant system info:

RTX 3070 using CUDA

Description of the bug:
Alpha Divide can cause infinite values when set to GPU mode or Auto (which means using GPU by default).
This will cause fringing to appear on edges pretty much meaning an unusable image unless you don't care about broken images.

Image

CPU only is a workaround.

Blackmagic support was not able to replicate this issue, but I believe @Midgardsormr mentioned that he was affected as well. Maybe this is Cuda/windows only?
In my case, the render is coming from Mantra.

I have attached a file and comp to verify this.

BLMD asked me to do a clean install of my drivers, but not once in my life did that fix anything for me, so it would be great if somebody could help me verify if this is windows/cuda/NVIDIA only, or if it's a "me" problem again.


Severity (Trivial, Minor, Major, Critical)

Major, as GPU is the default.

Steps to reproduce:

Download the files I provided to test of if there are infinite values after the Alpha Multiply.

Please, if possible, provide a Fusion setup to help demonstrate the behaviour, either as an attachment or between [code] tags:

see attachment as it requires an image file
AlphaDivideBug.zip
You do not have the required permissions to view the files attached to this post.

User avatar
Midgardsormr
Fusionator
Posts: 2171
Joined: Wed Nov 26, 2014 8:04 pm
Answers: 28
Location: Los Angeles, CA, USA
Been thanked: 40 times
Contact:

Re: Alpha Divide can cause infinite values on GPU

#2

Post by Midgardsormr »

Verified in Fusion Studio 17.2.1 build 13
Windows 10 Pro
Nvidia RTX 3060
Intel i9-10850K @ 3.6GHz

Forcing OpenCL does cause the artifact to disappear, so that's a yes on it being a CUDA-specific error.

Image

User avatar
Midgardsormr
Fusionator
Posts: 2171
Joined: Wed Nov 26, 2014 8:04 pm
Answers: 28
Location: Los Angeles, CA, USA
Been thanked: 40 times
Contact:

Re: Alpha Divide can cause infinite values on GPU

#3

Post by Midgardsormr »

With a little careful probing, I built a set-up with a synthetic image that creates the problem:

Code: Select all

{
	Tools = ordered() {
		Background3 = Background {
			CtrlWZoom = false,
			Inputs = {
				GlobalIn = Input { Value = 1, },
				Width = Input { Value = 1920, },
				Height = Input { Value = 1080, },
				["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
				TopLeftRed = Input { Value = 0.254638671875, },
				TopLeftGreen = Input { Value = 0.2626953125, },
				TopLeftBlue = Input { Value = 0.291259765625, },
				TopLeftAlpha = Input { Value = 1.96695327758789e-06, },
			},
			ViewInfo = OperatorInfo { Pos = { 847.871, 35.7946 } },
		},
		AlphaDivide1_2 = AlphaDivide {
			Inputs = {
				Input = Input {
					SourceOp = "Background3",
					Source = "Output",
				},
			},
			ViewInfo = OperatorInfo { Pos = { 847.871, 158.43 } },
		},
		AlphaMultiply1_2 = AlphaMultiply {
			Inputs = {
				Input = Input {
					SourceOp = "AlphaDivide1_2",
					Source = "Output",
				},
			},
			ViewInfo = OperatorInfo { Pos = { 847.871, 236.646 } },
		}
	}
}
I believe the error is in the test for zero alpha. In this case, an alpha value of 0.0000019669533 causes the problem. With a little more testing, I can make Green and Blue go infinite, leaving Red alone by raising the Alpha to 0.0000039041041 (Red is the lowest of the three channels, so it will be the last to clip out).

User avatar
UserNoah
Fusioneer
Posts: 194
Joined: Mon Mar 09, 2020 11:43 am
Been thanked: 6 times
Contact:

Re: Alpha Divide can cause infinite values on GPU

#4

Post by UserNoah »

Thank you for further investigating it. This is much appreciated! All these GPU issues are always frustrating to test and report. I'll send this new info to the support. Hopefully, they can test this on an NVIDIA machine to determine if it's drivers or DCTL causing the issue.

User avatar
UserNoah
Fusioneer
Posts: 194
Joined: Mon Mar 09, 2020 11:43 am
Been thanked: 6 times
Contact:

Re: Alpha Divide can cause infinite values on GPU

#5

Post by UserNoah »

BLMD support got back to me. They will not investigate it further and advise a clean install of drivers.

User avatar
SecondMan
Site Admin
Posts: 4904
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 31
Location: Vancouver, Canada
Been thanked: 53 times
Contact:

Re: Alpha Divide can cause infinite values on GPU

#6

Post by SecondMan »

UserNoah wrote: Thu Jul 08, 2021 2:44 amThey will not investigate it further and advise a clean install of drivers

User avatar
Shem Namo
Fusionista
Posts: 688
Joined: Sun Oct 06, 2019 9:15 pm
Answers: 1
Location: North Israel
Real name: David Kohen
Been thanked: 9 times

Re: Alpha Divide can cause infinite values on GPU

#7

Post by Shem Namo »

Hi Guys,

Just to see if the problem is caused by the way DCTL works or by the DCTL shader inside the Alpha Divide node,
here is a DCTL fuse that does what the Alpha divide node does.

I don't have an Nvidia GPU so I can't test it out using CUDA.

Here is the fuse if you want to try it out.
Alpha Divide Fuse.fuse
Cheers,
David
You do not have the required permissions to view the files attached to this post.

User avatar
UserNoah
Fusioneer
Posts: 194
Joined: Mon Mar 09, 2020 11:43 am
Been thanked: 6 times
Contact:

Re: Alpha Divide can cause infinite values on GPU

#8

Post by UserNoah »

Thank you David this is extremely helpful and thank you for putting in so much work.

The infinite values happen in your fuse as well.

Here is a screengrab using the fuse:
Image

And the code using @Midgardsormrs comp with your fuse:
  1. {
  2.     Tools = ordered() {
  3.         AlphaMultiply1_2 = AlphaMultiply {
  4.             Inputs = {
  5.                 Input = Input {
  6.                     SourceOp = "AlphaDivideFuse1",
  7.                     Source = "Output",
  8.                 },
  9.             },
  10.             ViewInfo = OperatorInfo { Pos = { 880, 394.276 } },
  11.         },
  12.         AlphaDivideFuse1 = Fuse.AlphaDivideFuse {
  13.             Inputs = {
  14.                 ["Divide Alpha"] = Input { Value = 1, },
  15.                 Image = Input {
  16.                     SourceOp = "Background3",
  17.                     Source = "Output",
  18.                 },
  19.             },
  20.             ViewInfo = OperatorInfo { Pos = { 880, 300.091 } },
  21.             Version = 100
  22.         },
  23.         AlphaDivide1_2 = AlphaDivide {
  24.             Inputs = {
  25.                 Input = Input {
  26.                     SourceOp = "Background3",
  27.                     Source = "Output",
  28.                 },
  29.             },
  30.             ViewInfo = OperatorInfo { Pos = { 720.667, 329.393 } },
  31.         },
  32.         Background3 = Background {
  33.             CtrlWZoom = false,
  34.             Inputs = {
  35.                 GlobalIn = Input { Value = 1, },
  36.                 Width = Input { Value = 1920, },
  37.                 Height = Input { Value = 1080, },
  38.                 ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
  39.                 TopLeftRed = Input { Value = 0.254638671875, },
  40.                 TopLeftGreen = Input { Value = 0.2626953125, },
  41.                 TopLeftBlue = Input { Value = 0.291259765625, },
  42.                 TopLeftAlpha = Input { Value = 1.96695327758789e-06, },
  43.             },
  44.             ViewInfo = OperatorInfo { Pos = { 720.667, 206.758 } },
  45.         }
  46.     }
  47. }

User avatar
Shem Namo
Fusionista
Posts: 688
Joined: Sun Oct 06, 2019 9:15 pm
Answers: 1
Location: North Israel
Real name: David Kohen
Been thanked: 9 times

Re: Alpha Divide can cause infinite values on GPU

#9

Post by Shem Namo »

No problem @UserNoah, I'm happy to help :)

I am intrigued by why the fuse isn't working.
If you have some time could you please try this revised one?
Alpha Divide Fuse.fuse
Cheers,
David
You do not have the required permissions to view the files attached to this post.

User avatar
UserNoah
Fusioneer
Posts: 194
Joined: Mon Mar 09, 2020 11:43 am
Been thanked: 6 times
Contact:

Re: Alpha Divide can cause infinite values on GPU

#10

Post by UserNoah »

This fuse "works" if the Alpha values are above the 0.0001 value, but that wasn't an issue with your previous fuse either. The thing you changed was the threshold, right? Everything below 0.0001 is set to 0?
That seems to be the tipping point for the CUDA translation. I wonder if other operations are affected or only divide. So far it seems like only division will cause issues.

User avatar
Shem Namo
Fusionista
Posts: 688
Joined: Sun Oct 06, 2019 9:15 pm
Answers: 1
Location: North Israel
Real name: David Kohen
Been thanked: 9 times

Re: Alpha Divide can cause infinite values on GPU

#11

Post by Shem Namo »

Yeah, the threshold I set is 0.0001, when the alpha is below that it will return 0.
But I can change the threshold to an even smaller number if that helps.

User avatar
UserNoah
Fusioneer
Posts: 194
Joined: Mon Mar 09, 2020 11:43 am
Been thanked: 6 times
Contact:

Re: Alpha Divide can cause infinite values on GPU

#12

Post by UserNoah »

I think the best workaround is still the CPU mode. This doesn't really add much time to the render and everyone affected has an easy workaround as long as they know that it's cuda causing the issue.

It's still interesting to see that creating a fuse will cause the same issue. It doesn't prove that dctl is the issue but it shows very clearly that dividing by 0.0001 is the root if the issue.

User avatar
PeterLoveday
Fusioneer
Posts: 225
Joined: Sun Sep 14, 2014 6:09 pm
Answers: 9
Been thanked: 6 times

Re: Alpha Divide can cause infinite values on GPU

#13

Post by PeterLoveday »

Note this issue is probably specific to float16 (which your EXR is) and CUDA, perhaps either or both of these is why it doesn't show for some people's tests.