Skip to content

Commit 6bad175

Browse files
authored
[SPIRV][DX] Share one test between backends (llvm#65975)
One big issue with DirectXShaderCompiler was test coverage: DXIL and SPIR-V backends had their own tests. When a bug was found in one, the other wasn't always checked. This lead to unequal support of HLSL for both backends. We'd like to avoid those issues here, hence the test-sharing. By default, all the tests in this folder are marked as requiring DirectX. But as SPIR-V support grows, each test drop this requirement, and check the SPIR-V behavior. I would have preferred to mark new tests as XFAIL for SPIR-V by default, so we could differentiate real unsupported tests (as SPIR-V has no equivalent), from newly added tests. But the way LIT is built, I don't think this is possible. --------- Signed-off-by: Nathan Gauër <[email protected]>
1 parent f23246a commit 6bad175

File tree

3 files changed

+29
-17
lines changed

3 files changed

+29
-17
lines changed

llvm/test/CodeGen/DirectX/empty_cs_entry.ll

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
; RUN: %if directx-registered-target %{ opt -S -dxil-metadata-emit < %s | FileCheck %s --check-prefix=DXIL-CHECK %}
2+
; RUN: %if spirv-registered-target %{ llc %s -mtriple=spirv-unknown-unknown -o - | FileCheck %s --check-prefix=SPIRV-CHECK %}
3+
4+
target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64"
5+
target triple = "dxil-unknown-shadermodel6.7-compute"
6+
7+
;DXIL-CHECK:!dx.entryPoints = !{![[entry:[0-9]+]]}
8+
9+
;DXIL-CHECK:![[entry]] = !{ptr @entry, !"entry", null, null, ![[extra:[0-9]+]]}
10+
;DXIL-CHECK:![[extra]] = !{i32 4, ![[numthreads:[0-9]+]]}
11+
;DXIL-CHECK:![[numthreads]] = !{i32 1, i32 2, i32 1}
12+
13+
;SPIRV-CHECK: OpCapability Shader
14+
;SPIRV-CHECK: OpMemoryModel Logical GLSL450
15+
;SPIRV-CHECK: OpEntryPoint GLCompute [[main:%[0-9]+]] "entry"
16+
;SPIRV-CHECK: OpExecutionMode [[main]] LocalSize 1 2 1
17+
;SPIRV-CHECK: [[void:%[0-9]+]] = OpTypeVoid
18+
;SPIRV-CHECK: [[ftype:%[0-9]+]] = OpTypeFunction [[void]]
19+
;SPIRV-CHECK: [[main]] = OpFunction [[void]] DontInline [[ftype]]
20+
21+
; Function Attrs: noinline nounwind
22+
define void @entry() #0 {
23+
entry:
24+
ret void
25+
}
26+
27+
attributes #0 = { noinline nounwind "hlsl.numthreads"="1,2,1" "hlsl.shader"="compute" }

llvm/test/Frontend/HLSL/lit.local.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
if not "DirectX" in config.root.targets and not "SPIRV" in config.root.targets:
2+
config.unsupported = True

0 commit comments

Comments
 (0)