| 505 | } |
| 506 | |
| 507 | host_program::host_program_entry host_compute::create_host_program_internal(const host_device& device floor_unused /* TODO: use device */, |
| 508 | const optional<string> elf_bin_file_name, |
| 509 | const uint8_t* elf_bin_data, |
| 510 | const size_t elf_bin_size, |
| 511 | const vector<llvm_toolchain::function_info>& functions, |
| 512 | const bool& silence_debug_output) { |
| 513 | host_program::host_program_entry ret; |
| 514 | ret.functions = functions; |
| 515 | |
| 516 | unique_ptr<elf_binary> bin; |
| 517 | if (elf_bin_file_name && !elf_bin_file_name->empty()) { |
| 518 | bin = make_unique<elf_binary>(*elf_bin_file_name); |
| 519 | } else if (elf_bin_data != nullptr && elf_bin_size > 0) { |
| 520 | bin = make_unique<elf_binary>(elf_bin_data, elf_bin_size); |
| 521 | } else { |
| 522 | log_error("invalid ELF binary specification"); |
| 523 | return {}; |
| 524 | } |
| 525 | if (!bin->is_valid()) { |
| 526 | log_error("failed to load ELF binary"); |
| 527 | return {}; |
| 528 | } |
| 529 | ret.program = std::move(bin); |
| 530 | |
| 531 | if (!silence_debug_output) { |
| 532 | log_debug("successfully created host program!"); |
| 533 | } |
| 534 | |
| 535 | ret.valid = true; |
| 536 | return ret; |
| 537 | } |
| 538 | |
| 539 | shared_ptr<compute_program> host_compute::add_precompiled_program_file(const string& file_name floor_unused, |
| 540 | const vector<llvm_toolchain::function_info>& functions floor_unused) { |