mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-20 21:09:08 +00:00
[rocm-libraries] ROCm/rocm-libraries#7289 (commit e3fb4ee)
[CK] Fix smart build false positives from merged commits (#7289) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Motivation Current smart-build infrastructure triggers full build for almost every PR which is draining our CI infrastructure. Need to update the test selection logic based on diffs from the current workspace instead of entire repo. ## Technical Details Use three-dot syntax and scope BUILD_INFRA_PATTERN to composablekernel. Changes: - Switch from two-dot (..) to three-dot (...) in git diff - Three-dot shows only PR-specific changes - Excludes commits merged from develop (prevents false positives) - Scope BUILD_INFRA_PATTERN to projects/composablekernel/ paths only - Avoids triggering on other projects (hipblas, hipdnn, etc.) - Only composablekernel build infra changes trigger full build - Update both ci_safety_check.sh and validate_pr.sh ## Test Plan Test with PR 7112 and 7223 ## Test Result Impact: - PR 7112: Was 620 files (false positive) → Now 6 files (correct) - PR 7223: Was full build (false positive) → Now selective build (correct) ## Submission Checklist - [ x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
This commit is contained in:
committed by
assistant-librarian[bot]
parent
6cd06382b3
commit
fe2e29fa68
@@ -18,8 +18,8 @@
|
||||
# CHANGE_TARGET - Base branch for PR builds (set by Jenkins Multibranch Pipeline)
|
||||
#
|
||||
# Note: CHANGE_ID may not be set even for PR builds if Jenkins job is not
|
||||
# configured as Multibranch Pipeline. Script uses two-dot git diff syntax
|
||||
# to detect PR changes regardless of CHANGE_ID availability.
|
||||
# configured as Multibranch Pipeline. Script uses three-dot git diff syntax
|
||||
# to detect only PR-specific changes (excluding merged commits from base branch).
|
||||
#
|
||||
# Manual override (set by developer/admin if needed):
|
||||
# DISABLE_SMART_BUILD - Set to "true" to force full build
|
||||
@@ -48,25 +48,21 @@ fi
|
||||
|
||||
# 3. Force full build if CMakeLists.txt or cmake/ configuration changed
|
||||
# Always compare against base branch (not consecutive commits) to avoid false positives from merge commits
|
||||
# Two-dot syntax (..) compares current state against base branch
|
||||
# Note: This includes merged changes from develop, which is conservative but safe (catches all potentially affected files)
|
||||
CHANGED_FILES=$(git diff --name-only origin/${BASE_BRANCH}..HEAD 2>/dev/null || echo "")
|
||||
# Three-dot syntax (...) shows only changes unique to the current branch (excludes merged commits from base)
|
||||
# This prevents false positives when the PR branch has merged in commits from develop
|
||||
CHANGED_FILES=$(git diff --name-only origin/${BASE_BRANCH}...HEAD 2>/dev/null || echo "")
|
||||
|
||||
# Comprehensive pattern for build/infrastructure files that require full build:
|
||||
# - CMake: CMakeLists.txt, *.cmake, *.cmake.in, CMakePresets.json
|
||||
# - Docker: Dockerfile*, docker-compose*
|
||||
# - CI/CD: Jenkinsfile, .github/, .gitlab-ci.yml, .pre-commit-config.yaml, .readthedocs.yaml
|
||||
# - Scripts: script/ directory (cmake, dependency-parser, build utilities)
|
||||
# - Compiler: .clang-format, .clang-tidy
|
||||
# - Python: setup.py, pyproject.toml, requirements*.txt
|
||||
BUILD_INFRA_PATTERN="(CMakeLists\.txt"
|
||||
BUILD_INFRA_PATTERN="${BUILD_INFRA_PATTERN}|\.cmake$|\.cmake\.in$|CMakePresets\.json"
|
||||
BUILD_INFRA_PATTERN="${BUILD_INFRA_PATTERN}|Dockerfile|docker-compose"
|
||||
BUILD_INFRA_PATTERN="${BUILD_INFRA_PATTERN}|Jenkinsfile|\.github/|\.gitlab-ci\.yml"
|
||||
BUILD_INFRA_PATTERN="${BUILD_INFRA_PATTERN}|\.pre-commit-config\.yaml|\.readthedocs\.yaml"
|
||||
BUILD_INFRA_PATTERN="${BUILD_INFRA_PATTERN}|script/"
|
||||
BUILD_INFRA_PATTERN="${BUILD_INFRA_PATTERN}|\.clang-format|\.clang-tidy"
|
||||
BUILD_INFRA_PATTERN="${BUILD_INFRA_PATTERN}|setup\.py|pyproject\.toml|requirements.*\.txt)"
|
||||
# Scoped to composablekernel-specific paths only to avoid false positives from other projects
|
||||
# - CMake: CMakeLists.txt, *.cmake, *.cmake.in within projects/composablekernel/
|
||||
# - Scripts: Only build-critical scripts (dependency-parser, cmake utilities)
|
||||
# - Compiler: .clang-format, .clang-tidy within projects/composablekernel/
|
||||
# - Python: setup.py, pyproject.toml within projects/composablekernel/
|
||||
BUILD_INFRA_PATTERN="(projects/composablekernel/.*CMakeLists\.txt"
|
||||
BUILD_INFRA_PATTERN="${BUILD_INFRA_PATTERN}|projects/composablekernel/.*\.cmake$|projects/composablekernel/.*\.cmake\.in$"
|
||||
BUILD_INFRA_PATTERN="${BUILD_INFRA_PATTERN}|projects/composablekernel/script/dependency-parser/"
|
||||
BUILD_INFRA_PATTERN="${BUILD_INFRA_PATTERN}|projects/composablekernel/script/cmake/"
|
||||
BUILD_INFRA_PATTERN="${BUILD_INFRA_PATTERN}|projects/composablekernel/setup\.py|projects/composablekernel/pyproject\.toml)"
|
||||
|
||||
if echo "$CHANGED_FILES" | grep -qE "${BUILD_INFRA_PATTERN}"; then
|
||||
FORCE_FULL_BUILD=true
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
# Validate Smart Build vs Legacy Method for a PR
|
||||
#
|
||||
#
|
||||
# This script compares smart build and legacy dependency analysis
|
||||
# to ensure both methods produce the same test selection results.
|
||||
|
||||
@@ -189,7 +192,7 @@ git log --oneline -5
|
||||
|
||||
log_section "Step 3: Analyze Changed Files"
|
||||
log_info "Files changed vs $BASE_BRANCH:"
|
||||
CHANGED_FILES=$(git diff --name-only ${BASE_BRANCH}..HEAD -- projects/composablekernel)
|
||||
CHANGED_FILES=$(git diff --name-only ${BASE_BRANCH}...HEAD -- projects/composablekernel)
|
||||
NUM_FILES=$(echo "$CHANGED_FILES" | wc -l)
|
||||
echo "$CHANGED_FILES" | head -20
|
||||
if [ "$NUM_FILES" -gt 20 ]; then
|
||||
|
||||
Reference in New Issue
Block a user