MCPcopy Create free account
hub / github.com/AdaptiveCpp/AdaptiveCpp / submit_sscp_kernel_from_code_object

Method submit_sscp_kernel_from_code_object

src/runtime/ocl/ocl_queue.cpp:452–622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450}
451
452result ocl_queue::submit_sscp_kernel_from_code_object(
453 hcf_object_id hcf_object, std::string_view kernel_name,
454 const rt::hcf_kernel_info *kernel_info, const rt::range<3> &num_groups,
455 const rt::range<3> &group_size, unsigned local_mem_size, void **args,
456 std::size_t *arg_sizes, std::size_t num_args,
457 const kernel_configuration &initial_config) {
458
459#ifdef HIPSYCL_WITH_SSCP_COMPILER
460
461 if(!kernel_info) {
462 return make_error(
463 __acpp_here(),
464 error_info{"ocl_queue: Could not obtain hcf kernel info for kernel " +
465 std::string{kernel_name}});
466 }
467
468 common::spin_lock_guard lock{_sscp_submission_spin_lock};
469
470 _arg_mapper.construct_mapping(*kernel_info, args, arg_sizes, num_args);
471
472 if(!_arg_mapper.mapping_available()) {
473 return make_error(
474 __acpp_here(),
475 error_info{
476 "ocl_queue: Could not map C++ arguments to kernel arguments"});
477 }
478
479 kernel_adaptivity_engine adaptivity_engine{
480 hcf_object, kernel_name, kernel_info, _arg_mapper, num_groups,
481 group_size, args, arg_sizes, num_args, local_mem_size};
482
483 ocl_hardware_context *hw_ctx = static_cast<ocl_hardware_context *>(
484 _hw_manager->get_device(_device_index));
485 cl::Context ctx = hw_ctx->get_cl_context();
486 cl::Device dev = hw_ctx->get_cl_device();
487
488 _config = initial_config;
489
490 _config.append_base_configuration(
491 kernel_base_config_parameter::backend_id, backend_id::ocl);
492 _config.append_base_configuration(
493 kernel_base_config_parameter::compilation_flow,
494 compilation_flow::sscp);
495 _config.append_base_configuration(
496 kernel_base_config_parameter::hcf_object_id, hcf_object);
497
498 for(const auto& flag : kernel_info->get_compilation_flags())
499 _config.set_build_flag(flag);
500 for(const auto& opt : kernel_info->get_compilation_options())
501 _config.set_build_option(opt.first, opt.second);
502
503 _config.set_build_option(
504 kernel_build_option::spirv_dynamic_local_mem_allocation_size,
505 local_mem_size);
506
507 // Not all OpenCL implementations support these extensions,
508 // however if user code doesn't need them, then the compiler should in theory
509 // not generate code that requires them. This should allow us to

Callers 1

submit_kernelMethod · 0.45

Calls 15

make_errorFunction · 0.85
compile_and_store_statsFunction · 0.85
register_errorFunction · 0.85
load_jit_output_metadataFunction · 0.85
submit_ocl_kernelFunction · 0.85
make_successFunction · 0.85
construct_mappingMethod · 0.80
mapping_availableMethod · 0.80
set_build_flagMethod · 0.80
set_build_optionMethod · 0.80

Tested by

no test coverage detected