-
Notifications
You must be signed in to change notification settings - Fork 713
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix assertion on splat of groupshared scalar (#6930)
When splatting a groupshared scalar, we would trip an "Invalid constantexpr cast!" assertion. This would happen while evaluating the ImplicitCastExpr to turn the groupshared scalar into a vector because the scalar expression was in a different address space (groupshared) vs the target vector (local). The fix is to ensure that when looking up the vector member expression, insert an lvalue-to-rvalue cast if necessary; i.e. when a swizzle contains duplicate elements.
- Loading branch information
Showing
4 changed files
with
38 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// RUN: %dxc -E main -T cs_6_0 -fcgl %s | FileCheck %s | ||
|
||
// Validate that when swizzling requires an r-value (i.e. duplicate elements), that the result is stored to | ||
// and loaded from a temporary. | ||
// CHECK: store <1 x i32> %splat.splat, <1 x i32>* %tmp | ||
// CHECK-NEXT: %1 = load <1 x i32>, <1 x i32>* %tmp | ||
// CHECK-NEXT: %2 = shufflevector <1 x i32> %1, <1 x i32> undef, <4 x i32> zeroinitializer | ||
// CHECK-NEXT: store <4 x i32> %2, <4 x i32>* %x | ||
|
||
groupshared int a; | ||
[numthreads(64, 1, 1)] | ||
void main() { | ||
a = 123; | ||
int4 x = (a).xxxx; | ||
} |
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