MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / export_to_cl_image

Function export_to_cl_image

src/core/CL/CLHelpers.cpp:483–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

481}
482
483bool export_to_cl_image(const ITensorInfo *tensor)
484{
485 if (tensor->tensor_shape()[0] % 4 != 0)
486 {
487 return false;
488 }
489
490 // If not floating point
491 if (!is_data_type_float(tensor->data_type()))
492 {
493 return false;
494 }
495
496 // Check if the cl_khr_image2d_from_buffer extension is supported on the target platform
497 if (!image2d_from_buffer_supported(CLKernelLibrary::get().get_device()))
498 {
499 return false;
500 }
501
502 // Check cl image pitch alignment
503 if (get_cl_image_pitch_alignment(CLKernelLibrary::get().get_device()) == 0)
504 {
505 return false;
506 }
507
508 const size_t image_w = tensor->tensor_shape()[0] / 4;
509 const size_t image_h = tensor->tensor_shape().total_size() / tensor->tensor_shape()[0];
510 const size_t max_image_w = CLKernelLibrary::get().get_device().getInfo<CL_DEVICE_IMAGE2D_MAX_WIDTH>();
511 const size_t max_image_h = CLKernelLibrary::get().get_device().getInfo<CL_DEVICE_IMAGE2D_MAX_HEIGHT>();
512
513 if (image_w > max_image_w || image_h > max_image_h)
514 {
515 return false;
516 }
517
518 return true;
519}
520
521void set_unroll_with_pragma(CLBuildOptions &built_opts, std::initializer_list<int> values)
522{

Callers 13

validate_argumentsFunction · 0.85
validate_argumentsFunction · 0.85
validate_argumentsFunction · 0.85
use_cl_image_for_weightsFunction · 0.85
configure_G77_f32Method · 0.85
configure_G77_f16Method · 0.85
configure_default_f32Method · 0.85
configure_default_f16Method · 0.85
configure_G78_f32Method · 0.85
configure_G78_f16Method · 0.85
configure_G57_f32Method · 0.85

Calls 5

is_data_type_floatFunction · 0.85
data_typeMethod · 0.45
total_sizeMethod · 0.45

Tested by

no test coverage detected