Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizhangNV committed Jan 1, 2025
1 parent 87d22dc commit 91b1943
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions source/slang/slang-ir-autodiff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,13 @@ bool isNoDiffType(IRType* paramType)
}

while (auto ptrType = as<IRPtrTypeBase>(paramType))
paramType = ptrType->getValueType();
while (auto attrType = as<IRAttributedType>(paramType))
{
if (attrType->findAttr<IRNoDiffAttr>())
paramType = ptrType->getValueType();

if (auto attrType = as<IRAttributedType>(paramType))
{
return true;
if (attrType->findAttr<IRNoDiffAttr>())
return true;
}
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion tests/autodiff/nodiff-ptr.slang
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ float sumOfSquares(float x, float y, no_diff float4* test)
return x * x + y * y * (test->x + test->y + test->z);
}

//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type -compile-arg -skip-spirv-validation

//TEST_INPUT:ubuffer(data=[1.0 2.0 3.0 1.0 1.0 0.0 0.0 0.0], stride=4):out, name outputBuffer
RWStructuredBuffer<float4> outputBuffer;
Expand Down

0 comments on commit 91b1943

Please sign in to comment.