Skip to content

Commit

Permalink
use nullptr' for IRStructKey with IRDerivativeMemberDecoration` (#4623
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ArielG-NV authored Jul 12, 2024
1 parent 0b6d78f commit 1a0bbb5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/slang/slang-emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ void calcRequiredLoweringPassSet(RequiredLoweringPassSet& result, CodeGenContext
case kIROp_BackwardDifferentiate:
case kIROp_ForwardDifferentiate:
case kIROp_MakeDifferentialPairUserCode:
case kIROp_DerivativeMemberDecoration:
result.autodiff = true;
break;
case kIROp_VerticesType:
Expand Down
25 changes: 25 additions & 0 deletions tests/compute/struct-autodiff-default-init.slang
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// struct-default-init.slang
//TEST:SIMPLE(filecheck=HLSL): -target hlsl -entry computeMain -stage compute
//TEST:SIMPLE(filecheck=GLSL): -target glsl -entry computeMain -stage compute
//TEST:SIMPLE(filecheck=METAL): -target metal -entry computeMain -stage compute
//TEST:SIMPLE(filecheck=CPP): -target cpp -entry computeMain -stage compute
//TEST:SIMPLE(filecheck=SPIRV): -target spirv -entry computeMain -stage compute

// HLSL: computeMain
// GLSL: main
// METAL: computeMain
// CPP: computeMain
// SPIRV: OpEntryPoint

struct PowActivationEx : IDifferentiable
{
float power;
}
RWStructuredBuffer<float> return_value;

[numthreads(256, 1, 1)]
void computeMain()
{
PowActivationEx args;
return_value[0] = args.power;
}

0 comments on commit 1a0bbb5

Please sign in to comment.