- 
                Notifications
    You must be signed in to change notification settings 
- Fork 25
          Add distance tests
          #270
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
  
    Add distance tests
  
  #270
                      Changes from 15 commits
9540337
              9e0aab2
              339f9f7
              71ae411
              8cc532b
              f626d65
              8b75db9
              96cd7bf
              26e7437
              cb4779d
              977c5fa
              966d9d9
              c5c78c5
              414704e
              ed7e7f7
              f081c5d
              36cf096
              e5b53c4
              d056bd1
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| #--- source.hlsl | ||
|  | ||
| StructuredBuffer<float4> X : register(t0); | ||
| StructuredBuffer<float4> Y : register(t1); | ||
|  | ||
| RWStructuredBuffer<float> Result : register(u2); | ||
|  | ||
| [numthreads(1,1,1)] | ||
| void main() { | ||
| // distance ({1.125}, {2.375}) = 1.25 | ||
| float R0 = distance(X[0].x, Y[0].x); | ||
| Result[0] = R0; | ||
| float R0_constant = distance(1.125, 2.375); | ||
| Result[1] = R0_constant; | ||
|  | ||
| // distance({1.125, 2.5}, {2.375, 5.25}) = 3.02076 | ||
| float R1 = distance(X[0].xy, Y[0].xy); | ||
| Result[2] = R1; | ||
| float R1_constant = distance(float2(1.125, 2.5), float2(2.375, 5.25)); | ||
| Result[3] = R1_constant; | ||
|  | ||
| // distance({1.125, 2.5, 4.75}, {2.375, 5.25, 8.375}) = 4.71865 | ||
| float R2 = distance(float3(1.125, 2.5, 4.75), float3(2.375, 5.25, 8.375)); | ||
| Result[4] = R2; | ||
| float R2_constant = distance(X[0].xyz, Y[0].xyz); | ||
| Result[5] = R2_constant; | ||
|  | ||
| // distance({1.125, 2.5, 4.75, 6.625}, {2.375, 5.25, 8.375, 5.30}) = 4.90115 | ||
| float R3 = distance(X[0].xyzw, Y[0].xyzw); | ||
|         
                  kmpeng marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| Result[6] = R3; | ||
| float R3_constant = distance(float4(1.125, 2.5, 4.75, 6.625), float4(1.125, 2.5, 4.75, 6.625)); | ||
| Result[7] = R3; | ||
|         
                  kmpeng marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| } | ||
|  | ||
| //--- pipeline.yaml | ||
|  | ||
| --- | ||
| Shaders: | ||
| - Stage: Compute | ||
| Entry: main | ||
| DispatchSize: [1, 1, 1] | ||
| Buffers: | ||
| - Name: X | ||
| Format: Float32 | ||
| Stride: 16 | ||
| Data: [ 1.125, 2.5, 4.75, 6.625 ] | ||
|         
                  kmpeng marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| - Name: Y | ||
| Format: Float32 | ||
| Stride: 16 | ||
| Data: [ 2.375, 5.25, 8.375, 5.30 ] | ||
| - Name: Result | ||
| Format: Float32 | ||
| Stride: 4 | ||
| ZeroInitSize: 32 | ||
| - Name: ExpectedResult | ||
| Format: Float32 | ||
| Stride: 4 | ||
| Data: [ 1.25, 1.25, 3.02076, 3.02076, 4.71865, 4.71865, 4.90115, 4.90115 ] | ||
| Results: | ||
| - Result: CheckResult | ||
| Rule: BufferFloatEpsilon | ||
| Epsilon: .0008 | ||
| Actual: Result | ||
| Expected: ExpectedResult | ||
| DescriptorSets: | ||
| - Resources: | ||
| - Name: X | ||
| Kind: StructuredBuffer | ||
| DirectXBinding: | ||
| Register: 0 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 0 | ||
| - Name: Y | ||
| Kind: StructuredBuffer | ||
| DirectXBinding: | ||
| Register: 1 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 1 | ||
| - Name: Result | ||
| Kind: RWStructuredBuffer | ||
| DirectXBinding: | ||
| Register: 2 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 2 | ||
| ... | ||
| #--- end | ||
|  | ||
| # UNSUPPORTED: Clang-Vulkan | ||
| # Clang-Vulkan is unsupported because of two validation errors | ||
| # This issue tracks its resolution: https://github.com/llvm/offload-test-suite/issues/285 | ||
| # RUN: split-file %s %t | ||
| # RUN: %dxc_target -T cs_6_5 -Fo %t.o %t/source.hlsl | ||
| # RUN: %offloader %t/pipeline.yaml %t.o | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| #--- source.hlsl | ||
|         
                  kmpeng marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| StructuredBuffer<half4> X : register(t0); | ||
