-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix incorrect resolve of specialization instance (#6162)
* Fix incorrect resolve of specialization instance While checking the uninitialized variables, we were not resolving the specialized instance correctly. This commit repeats the resolve while the result is a specialization instance. A new test is added for this: tests/diagnostics/uninitialized-generic.slang After the problem is fixed, it revealed another problem in existing tests: tests/compute/nested-generics2.slang tests/diagnostics/uninitialized-local-variables.slang When a struct has a member variable whose type is a generic type, we cannot iterate over its member variables yet, because the type is unknown until the generic function/struct is specialized. We will have to give up checking for these cases.
- Loading branch information
1 parent
8000e0e
commit a9ce752
Showing
3 changed files
with
41 additions
and
13 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,30 @@ | ||
//TEST:SIMPLE(filecheck=CHK): -target spirv -entry computeMain | ||
|
||
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer | ||
RWStructuredBuffer<float> outputBuffer; | ||
|
||
groupshared float4 gsVar; | ||
|
||
__generic<TYPE1 : __BuiltinArithmeticType> | ||
struct MyContainer | ||
{ | ||
__generic<TYPE2 : __BuiltinArithmeticType> | ||
void store(__ref vector<TYPE2,4> v) | ||
{ | ||
v[0] = TYPE2(0); | ||
v[1] = TYPE2(1); | ||
v[2] = TYPE2(2); | ||
v[3] = TYPE2(3); | ||
} | ||
}; | ||
|
||
[Shader("compute")] | ||
[NumThreads(1, 1, 1)] | ||
void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) | ||
{ | ||
MyContainer<float> obj; | ||
obj.store(gsVar); | ||
|
||
// CHK-NOT:warning 41017: | ||
outputBuffer[0] = gsVar.x; | ||
} |
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