| 41 | TEST_SUITE(CompileContext) |
| 42 | |
| 43 | TEST_CASE(CompileContextCache, framework::DatasetMode::ALL) |
| 44 | { |
| 45 | // Create compile context |
| 46 | CLCompileContext compile_context(CLKernelLibrary::get().context(), CLKernelLibrary::get().get_device()); |
| 47 | |
| 48 | // Check if the program cache is empty |
| 49 | ARM_COMPUTE_EXPECT(compile_context.get_built_programs().size() == 0, framework::LogLevel::ERRORS); |
| 50 | |
| 51 | // Create a kernel using the compile context |
| 52 | const std::string kernel_name = "floor_layer"; |
| 53 | const std::string program_name = CLKernelLibrary::get().get_program_name(kernel_name); |
| 54 | std::pair<std::string, bool> kernel_src = CLKernelLibrary::get().get_program(program_name); |
| 55 | const std::string kernel_path = CLKernelLibrary::get().get_kernel_path(); |
| 56 | |
| 57 | std::set<std::string> build_opts; |
| 58 | build_opts.emplace("-DDATA_TYPE=float"); |
| 59 | build_opts.emplace("-DVEC_SIZE=16"); |
| 60 | build_opts.emplace("-DVEC_SIZE_LEFTOVER=0"); |
| 61 | compile_context.create_kernel(kernel_name, program_name, kernel_src.first, kernel_path, build_opts, |
| 62 | kernel_src.second); |
| 63 | |
| 64 | // Check if the program is stored in the cache |
| 65 | ARM_COMPUTE_EXPECT(compile_context.get_built_programs().size() == 1, framework::LogLevel::ERRORS); |
| 66 | |
| 67 | // Try to build the same program and check if the program cache stayed the same |
| 68 | compile_context.create_kernel(kernel_name, program_name, kernel_src.first, kernel_path, build_opts, |
| 69 | kernel_src.second); |
| 70 | ARM_COMPUTE_EXPECT(compile_context.get_built_programs().size() == 1, framework::LogLevel::ERRORS); |
| 71 | } |
| 72 | |
| 73 | TEST_SUITE_END() // CompileContext |
| 74 | TEST_SUITE_END() // UNIT |
nothing calls this directly
no test coverage detected