Commit 04a6872c authored by Jesse Natalie's avatar Jesse Natalie Committed by Erik Faye-Lund
Browse files

microsoft/clc: Add test flags for using optimized/serialized libclc

parent 29d4beac
......@@ -41,11 +41,15 @@ using Microsoft::WRL::ComPtr;
enum compute_test_debug_flags {
COMPUTE_DEBUG_EXPERIMENTAL_SHADERS = 1 << 0,
COMPUTE_DEBUG_USE_HW_D3D = 1 << 1,
COMPUTE_DEBUG_OPTIMIZE_LIBCLC = 1 << 2,
COMPUTE_DEBUG_SERIALIZE_LIBCLC = 1 << 3,
};
static const struct debug_named_value debug_options[] = {
{ "experimental_shaders", COMPUTE_DEBUG_EXPERIMENTAL_SHADERS, "Enable experimental shaders" },
{ "use_hw_d3d", COMPUTE_DEBUG_USE_HW_D3D, "Use a hardware D3D device" },
{ "optimize_libclc", COMPUTE_DEBUG_OPTIMIZE_LIBCLC, "Optimize the clc_context before using it" },
{ "serialize_libclc", COMPUTE_DEBUG_SERIALIZE_LIBCLC, "Serialize and deserialize the clc_context" },
DEBUG_NAMED_VALUE_END
};
......@@ -630,6 +634,26 @@ ComputeTest::SetUp()
compiler_ctx_g = clc_context_new(&logger);
if (!compiler_ctx_g)
throw runtime_error("failed to create CLC compiler context");
if (debug_get_option_debug_compute() & COMPUTE_DEBUG_OPTIMIZE_LIBCLC)
clc_context_optimize(compiler_ctx_g);
if (debug_get_option_debug_compute() & COMPUTE_DEBUG_SERIALIZE_LIBCLC) {
void *serialized = nullptr;
size_t serialized_size = 0;
clc_context_serialize(compiler_ctx_g, &serialized, &serialized_size);
if (!serialized)
throw runtime_error("failed to serialize CLC compiler context");
clc_free_context(compiler_ctx_g);
compiler_ctx_g = nullptr;
compiler_ctx_g = clc_context_deserialize(serialized, serialized_size);
if (!compiler_ctx_g)
throw runtime_error("failed to deserialize CLC compiler context");
clc_context_free_serialized(serialized);
}
}
compiler_ctx = compiler_ctx_g;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment