34
34
config .test_source_root = os .path .dirname (__file__ )
35
35
36
36
# test_exec_root: The root path where tests should be run.
37
- config .test_exec_root = os .path .join (config .offloadtest_obj_root , "test" , config .offloadtest_suite )
37
+ config .test_exec_root = os .path .join (
38
+ config .offloadtest_obj_root , "test" , config .offloadtest_suite
39
+ )
38
40
39
41
# Tweak the PATH to include the tools dir.
40
42
llvm_config .with_environment ("PATH" , config .llvm_tools_dir , append_path = True )
41
43
42
44
tools = [
43
45
ToolSubst ("FileCheck" , FindTool ("FileCheck" )),
44
46
ToolSubst ("split-file" , FindTool ("split-file" )),
45
- ToolSubst ("imgdiff" , FindTool ("imgdiff" ))
47
+ ToolSubst ("imgdiff" , FindTool ("imgdiff" )),
46
48
]
47
49
50
+
48
51
def setDeviceFeatures (config , device , compiler ):
49
- API = device ['API' ]
50
- config .available_features .add (API )
51
- if "Microsoft Basic Render Driver" in device ['Description' ]:
52
- config .available_features .add ("%s-WARP" % API )
53
- if "Intel" in device ['Description' ]:
54
- config .available_features .add ("%s-Intel" % API )
55
- if "NVIDIA" in device ['Description' ]:
56
- config .available_features .add ("%s-NV" % API )
57
- if "AMD" in device ['Description' ]:
58
- config .available_features .add ("%s-AMD" % API )
59
-
60
- config .available_features .add ("%s-%s" % (compiler , API ))
61
-
62
- if device ['API' ] == "DirectX" :
63
- if device ['Features' ].get ('Native16BitShaderOpsSupported' , False ):
64
- config .available_features .add ("Int16" )
65
- config .available_features .add ("Half" )
66
- if device ['Features' ].get ('DoublePrecisionFloatShaderOps' , False ):
67
- config .available_features .add ("Double" )
68
- if device ['Features' ].get ('Int64ShaderOps' , False ):
69
- config .available_features .add ("Int64" )
70
-
71
- if device ['API' ] == "Metal" :
72
- config .available_features .add ("Int16" )
73
- config .available_features .add ("Half" )
74
-
75
- if device ['API' ] == "Vulkan" :
76
- if device ['Features' ].get ('shaderInt16' , False ):
77
- config .available_features .add ("Int16" )
78
- if device ['Features' ].get ('shaderFloat16' , False ):
79
- config .available_features .add ("Half" )
80
- if device ['Features' ].get ('shaderFloat64' , False ):
81
- config .available_features .add ("Double" )
82
- if device ['Features' ].get ('shaderInt64' , False ):
83
- config .available_features .add ("Int64" )
52
+ API = device ["API" ]
53
+ config .available_features .add (API )
54
+ if "Microsoft Basic Render Driver" in device ["Description" ]:
55
+ config .available_features .add ("%s-WARP" % API )
56
+ if "Intel" in device ["Description" ]:
57
+ config .available_features .add ("%s-Intel" % API )
58
+ if "NVIDIA" in device ["Description" ]:
59
+ config .available_features .add ("%s-NV" % API )
60
+ if "AMD" in device ["Description" ]:
61
+ config .available_features .add ("%s-AMD" % API )
62
+
63
+ config .available_features .add ("%s-%s" % (compiler , API ))
64
+
65
+ if device ["API" ] == "DirectX" :
66
+ if device ["Features" ].get ("Native16BitShaderOpsSupported" , False ):
67
+ config .available_features .add ("Int16" )
68
+ config .available_features .add ("Half" )
69
+ if device ["Features" ].get ("DoublePrecisionFloatShaderOps" , False ):
70
+ config .available_features .add ("Double" )
71
+ if device ["Features" ].get ("Int64ShaderOps" , False ):
72
+ config .available_features .add ("Int64" )
73
+
74
+ if device ["API" ] == "Metal" :
75
+ config .available_features .add ("Int16" )
76
+ config .available_features .add ("Half" )
77
+
78
+ if device ["API" ] == "Vulkan" :
79
+ if device ["Features" ].get ("shaderInt16" , False ):
80
+ config .available_features .add ("Int16" )
81
+ if device ["Features" ].get ("shaderFloat16" , False ):
82
+ config .available_features .add ("Half" )
83
+ if device ["Features" ].get ("shaderFloat64" , False ):
84
+ config .available_features .add ("Double" )
85
+ if device ["Features" ].get ("shaderInt64" , False ):
86
+ config .available_features .add ("Int64" )
87
+
84
88
85
89
if config .offloadtest_test_warp :
86
- tools .append (ToolSubst ("%offloader" , command = FindTool ("offloader" ), extra_args = ["-warp" ]))
90
+ tools .append (
91
+ ToolSubst ("%offloader" , command = FindTool ("offloader" ), extra_args = ["-warp" ])
92
+ )
87
93
else :
88
- tools .append (ToolSubst ("%offloader" , FindTool ("offloader" )))
94
+ tools .append (ToolSubst ("%offloader" , FindTool ("offloader" )))
89
95
90
96
ExtraCompilerArgs = []
91
97
if config .offloadtest_enable_vulkan :
92
- ExtraCompilerArgs = [' -spirv' , ' -fspv-target-env=vulkan1.3' ]
98
+ ExtraCompilerArgs = [" -spirv" , " -fspv-target-env=vulkan1.3" ]
93
99
if config .offloadtest_enable_metal :
94
- ExtraCompilerArgs = [' -metal' ]
100
+ ExtraCompilerArgs = [" -metal" ]
95
101
96
- HLSLCompiler = ''
102
+ HLSLCompiler = ""
97
103
if config .offloadtest_test_clang :
98
- if os .path .exists (config .offloadtest_dxc_dir ):
99
- ExtraCompilerArgs .append ("--dxv-path=%s" % config .offloadtest_dxc_dir )
100
- tools .append (ToolSubst ("%dxc_target" , FindTool ("clang-dxc" ), extra_args = ExtraCompilerArgs ))
101
- else :
102
- tools .append (ToolSubst ("%dxc_target" , FindTool ("clang-dxc" ), extra_args = ExtraCompilerArgs ))
103
- HLSLCompiler = 'Clang'
104
+ if os .path .exists (config .offloadtest_dxc_dir ):
105
+ ExtraCompilerArgs .append ("--dxv-path=%s" % config .offloadtest_dxc_dir )
106
+ tools .append (
107
+ ToolSubst (
108
+ "%dxc_target" , FindTool ("clang-dxc" ), extra_args = ExtraCompilerArgs
109
+ )
110
+ )
111
+ else :
112
+ tools .append (
113
+ ToolSubst (
114
+ "%dxc_target" , FindTool ("clang-dxc" ), extra_args = ExtraCompilerArgs
115
+ )
116
+ )
117
+ HLSLCompiler = "Clang"
104
118
else :
105
- tools .append (ToolSubst ("%dxc_target" , config .offloadtest_dxc , extra_args = ExtraCompilerArgs ))
106
- HLSLCompiler = 'DXC'
119
+ tools .append (
120
+ ToolSubst ("%dxc_target" , config .offloadtest_dxc , extra_args = ExtraCompilerArgs )
121
+ )
122
+ HLSLCompiler = "DXC"
107
123
108
124
config .available_features .add (HLSLCompiler )
109
125
@@ -115,25 +131,25 @@ def setDeviceFeatures(config, device, compiler):
115
131
target_device = None
116
132
117
133
# Find the right device to configure against
118
- for device in devices [' Devices' ]:
119
- is_warp = "Microsoft Basic Render Driver" in device [' Description' ]
120
- if device [' API' ] == "DirectX" and config .offloadtest_enable_d3d12 :
121
- if is_warp and config .offloadtest_test_warp :
122
- target_device = device
123
- elif not is_warp and not config .offloadtest_test_warp :
124
- target_device = device
125
- if device [' API' ] == "Metal" and config .offloadtest_enable_metal :
126
- target_device = device
127
- if device [' API' ] == "Vulkan" and config .offloadtest_enable_vulkan :
128
- target_device = device
129
- # Bail from th eloop if we found a device that matches what we're looking for.
130
- if target_device :
131
- break
134
+ for device in devices [" Devices" ]:
135
+ is_warp = "Microsoft Basic Render Driver" in device [" Description" ]
136
+ if device [" API" ] == "DirectX" and config .offloadtest_enable_d3d12 :
137
+ if is_warp and config .offloadtest_test_warp :
138
+ target_device = device
139
+ elif not is_warp and not config .offloadtest_test_warp :
140
+ target_device = device
141
+ if device [" API" ] == "Metal" and config .offloadtest_enable_metal :
142
+ target_device = device
143
+ if device [" API" ] == "Vulkan" and config .offloadtest_enable_vulkan :
144
+ target_device = device
145
+ # Bail from th eloop if we found a device that matches what we're looking for.
146
+ if target_device :
147
+ break
132
148
133
149
if not target_device :
134
- config .fatal (' No target device found!' )
150
+ config .fatal (" No target device found!" )
135
151
setDeviceFeatures (config , target_device , HLSLCompiler )
136
152
137
153
if os .path .exists (config .goldenimage_dir ):
138
- config .substitutions .append (("%goldenimage_dir" , config .goldenimage_dir ))
139
- config .available_features .add ("goldenimage" )
154
+ config .substitutions .append (("%goldenimage_dir" , config .goldenimage_dir ))
155
+ config .available_features .add ("goldenimage" )
0 commit comments