-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hack handling of primal insts that has a function type. (#2728)
* Update diff-bwd material test * Minor update * Hack handling of primal insts that has a function type. --------- Co-authored-by: winmad <winmad.wlf@gmail.com> Co-authored-by: Yong He <yhe@nvidia.com>
- Loading branch information
1 parent
50e7d97
commit 6e4eae1
Showing
7 changed files
with
83 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
tests/autodiff/material/diff-bwd-falcor-material-system.slang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type | ||
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type | ||
|
||
// outputBuffer is defined in IBSDF.slang | ||
//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0], stride=4):out,name=outputBuffer | ||
|
||
import MaterialSystem; | ||
import DiffuseMaterial; | ||
import DiffuseMaterialInstance; | ||
import GlossyMaterial; | ||
import GlossyMaterialInstance; | ||
|
||
//TEST_INPUT: type_conformance DiffuseMaterial:IMaterial = 0 | ||
//TEST_INPUT: type_conformance GlossyMaterial:IMaterial = 1 | ||
|
||
[BackwardDifferentiable] | ||
float3 evalBSDF(int type) | ||
{ | ||
float3 wi = normalize(float3(0.5, 0.2, 0.8)); | ||
float3 wo = normalize(float3(-0.1, -0.3, 0.9)); | ||
|
||
IMaterial material = createMaterialClassConformance(type, float3(0.9f, 0.6f, 0.2f)); | ||
let mi = material.setupMaterialInstance(); | ||
float3 f = mi.eval(wi, wo); | ||
return f; | ||
} | ||
|
||
[numthreads(1, 1, 1)] | ||
void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID) | ||
{ | ||
__bwd_diff(evalBSDF)(0, float3(1.f)); | ||
__bwd_diff(evalBSDF)(1, float3(1.f)); | ||
} |
7 changes: 7 additions & 0 deletions
7
tests/autodiff/material/diff-bwd-falcor-material-system.slang.expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type: float | ||
0.0 | ||
0.0 | ||
0.0 | ||
1.8 | ||
1.2 | ||
0.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters