Skip to content

Commit

Permalink
Fix testOptLevel
Browse files Browse the repository at this point in the history
Recreate LLPC context between iterations. The LLPC context is not
meant to be reused.

Related to #2434.
Fixes check-amdllpc-units on Windows.
  • Loading branch information
piotrAMD committed Oct 4, 2023
1 parent 1aebd12 commit abd31ca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions llpc/unittests/context/testOptLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ TEST(LlpcContextTests, MatchPipelineOptLevel) {

LgcContext::initialize();

Context *context = new Context(GfxIp);

#if LLVM_MAIN_REVISION && LLVM_MAIN_REVISION < 474768
// Old version of the code
for (auto optLevel : {Level::None, Level::Less, Level::Default, Level::Aggressive}) {
Expand All @@ -59,6 +57,9 @@ TEST(LlpcContextTests, MatchPipelineOptLevel) {
for (auto optLevel :
{CodeGenOptLevel::None, CodeGenOptLevel::Less, CodeGenOptLevel::Default, CodeGenOptLevel::Aggressive}) {
#endif

Context *context = new Context(GfxIp);

GraphicsPipelineBuildInfo pipelineInfo = {};
pipelineInfo.options.optimizationLevel = static_cast<uint32_t>(optLevel);

Expand Down Expand Up @@ -90,6 +91,9 @@ TEST(LlpcContextTests, MatchPipelineOptLevel) {
for (auto optLevel :
{CodeGenOptLevel::None, CodeGenOptLevel::Less, CodeGenOptLevel::Default, CodeGenOptLevel::Aggressive}) {
#endif

Context *context = new Context(GfxIp);

ComputePipelineBuildInfo pipelineInfo = {};
pipelineInfo.options.optimizationLevel = static_cast<uint32_t>(optLevel);

Expand Down

0 comments on commit abd31ca

Please sign in to comment.