diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2023-08-15 20:28:42 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-15 20:28:42 +0800 |
| commit | 00bd481e001e8c0b8008eaff5a38fa37963e6f99 (patch) | |
| tree | d068f0649167bff80b9cd3aa7d32d790540e9564 /tests/compute | |
| parent | 113a257aafe4403c3ab905098d0560635ca94286 (diff) | |
SPIR-V WIP (#3064)
* Add type layout for structured buffer
* Default to generating spirv directly
* vk test for compute simple
* Add spirv-dis as a downstream compiler
* Emit Array types in SPIR-V
* makevector for spirv
* Dump whole spirv module on validation failure
* register array types
todo, use emitTypeInst
* Neater formatting for unhandled inst printing
* break out emitCompositeConstruct
* Correct array type generation
* neaten
* Allow getElement for vector
* Remove unused
* Allow predicating target intrinsics on types
* Consider functions with intrinsics to have definitions
We need to specialize these if they are predicated on types
* Correct array type generation
* makeArray for spir-v
* replace getElement with getElementPtr for spirv
* Correct translation of field access for spirv
* Push layouts to types for spirv
* Spirv intrinsics * operator now makes a pointer
* Add structured buffer of struct test
* Preserve type layout in spirv structured buffer legalization
* neaten
* makeVectorFromScalar for SPIRV
* placeholder for layouts on param groups
* More type safe spirv op construction
* Know that constants and types only go in one section
* Remove emitTypeInst
* Add todo for spirv sampling
* Add links to spirv documentation on emit functions
* OpTypeImage support for SPIR-V
* Add simpler texture test for spirv
* s/spirv_direct/spirv/g
* Allow several string literals in target_intrinsic
* Handle global params without a var layour for SPIR-V
For example groupshared vars
* uint spirv asm type
* Add todo for isDefinition
It is currently too broad
* Some atomic op spirv intrinsics
* Strip ConstantBuffer wrappers for spirv
* Add todo for matrix annotations
* Do not associate decorations insts with spirv counterparts
* Correct entry point parameter generation
* Spelling
* Assert that fieldAddress is returning a pointer
* Add error for existential type layout getting to spir-v emit
* Add IRTupleTypeLayout
Unused so far
* Allow getElementPtr to work with vectors
* Correct target name in test
* Hide default spirv direct behind a premake option --default-spirv-direct=true
* Do not insert space at start of intrinsic def
* Correct asm rendering in tests
* remove redundant option
* Emit directly from direct test
* Add source language options for spirv-dis
* Add comments to spirv dis
* Add dead debug print for before spirv module
* Correct asm rendering in tests
* s/spirv_direct/spirv/g
* Only specialize intrinsic functions with predicates
* regenerate vs projects
* squash warnings
* squash warnings
* remove duplication
* Silence warnings from msvc
* squash warnings
* Overload for zero sized array
* More msvc warnings
* warnings
* Add spirv-tools to path for tests
* Do not be specific about dxc version for diag test
* Normalize line endings from spirv-dis
* Correct filecheck matches
* Temporarily disable two spirv tests
Failing on CI, undebuggable hang :/
* Do not emit storage class more than once for spirv snippet
* Do not pass spir-v to spirv-dis by stdin
* Do not get spirv-dis output via stream, use file
* normalize file endings in spirv-dis output
Diffstat (limited to 'tests/compute')
| -rw-r--r-- | tests/compute/simple.slang | 1 | ||||
| -rw-r--r-- | tests/compute/structured-buffer-of-struct.slang | 37 | ||||
| -rw-r--r-- | tests/compute/texture-simpler.slang | 16 | ||||
| -rw-r--r-- | tests/compute/texture-simpler.slang.expected.txt | 5 |
4 files changed, 59 insertions, 0 deletions
diff --git a/tests/compute/simple.slang b/tests/compute/simple.slang index 0d4efc2e2..96cccc090 100644 --- a/tests/compute/simple.slang +++ b/tests/compute/simple.slang @@ -1,6 +1,7 @@ //TEST(smoke,compute):COMPARE_COMPUTE:-shaderobj //TEST(smoke,compute):COMPARE_COMPUTE:-dx12 -use-dxil -shaderobj //TEST(smoke,compute):COMPARE_COMPUTE:-cpu -shaderobj +//TEST(smoke,compute):COMPARE_COMPUTE:-vk -shaderobj //TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -shaderobj // CHECK: 0 diff --git a/tests/compute/structured-buffer-of-struct.slang b/tests/compute/structured-buffer-of-struct.slang new file mode 100644 index 000000000..7bfb38df8 --- /dev/null +++ b/tests/compute/structured-buffer-of-struct.slang @@ -0,0 +1,37 @@ +//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -shaderobj + +// CHECK: 2 +// CHECK-NEXT: 1 +// CHECK-NEXT: 4 +// CHECK-NEXT: 3 +// CHECK-NEXT: 6 +// CHECK-NEXT: 5 +// CHECK-NEXT: 8 +// CHECK-NEXT: 7 + +struct S +{ + int a; + int b; +}; + +//TEST_INPUT:ubuffer(data=[1 2 3 4 5 6 7 8], stride=8):out,name=buf +RWStructuredBuffer<S> buf; + +S test(S s) +{ + s.a = s.a ^ s.b; + s.b = s.a ^ s.b; + s.a = s.a ^ s.b; + return s; +} + +[numthreads(4, 1, 1)] +// void computeMain(uint i : SV_GroupIndex) +// { +// buf[i] = test(buf[i]); +// } +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + buf[dispatchThreadID.x] = test(buf[dispatchThreadID.x]); +} diff --git a/tests/compute/texture-simpler.slang b/tests/compute/texture-simpler.slang new file mode 100644 index 000000000..ce4b76f77 --- /dev/null +++ b/tests/compute/texture-simpler.slang @@ -0,0 +1,16 @@ +//TEST(compute, vulkan):COMPARE_COMPUTE:-vk -compute -shaderobj -output-using-type + +//TEST_INPUT: Texture2D(size=4, content = one):name t2D +Texture2D<float> t2D; +//TEST_INPUT: Sampler:name samplerState +SamplerState samplerState; + +//TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<float> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint i : SV_GroupIndex) +{ + float u = i * 0.25; + outputBuffer[i] = t2D.SampleLevel(samplerState, float2(u, u), 0); +} diff --git a/tests/compute/texture-simpler.slang.expected.txt b/tests/compute/texture-simpler.slang.expected.txt new file mode 100644 index 000000000..334dd67a8 --- /dev/null +++ b/tests/compute/texture-simpler.slang.expected.txt @@ -0,0 +1,5 @@ +type: float +1.000000 +1.000000 +1.000000 +1.000000 |