| StructuredBuffer<half4> Y : register(t1); | ||
|  | ||
| RWStructuredBuffer<half> Result : register(u2); | ||
|  | ||
| [numthreads(1,1,1)] | ||
| void main() { | ||
| // distance ({1.125}, {2.375}) = 1.25 | ||
| half R0 = distance(X[0].x, Y[0].x); | ||
| Result[0] = R0; | ||
| half R0_constant = distance(half(1.125), half(2.375)); | ||
| Result[1] = R0_constant; | ||
|  | ||
| // distance({1.125, 2.5}, {2.375, 5.25}) = 3.02076 | ||
| half R1 = distance(X[0].xy, Y[0].xy); | ||
| Result[2] = R1; | ||
| half R1_constant = distance(half2(1.125, 2.5), half2(2.375, 5.25)); | ||
| Result[3] = R1_constant; | ||
|  | ||
| // distance({1.125, 2.5, 4.75}, {2.375, 5.25, 8.375}) = 4.71865 | ||
| half R2 = distance(X[0].xyz, Y[0].xyz); | ||
| Result[4] = R2; | ||
| half R2_constant = distance(half3(1.125, 2.5, 4.75), half3(2.375, 5.25, 8.375)); | ||
| Result[5] = R2_constant; | ||
|  | ||
| // distance({1.125, 2.5, 4.75, 6.625}, {2.375, 5.25, 8.375, 5.30}) = 4.90115 | ||
| half R3 = distance(X[0].xyzw, Y[0].xyzw); | ||
| Result[6] = R3; | ||
| half R3_constant = distance(half4(1.125, 2.5, 4.75, 6.625), half4(2.375, 5.25, 8.375, 5.30)); | ||
| Result[7] = R3_constant; | ||
| } | ||
|  | ||
| //--- pipeline.yaml | ||
|  | ||
| --- | ||
| Shaders: | ||
| - Stage: Compute | ||
| Entry: main | ||
| DispatchSize: [1, 1, 1] | ||
| Buffers: | ||
| - Name: X | ||
| Format: Float16 | ||
| Stride: 8 | ||
| Data: [ 0x3c80, 0x4100, 0x44c0, 0x46a0 ] | ||
| - Name: Y | ||
|         
                  kmpeng marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| Format: Float16 | ||
| Stride: 8 | ||
| Data: [ 0x40c0, 0x4540, 0x4830, 0x454d ] | ||
| - Name: Result | ||
| Format: Float16 | ||
| Stride: 2 | ||
| ZeroInitSize: 16 | ||
| - Name: ExpectedResult | ||
| Format: Float16 | ||
| Stride: 2 | ||
| Data: [ 0x3d00, 0x3d00, 0x420b, 0x420b, 0x44b8, 0x44b8, 0x44e7, 0x44e7 ] | ||
| Results: | ||
| - Result: CheckResult | ||
| Rule: BufferFloatULP | ||
| ULPT: 5 | ||
| Actual: Result | ||
| Expected: ExpectedResult | ||
| DescriptorSets: | ||
| - Resources: | ||
| - Name: X | ||
| Kind: StructuredBuffer | ||
| DirectXBinding: | ||
| Register: 0 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 0 | ||
| - Name: Y | ||
| Kind: StructuredBuffer | ||
| DirectXBinding: | ||
| Register: 1 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 1 | ||
| - Name: Result | ||
| Kind: RWStructuredBuffer | ||
| DirectXBinding: | ||
| Register: 2 | ||
| Space: 0 | ||
| VulkanBinding: | ||
| Binding: 2 | ||
| ... | ||
| #--- end | ||
|  | ||
| # UNSUPPORTED: Clang-Vulkan | ||
|          | ||
| # Clang-Vulkan is unsupported because of two validation errors | ||
| # This issue tracks its resolution: https://github.com/llvm/offload-test-suite/issues/285 | ||
| # REQUIRES: Half | ||
| # RUN: split-file %s %t | ||
| # RUN: %dxc_target -enable-16bit-types -T cs_6_5 -Fo %t.o %t/source.hlsl | ||
| # RUN: %offloader %t/pipeline.yaml %t.o | ||
Uh oh!
There was an error while loading. Please reload this page.