| 256 | llvm_toolchain::program_data prog_data; |
| 257 | }; |
| 258 | static compile_return_t compile_target(const string& src_input, |
| 259 | const bool is_file_input, |
| 260 | const llvm_toolchain::compile_options& user_options, |
| 261 | const target& build_target, |
| 262 | const bool use_precompiled_header) { |
| 263 | auto options = user_options; |
| 264 | // always ignore run-time info, we want a reproducible and specific build |
| 265 | options.ignore_runtime_info = true; |
| 266 | |
| 267 | uint32_t toolchain_version = 0; |
| 268 | shared_ptr<compute_device> dev; |
| 269 | switch (build_target.common.type) { |
| 270 | case COMPUTE_TYPE::OPENCL: { |
| 271 | dev = make_shared<opencl_device>(); |
| 272 | const auto& cl_target = build_target.opencl; |
| 273 | auto& cl_dev = (opencl_device&)*dev; |
| 274 | |
| 275 | toolchain_version = floor::get_opencl_toolchain_version(); |
| 276 | options.target = (cl_target.is_spir ? llvm_toolchain::TARGET::SPIR : llvm_toolchain::TARGET::SPIRV_OPENCL); |
| 277 | if (options.target == llvm_toolchain::TARGET::SPIRV_OPENCL) { |
| 278 | cl_dev.param_workaround = true; |
| 279 | } |
| 280 | |
| 281 | cl_dev.cl_version = cl_version_from_uint(cl_target.major, cl_target.minor); |
| 282 | cl_dev.c_version = cl_dev.cl_version; |
| 283 | cl_dev.spirv_version = (cl_target.is_spir ? SPIRV_VERSION::NONE : SPIRV_VERSION::SPIRV_1_0); |
| 284 | |
| 285 | cl_dev.image_depth_support = cl_target.image_depth_support; |
| 286 | cl_dev.image_msaa_support = cl_target.image_msaa_support; |
| 287 | cl_dev.image_mipmap_support = cl_target.image_mipmap_support; |
| 288 | cl_dev.image_mipmap_write_support = cl_target.image_mipmap_write_support; |
| 289 | cl_dev.image_read_write_support = cl_target.image_read_write_support; |
| 290 | cl_dev.double_support = cl_target.double_support; |
| 291 | cl_dev.basic_64_bit_atomics_support = cl_target.basic_64_bit_atomics_support; |
| 292 | cl_dev.extended_64_bit_atomics_support = cl_target.extended_64_bit_atomics_support; |
| 293 | cl_dev.sub_group_support = cl_target.sub_group_support; |
| 294 | |
| 295 | if (cl_target.simd_width > 0) { |
| 296 | cl_dev.simd_width = cl_target.simd_width; |
| 297 | cl_dev.simd_range = { cl_dev.simd_width, cl_dev.simd_width }; |
| 298 | } |
| 299 | |
| 300 | // device type |
| 301 | switch (cl_target.device_target) { |
| 302 | case decltype(cl_target.device_target)::GENERIC: |
| 303 | cl_dev.type = compute_device::TYPE::NONE; |
| 304 | break; |
| 305 | case decltype(cl_target.device_target)::GENERIC_CPU: |
| 306 | case decltype(cl_target.device_target)::INTEL_CPU: |
| 307 | case decltype(cl_target.device_target)::AMD_CPU: |
| 308 | cl_dev.type = compute_device::TYPE::CPU0; |
| 309 | break; |
| 310 | case decltype(cl_target.device_target)::GENERIC_GPU: |
| 311 | case decltype(cl_target.device_target)::INTEL_GPU: |
| 312 | case decltype(cl_target.device_target)::AMD_GPU: |
| 313 | cl_dev.type = compute_device::TYPE::GPU0; |
| 314 | break; |
| 315 | } |
no test coverage detected