Revision 2dcfce40a6ec9e2147d89823816730b3ffccc7f7 authored by Tim Foley on 04 May 2020, 20:10:35 UTC, committed by GitHub on 04 May 2020, 20:10:35 UTC
The CI system doesn't have a new enough dxc to support 16-bit load/store from byte-addressed buffers, so I am disabling the test for now.

A better long-term fix is to put an appropriate version of dxc into `slang-binaries` and use that for our CI tests.
1 parent f599788
Raw File
scalar-double-vk-intrinsic.slang
// This test is to see what intrinsics are available on VK

//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -output-using-type
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -output-using-type

// We don't want to run a cuda test here...
//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute

//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer
RWStructuredBuffer<double> outputBuffer;

[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    int idx = int(dispatchThreadID.x);
    
    double f = idx * (1.0f / (4.0f));
    
    double ft = 0.0l;
    
    // fmod
    ft += int(((f % 0.11l) * 100) + 0.5l);
    
    ft += rcp(1.0l + f);
    ft += sign(f - 0.5l);
    
    ft += saturate(f * 4 - 2.0l);
    
    ft += sqrt(f);
    ft += rsqrt(1.0l + f);
        
    ft += frac(f * 3);
    ft += ceil(f * 5 - 3);
    
    ft += floor(f * 10 - 7);
    ft += trunc(f * 7);
       
    ft += abs(f * 4 - 2.0l);
           
    ft += min(0.5l, f);
    ft += max(f, 0.75l);

    ft += smoothstep(0.2l, 0.7l, f);
    ft += lerp(-100.0l, 100.0l, f);

    ft += clamp(f, 0.1l, 0.3l);

    ft += step(f, 0.5l);

    {
        uint low, high;
        asuint(f * 2.0l, low, high);
        ft += asdouble(low, high);
    }
    
    outputBuffer[idx] = ft;
}
back to top