@@ -50,31 +50,61 @@ TEST(LlpcContextTests, MatchPipelineOptLevel) {
50
50
51
51
Context *context = new Context (GfxIp);
52
52
53
+ #if LLVM_MAIN_REVISION && LLVM_MAIN_REVISION < 474768
54
+ // Old version of the code
53
55
for (auto optLevel : {Level::None, Level::Less, Level::Default, Level::Aggressive}) {
56
+ #else
57
+ // New version of the code (also handles unknown version, which we treat as latest)
58
+ // Returns the optimization level for the context.
59
+ for (auto optLevel :
60
+ {CodeGenOptLevel::None, CodeGenOptLevel::Less, CodeGenOptLevel::Default, CodeGenOptLevel::Aggressive}) {
61
+ #endif
54
62
GraphicsPipelineBuildInfo pipelineInfo = {};
55
- pipelineInfo.options .optimizationLevel = optLevel;
63
+ pipelineInfo.options .optimizationLevel = static_cast < uint32_t >( optLevel) ;
56
64
57
65
GraphicsContext graphicsContext (GfxIp, &pipelineInfo, &pipelineHash, &cacheHash);
58
66
59
67
context->attachPipelineContext (&graphicsContext);
60
68
69
+ #if LLVM_MAIN_REVISION && LLVM_MAIN_REVISION < 474768
70
+ // Old version of the code
61
71
if (optLevel == Level::None) {
72
+ #else
73
+ // New version of the code (also handles unknown version, which we treat as latest)
74
+ // Returns the optimization level for the context.
75
+ if (optLevel == CodeGenOptLevel::None) {
76
+ #endif
62
77
// None might not be possible, so accept >= Level::None
63
78
EXPECT_GE (context->getLgcContext ()->getOptimizationLevel (), optLevel);
64
79
} else {
65
80
EXPECT_EQ (context->getLgcContext ()->getOptimizationLevel (), optLevel);
66
81
}
67
82
}
68
83
84
+ #if LLVM_MAIN_REVISION && LLVM_MAIN_REVISION < 474768
85
+ // Old version of the code
69
86
for (auto optLevel : {Level::None, Level::Less, Level::Default, Level::Aggressive}) {
87
+ #else
88
+ // New version of the code (also handles unknown version, which we treat as latest)
89
+ // Returns the optimization level for the context.
90
+ for (auto optLevel :
91
+ {CodeGenOptLevel::None, CodeGenOptLevel::Less, CodeGenOptLevel::Default, CodeGenOptLevel::Aggressive}) {
92
+ #endif
70
93
ComputePipelineBuildInfo pipelineInfo = {};
71
- pipelineInfo.options .optimizationLevel = optLevel;
94
+ pipelineInfo.options .optimizationLevel = static_cast < uint32_t >( optLevel) ;
72
95
73
96
ComputeContext computeContext (GfxIp, &pipelineInfo, &pipelineHash, &cacheHash);
74
97
75
98
context->attachPipelineContext (&computeContext);
76
99
100
+ #if LLVM_MAIN_REVISION && LLVM_MAIN_REVISION < 474768
101
+ // Old version of the code
77
102
if (optLevel == Level::None) {
103
+ #else
104
+ // New version of the code (also handles unknown version, which we treat as latest)
105
+ // Returns the optimization level for the context.
106
+ if (optLevel == CodeGenOptLevel::None) {
107
+ #endif
78
108
// None might not be possible, so accept >= Level::None
79
109
EXPECT_GE (context->getLgcContext ()->getOptimizationLevel (), optLevel);
80
110
} else {
0 commit comments