|
112 | 112 | llvm_config.add_tool_substitutions(['llvm-spirv'], [config.sycl_tools_dir])
|
113 | 113 |
|
114 | 114 | if not config.sycl_be:
|
115 |
| - config.sycl_be="PI_OPENCL" |
| 115 | + lit_config.error("SYCL backend is not specified") |
| 116 | + |
| 117 | +# Mapping from SYCL_BE backend definition style to SYCL_DEVICE_FILTER used |
| 118 | +# for backward compatibility |
| 119 | +try: |
| 120 | + config.sycl_be = { 'PI_OPENCL': 'opencl', 'PI_CUDA': 'cuda', 'PI_LEVEL_ZERO': 'level_zero'}[config.sycl_be] |
| 121 | +except: |
| 122 | + # do nothing a we expect that new format of plugin values are used |
| 123 | + pass |
116 | 124 |
|
117 |
| -config.substitutions.append( ('%sycl_be', config.sycl_be) ) |
118 | 125 | lit_config.note("Backend: {BACKEND}".format(BACKEND=config.sycl_be))
|
119 | 126 |
|
| 127 | +config.substitutions.append( ('%sycl_be', config.sycl_be) ) |
| 128 | +config.available_features.add(config.sycl_be) |
| 129 | +config.substitutions.append( ('%BE_RUN_PLACEHOLDER', "env SYCL_DEVICE_FILTER={SYCL_PLUGIN} ".format(SYCL_PLUGIN=config.sycl_be)) ) |
| 130 | + |
120 | 131 | if config.dump_ir_supported:
|
121 | 132 | config.available_features.add('dump_ir')
|
122 | 133 |
|
123 |
| -cuda = False |
124 |
| -if ( config.sycl_be == "PI_OPENCL" ): |
125 |
| - config.available_features.add('opencl') |
126 |
| -elif ( config.sycl_be == "PI_CUDA" ): |
127 |
| - config.available_features.add('cuda') |
128 |
| - cuda = True |
129 |
| -elif ( config.sycl_be == "PI_LEVEL_ZERO" ): |
130 |
| - config.available_features.add('level_zero') |
131 |
| -else: |
| 134 | +if config.sycl_be not in ['host', 'opencl','cuda', 'level_zero']: |
132 | 135 | lit_config.error("Unknown SYCL BE specified '" +
|
133 | 136 | config.sycl_be +
|
134 |
| - "' supported values are PI_OPENCL, PI_CUDA, PI_LEVEL_ZERO") |
| 137 | + "' supported values are opencl, cuda, level_zero") |
135 | 138 |
|
136 |
| -esimd_run_substitute = "env SYCL_BE={SYCL_BE} SYCL_DEVICE_TYPE=GPU SYCL_PROGRAM_COMPILE_OPTIONS=-vc-codegen".format(SYCL_BE=config.sycl_be) |
| 139 | +esimd_run_substitute = "env SYCL_DEVICE_FILTER={SYCL_PLUGIN}:gpu SYCL_PROGRAM_COMPILE_OPTIONS=-vc-codegen".format(SYCL_PLUGIN=config.sycl_be) |
137 | 140 | config.substitutions.append( ('%ESIMD_RUN_PLACEHOLDER', esimd_run_substitute) )
|
138 | 141 |
|
139 | 142 | config.substitutions.append( ('%clangxx-esimd', config.dpcpp_compiler +
|
|
163 | 166 | if 'host' in config.target_devices.split(','):
|
164 | 167 | found_at_least_one_device = True
|
165 | 168 | lit_config.note("Test HOST device")
|
166 |
| - host_run_substitute = "env SYCL_DEVICE_TYPE=HOST SYCL_BE={SYCL_BE} ".format(SYCL_BE=config.sycl_be) |
| 169 | + host_run_substitute = "env SYCL_DEVICE_FILTER={SYCL_PLUGIN}:host ".format(SYCL_PLUGIN=config.sycl_be) |
167 | 170 | host_check_substitute = "| FileCheck %s"
|
168 | 171 | config.available_features.add('host')
|
169 | 172 | if platform.system() == "Linux":
|
170 |
| - host_run_on_linux_substitute = "env SYCL_DEVICE_TYPE=HOST SYCL_BE={SYCL_BE} ".format(SYCL_BE=config.sycl_be) |
| 173 | + host_run_on_linux_substitute = "env SYCL_DEVICE_FILTER={SYCL_PLUGIN}:host ".format(SYCL_PLUGIN=config.sycl_be) |
171 | 174 | host_check_on_linux_substitute = "| FileCheck %s"
|
172 | 175 | else:
|
173 | 176 | lit_config.warning("HOST device not used")
|
|
185 | 188 | if 'cpu' in config.target_devices.split(','):
|
186 | 189 | found_at_least_one_device = True
|
187 | 190 | lit_config.note("Test CPU device")
|
188 |
| - cpu_run_substitute = "env SYCL_DEVICE_TYPE=CPU SYCL_BE={SYCL_BE} ".format(SYCL_BE=config.sycl_be) |
| 191 | + cpu_run_substitute = "env SYCL_DEVICE_FILTER={SYCL_PLUGIN}:cpu ".format(SYCL_PLUGIN=config.sycl_be) |
189 | 192 | cpu_check_substitute = "| FileCheck %s"
|
190 | 193 | config.available_features.add('cpu')
|
191 | 194 | if platform.system() == "Linux":
|
192 |
| - cpu_run_on_linux_substitute = "env SYCL_DEVICE_TYPE=CPU SYCL_BE={SYCL_BE} ".format(SYCL_BE=config.sycl_be) |
| 195 | + cpu_run_on_linux_substitute = "env SYCL_DEVICE_FILTER={SYCL_PLUGIN}:cpu ".format(SYCL_PLUGIN=config.sycl_be) |
193 | 196 | cpu_check_on_linux_substitute = "| FileCheck %s"
|
194 | 197 | else:
|
195 | 198 | lit_config.warning("CPU device not used")
|
|
208 | 211 | if 'gpu' in config.target_devices.split(','):
|
209 | 212 | found_at_least_one_device = True
|
210 | 213 | lit_config.note("Test GPU device")
|
211 |
| - gpu_run_substitute = " env SYCL_DEVICE_TYPE=GPU SYCL_BE={SYCL_BE} ".format(SYCL_BE=config.sycl_be) |
| 214 | + gpu_run_substitute = " env SYCL_DEVICE_FILTER={SYCL_PLUGIN}:gpu ".format(SYCL_PLUGIN=config.sycl_be) |
212 | 215 | gpu_check_substitute = "| FileCheck %s"
|
213 | 216 | config.available_features.add('gpu')
|
214 | 217 |
|
215 | 218 | if platform.system() == "Linux":
|
216 |
| - gpu_run_on_linux_substitute = "env SYCL_DEVICE_TYPE=GPU SYCL_BE={SYCL_BE} ".format(SYCL_BE=config.sycl_be) |
| 219 | + gpu_run_on_linux_substitute = "env SYCL_DEVICE_FILTER={SYCL_PLUGIN}:gpu ".format(SYCL_PLUGIN=config.sycl_be) |
217 | 220 | gpu_check_on_linux_substitute = "| FileCheck %s"
|
218 | 221 |
|
219 | 222 | else:
|
|
229 | 232 | if 'acc' in config.target_devices.split(','):
|
230 | 233 | found_at_least_one_device = True
|
231 | 234 | lit_config.note("Tests accelerator device")
|
232 |
| - acc_run_substitute = " env SYCL_DEVICE_TYPE=ACC " |
| 235 | + acc_run_substitute = " env SYCL_DEVICE_FILTER={SYCL_PLUGIN}:acc ".format(SYCL_PLUGIN=config.sycl_be) |
233 | 236 | acc_check_substitute = "| FileCheck %s"
|
234 | 237 | config.available_features.add('accelerator')
|
235 | 238 | else:
|
236 | 239 | lit_config.warning("Accelerator device not used")
|
237 | 240 | config.substitutions.append( ('%ACC_RUN_PLACEHOLDER', acc_run_substitute) )
|
238 | 241 | config.substitutions.append( ('%ACC_CHECK_PLACEHOLDER', acc_check_substitute) )
|
239 | 242 |
|
240 |
| -if cuda: |
| 243 | +if config.sycl_be == 'cuda': |
241 | 244 | config.substitutions.append( ('%sycl_triple', "nvptx64-nvidia-cuda-sycldevice" ) )
|
242 | 245 | else:
|
243 | 246 | config.substitutions.append( ('%sycl_triple', "spir64-unknown-linux-sycldevice" ) )
|
|
0 commit comments