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

Transfer offset decorations when legalizing laid-out structs #5525

Merged
merged 4 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions source/slang/slang-legalize-types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,13 @@ struct TupleTypeBuilder
fieldType = context->getBuilder()->getVoidType();

// TODO: shallow clone of modifiers, etc.

builder->createStructField(ordinaryStructType, ee.fieldKey, fieldType);
IRStructField* originalField = findStructField(originalStructType, ee.fieldKey);
IRStructField* newField =
builder->createStructField(ordinaryStructType, ee.fieldKey, fieldType);
// In case the original struct had offset decorations attached, transfer those as
// well. The original offsets should still be valid, since we only skip fields of
// types that aren't representable in memory.
originalField->transferDecorationsTo(newField);
}

ordinaryType = LegalType::simple((IRType*)ordinaryStructType);
Expand Down
1 change: 0 additions & 1 deletion tests/autodiff/existential-1.slang
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type
//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-wgpu

//TEST_INPUT:ubuffer(data=[0 0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<float> outputBuffer;
Expand Down
1 change: 0 additions & 1 deletion tests/autodiff/existential-2.slang
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type
//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-wgpu

//TEST_INPUT:ubuffer(data=[0 0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<float> outputBuffer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type
//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-wgpu

// outputBuffer is defined in IBSDF.slang
//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0], stride=4):out,name=outputBuffer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type
//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-wgpu

// outputBuffer is defined in IBSDF.slang
//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer
Expand Down
4 changes: 0 additions & 4 deletions tests/expected-failure-github.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ tests/language-feature/saturated-cooperation/fuse.slang (vk)
tests/bugs/byte-address-buffer-interlocked-add-f32.slang (vk)
tests/serialization/obfuscated-serialized-module-test.slang.2 syn (mtl)
tests/autodiff/custom-intrinsic.slang.2 syn (wgpu)
tests/autodiff/existential-1.slang.2 syn (wgpu)
tests/autodiff/existential-2.slang.2 syn (wgpu)
tests/autodiff/material/diff-bwd-falcor-material-system.slang.2 syn (wgpu)
tests/autodiff/material2/diff-bwd-falcor-material-system.slang.2 syn (wgpu)
tests/bugs/atomic-coerce.slang.3 syn (wgpu)
tests/bugs/buffer-swizzle-store.slang.3 syn (wgpu)
tests/bugs/dxbc-double-problem.slang.6 syn (wgpu)
Expand Down
Loading