| 481 | } |
| 482 | |
| 483 | bool 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 | |
| 521 | void set_unroll_with_pragma(CLBuildOptions &built_opts, std::initializer_list<int> values) |
| 522 | { |
no test coverage detected