From 0fced47ce89eaaf1d6fdf27ddfc4636054276cfb Mon Sep 17 00:00:00 2001 From: "Qiaojin.Bao" Date: Tue, 10 Sep 2024 10:59:57 +0800 Subject: [PATCH 1/4] Update check-cppcheck-llpc.yml to ubuntu 22.04 --- .github/workflows/check-cppcheck-llpc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-cppcheck-llpc.yml b/.github/workflows/check-cppcheck-llpc.yml index 1f65dfbfd0..83f596eb37 100644 --- a/.github/workflows/check-cppcheck-llpc.yml +++ b/.github/workflows/check-cppcheck-llpc.yml @@ -6,7 +6,7 @@ on: jobs: cppcheck: name: cppcheck - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-22.04" steps: - name: Setup environment run: | From 1873e38adc1c94a831203e608b6f137264c12f8e Mon Sep 17 00:00:00 2001 From: qiaojbao Date: Fri, 20 Dec 2024 16:04:38 +0800 Subject: [PATCH 2/4] Fix static check error on ubuntu22.04 --- lgc/builder/MatrixBuilder.cpp | 4 ++-- lgc/patch/LowerInvariantLoads.cpp | 2 +- llpc/context/llpcCompiler.cpp | 11 +++++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lgc/builder/MatrixBuilder.cpp b/lgc/builder/MatrixBuilder.cpp index 742f3ec9ea..555bbc0063 100644 --- a/lgc/builder/MatrixBuilder.cpp +++ b/lgc/builder/MatrixBuilder.cpp @@ -151,8 +151,8 @@ Value *BuilderImpl::CreateMatrixTimesVector(Value *const matrix, Value *const ve else result = partialResult; } - - result->setName(instName); + if (result) + result->setName(instName); return result; } diff --git a/lgc/patch/LowerInvariantLoads.cpp b/lgc/patch/LowerInvariantLoads.cpp index e8dfe23a4d..4ab3f3c05d 100644 --- a/lgc/patch/LowerInvariantLoads.cpp +++ b/lgc/patch/LowerInvariantLoads.cpp @@ -117,7 +117,7 @@ PreservedAnalyses LowerInvariantLoads::run(Function &function, FunctionAnalysisM LLVM_DEBUG(dbgs() << (clearInvariants ? "Removing invariant load flags" : "Attempting aggressive invariant load optimization") - << "\n";); + << "\n"); // This mirrors AMDGPUAliasAnalysis static const unsigned aliasMatrix[] = { diff --git a/llpc/context/llpcCompiler.cpp b/llpc/context/llpcCompiler.cpp index 8371aef8b7..a5811eee0f 100644 --- a/llpc/context/llpcCompiler.cpp +++ b/llpc/context/llpcCompiler.cpp @@ -2459,9 +2459,10 @@ Result Compiler::BuildGraphicsPipeline(const GraphicsPipelineBuildInfo *pipeline if (!cacheAccessor || !cacheAccessor->isInCache()) { LLPC_OUTS("Cache miss for graphics pipeline.\n"); - GraphicsContext graphicsContext(m_gfxIp, m_apiName, pipelineInfo, &pipelineHash, &cacheHash); - result = buildGraphicsPipelineInternal(&graphicsContext, shaderInfo, buildUsingRelocatableElf, &candidateElf, + GraphicsContext *graphicsContext = new GraphicsContext(m_gfxIp, m_apiName, pipelineInfo, &pipelineHash, &cacheHash); + result = buildGraphicsPipelineInternal(graphicsContext, shaderInfo, buildUsingRelocatableElf, &candidateElf, pipelineOut->stageCacheAccesses); + delete graphicsContext; if (result == Result::Success) { elfBin.codeSize = candidateElf.size(); @@ -2588,9 +2589,11 @@ Result Compiler::BuildComputePipeline(const ComputePipelineBuildInfo *pipelineIn ElfPackage candidateElf; if (!cacheAccessor || !cacheAccessor->isInCache()) { LLPC_OUTS("Cache miss for compute pipeline.\n"); - ComputeContext computeContext(m_gfxIp, m_apiName, pipelineInfo, &pipelineHash, &cacheHash); - result = buildComputePipelineInternal(&computeContext, pipelineInfo, buildUsingRelocatableElf, &candidateElf, + ComputeContext *computeContext = + new ComputeContext(m_gfxIp, m_apiName, pipelineInfo, &pipelineHash, &cacheHash); + result = buildComputePipelineInternal(computeContext, pipelineInfo, buildUsingRelocatableElf, &candidateElf, &pipelineOut->stageCacheAccess); + delete computeContext; if (cacheAccessor && pipelineOut->pipelineCacheAccess == CacheAccessInfo::CacheNotChecked) pipelineOut->pipelineCacheAccess = CacheAccessInfo::CacheMiss; From af5d72a2801615a122d7a7abc46232de52460a8f Mon Sep 17 00:00:00 2001 From: qiaojbao Date: Fri, 20 Dec 2024 16:18:17 +0800 Subject: [PATCH 3/4] Update check-cppcheck-llpc.yml --- .github/workflows/check-cppcheck-llpc.yml | 4 ++-- llpc/context/llpcCompiler.cpp | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-cppcheck-llpc.yml b/.github/workflows/check-cppcheck-llpc.yml index 83f596eb37..1a9baca9b6 100644 --- a/.github/workflows/check-cppcheck-llpc.yml +++ b/.github/workflows/check-cppcheck-llpc.yml @@ -19,5 +19,5 @@ jobs: git submodule update --init - name: Run cppcheck run: | - cppcheck -q -j$(( $(nproc) * 4 )) --error-exitcode=1 --std=c++17 --inline-suppr . -i llpc/tool/amdllpc.cpp \ - -I imported/llvm-dialects/include + cppcheck -q -j$(( $(nproc) * 4 )) --error-exitcode=1 --std=c++17 --inline-suppr . \ + -I imported/llvm-dialects/include -i imported -i llpc/unittests -i llvmraytracing diff --git a/llpc/context/llpcCompiler.cpp b/llpc/context/llpcCompiler.cpp index a5811eee0f..1dbe40065f 100644 --- a/llpc/context/llpcCompiler.cpp +++ b/llpc/context/llpcCompiler.cpp @@ -2589,8 +2589,7 @@ Result Compiler::BuildComputePipeline(const ComputePipelineBuildInfo *pipelineIn ElfPackage candidateElf; if (!cacheAccessor || !cacheAccessor->isInCache()) { LLPC_OUTS("Cache miss for compute pipeline.\n"); - ComputeContext *computeContext = - new ComputeContext(m_gfxIp, m_apiName, pipelineInfo, &pipelineHash, &cacheHash); + ComputeContext *computeContext = new ComputeContext(m_gfxIp, m_apiName, pipelineInfo, &pipelineHash, &cacheHash); result = buildComputePipelineInternal(computeContext, pipelineInfo, buildUsingRelocatableElf, &candidateElf, &pipelineOut->stageCacheAccess); delete computeContext; From ad1eb5b41127ef5a77009f0a633f8ca5a0485b7f Mon Sep 17 00:00:00 2001 From: qiaojbao Date: Fri, 20 Dec 2024 16:32:13 +0800 Subject: [PATCH 4/4] Update check-cppcheck-llpc.yml to 24.04 --- .github/workflows/check-cppcheck-llpc.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-cppcheck-llpc.yml b/.github/workflows/check-cppcheck-llpc.yml index 1a9baca9b6..59c0403f06 100644 --- a/.github/workflows/check-cppcheck-llpc.yml +++ b/.github/workflows/check-cppcheck-llpc.yml @@ -6,7 +6,7 @@ on: jobs: cppcheck: name: cppcheck - runs-on: "ubuntu-22.04" + runs-on: "ubuntu-24.04" steps: - name: Setup environment run: | @@ -19,5 +19,5 @@ jobs: git submodule update --init - name: Run cppcheck run: | - cppcheck -q -j$(( $(nproc) * 4 )) --error-exitcode=1 --std=c++17 --inline-suppr . \ + cppcheck -q -j$(( $(nproc) * 4 )) --error-exitcode=1 --std=c++20 --inline-suppr . \ -I imported/llvm-dialects/include -i imported -i llpc/unittests -i llvmraytracing