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

Function TEST_CASE

tests/validation/CL/UNIT/CompileContext.cpp:43–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41TEST_SUITE(CompileContext)
42
43TEST_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
73TEST_SUITE_END() // CompileContext
74TEST_SUITE_END() // UNIT

Callers

nothing calls this directly

Calls 6

contextMethod · 0.80
get_program_nameMethod · 0.80
get_programMethod · 0.80
get_kernel_pathMethod · 0.80
sizeMethod · 0.45
create_kernelMethod · 0.45

Tested by

no test coverage detected