Revision 50e7d9797d9bf4b98a056d5df128c24dde6e78bd authored by Yong He on 23 March 2023, 23:59:02 UTC, committed by GitHub on 23 March 2023, 23:59:02 UTC
* Fix optimization pass not converging. * Fix. * Fix tests. --------- Co-authored-by: Yong He <yhe@nvidia.com>
1 parent 85f0058
assoctype-func-param.slang
//TEST(compute):COMPARE_COMPUTE:-cpu -shaderobj
//TEST(compute):COMPARE_COMPUTE: -shaderobj
// Test type checking of associatedtype and typedef
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<float> outputBuffer;
interface IBase
{
associatedtype SubTypeT;
associatedtype RetT;
RetT getVal(SubTypeT t);
SubTypeT setVal(RetT v);
}
struct SubType<T>
{
T x;
};
struct GenStruct<T> : IBase
{
typedef T RetT;
typedef SubType<RetT> SubTypeT;
SubTypeT setVal(T val)
{
SubTypeT rs;
rs.x = val;
return rs;
}
T getVal(SubTypeT v)
{
return v.x;
}
};
U.RetT test<U:IBase>(U.RetT val)
{
U obj;
U.SubTypeT sb = obj.setVal(val);
return obj.getVal(sb);
}
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
uint tid = dispatchThreadID.x;
float inVal = float(tid);
/* wrong error message for the following line */
float outVal = test<GenStruct<float> >(inVal);
outputBuffer[tid] = outVal.x;
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...