mirror of
https://github.com/ROCm/ROCm.git
synced 2026-04-05 03:01:17 -04:00
[CI] upload only test/unit/operators cache to artifacts and rely on kernel names in cache to compare artifacts (#2111)
This commit is contained in:
26
.github/workflows/integration-tests.yml
vendored
26
.github/workflows/integration-tests.yml
vendored
@@ -92,7 +92,7 @@ jobs:
|
||||
if: ${{ env.BACKEND == 'CUDA' && env.ENABLE_TMA == '1' && env.ENABLE_MMA_V3 == '1'}}
|
||||
run: |
|
||||
cd python/test/unit
|
||||
python3 -m pytest -n 8 --ignore=runtime --ignore=language/test_line_info.py
|
||||
python3 -m pytest -n 8 --ignore=runtime --ignore=operators --ignore=language/test_line_info.py
|
||||
# run runtime tests serially to avoid race condition with cache handling.
|
||||
python3 -m pytest runtime/
|
||||
# run test_line_info.py separately with TRITON_DISABLE_LINE_INFO=0
|
||||
@@ -102,17 +102,33 @@ jobs:
|
||||
if: ${{ env.BACKEND == 'CUDA' && env.ENABLE_TMA == '0' && env.ENABLE_MMA_V3 == '0'}}
|
||||
run: |
|
||||
cd python/test/unit
|
||||
python3 -m pytest -n 8 --ignore=runtime --ignore=hopper --ignore=language/test_line_info.py
|
||||
python3 -m pytest -n 8 --ignore=runtime --ignore=hopper --ignore=operators --ignore=language/test_line_info.py
|
||||
# run runtime tests serially to avoid race condition with cache handling.
|
||||
python3 -m pytest runtime/
|
||||
# run test_line_info.py separately with TRITON_DISABLE_LINE_INFO=0
|
||||
TRITON_DISABLE_LINE_INFO=0 python3 -m pytest language/test_line_info.py
|
||||
|
||||
- name: Clear cache
|
||||
run: |
|
||||
rm -rf ~/.triton
|
||||
|
||||
- name: Run partial tests on CUDA with ENABLE_TMA=1 and ENABLE_MMA_V3=1
|
||||
if: ${{ env.BACKEND == 'CUDA' && env.ENABLE_TMA == '1' && env.ENABLE_MMA_V3 == '1'}}
|
||||
run: |
|
||||
cd python/test/unit
|
||||
python3 -m pytest -n 8 operators
|
||||
|
||||
- name: Run partial tests on CUDA with ENABLE_TMA=0 and ENABLE_MMA_V3=0
|
||||
if: ${{ env.BACKEND == 'CUDA' && env.ENABLE_TMA == '0' && env.ENABLE_MMA_V3 == '0'}}
|
||||
run: |
|
||||
cd python/test/unit
|
||||
python3 -m pytest -n 8 operators
|
||||
|
||||
- name: Create artifacts archive
|
||||
if: ${{(matrix.runner[0] == 'self-hosted') && (matrix.runner[1] == 'V100' || matrix.runner[1] == 'A100' || matrix.runner[1] == 'H100')}}
|
||||
run: |
|
||||
cd ~/.triton
|
||||
tar -czvf artifacts.tar.gz cache
|
||||
tar -czf artifacts.tar.gz cache
|
||||
|
||||
- name: Upload artifacts archive
|
||||
if: ${{(matrix.runner[0] == 'self-hosted') && (matrix.runner[1] == 'V100' || matrix.runner[1] == 'A100' || matrix.runner[1] == 'H100')}}
|
||||
@@ -140,6 +156,7 @@ jobs:
|
||||
|
||||
Integration-Tests-Third-Party:
|
||||
needs: Runner-Preparation
|
||||
if: false
|
||||
|
||||
runs-on: ${{ matrix.runner }}
|
||||
|
||||
@@ -320,7 +337,7 @@ jobs:
|
||||
- name: Compare artifacts
|
||||
run: |
|
||||
set +e
|
||||
python3 python/test/tools/compare_files.py --path1 reference --path2 current --kernels python/test/kernel_comparison/kernels.yml
|
||||
python3 python/test/tools/compare_files.py --path1 reference --path2 current
|
||||
exit_code=$?
|
||||
set -e
|
||||
echo $exit_code
|
||||
@@ -334,7 +351,6 @@ jobs:
|
||||
echo "Error while comparing artifacts"
|
||||
echo "COMPARISON_RESULT=error" >> $GITHUB_ENV
|
||||
fi
|
||||
echo "COMPARISON_RESULT=env.COMPARISON_RESULT"
|
||||
- name: Check exit code and handle failure
|
||||
if: ${{ env.COMPARISON_RESULT == 'error' }}
|
||||
run: |
|
||||
|
||||
@@ -9,9 +9,8 @@ import yaml
|
||||
|
||||
|
||||
class ComparisonResult:
|
||||
def __init__(self, name: str, extension: str, numComparisons: int, diffs: List[str] = None, errors: List[str] = None):
|
||||
def __init__(self, name: str, numComparisons: int, diffs: List[str] = None, errors: List[str] = None):
|
||||
self.name = name
|
||||
self.extension = extension
|
||||
self.numComparisons = numComparisons
|
||||
self.diffs = [] if diffs is None else diffs
|
||||
self.errors = [] if errors is None else errors
|
||||
@@ -20,7 +19,7 @@ class ComparisonResult:
|
||||
return len(self.diffs) == 0 and len(self.errors) == 0
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"name={self.name}, extension={self.extension}, numComparisons={self.numComparisons}, success={self.isSuccess()}"
|
||||
return f"name={self.name}, numComparisons={self.numComparisons}, success={self.isSuccess()}"
|
||||
|
||||
|
||||
def listFilesWithExtension(path: str, extension: str) -> List[str]:
|
||||
@@ -143,9 +142,9 @@ def doFilesMatch(path1: str, path2: str) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def compareMatchingFiles(name: str, extension: str, nameToHashes1: Dict[str, List[str]], nameToHashes2: Dict[str, List[str]], args) -> ComparisonResult:
|
||||
def compareMatchingFiles(name: str, nameToHashes1: Dict[str, List[str]], nameToHashes2: Dict[str, List[str]], args) -> ComparisonResult:
|
||||
"""
|
||||
Compare files with the given name/extension in all hashes in both paths
|
||||
Compare files with the given name in all hashes in both paths
|
||||
Return the first mismatching files as a tuple (file1, file2), otherwise, return an empty tuple
|
||||
"""
|
||||
hashes1 = nameToHashes1.get(name, [])
|
||||
@@ -164,14 +163,14 @@ def compareMatchingFiles(name: str, extension: str, nameToHashes1: Dict[str, Lis
|
||||
if not doFilesMatch(path1, path2):
|
||||
continue
|
||||
numComparisons += 1
|
||||
extFile1 = listFilesWithExtension(path1, extension)[0]
|
||||
extFile2 = listFilesWithExtension(path2, extension)[0]
|
||||
extFile1 = listFilesWithExtension(path1, "ptx")[0]
|
||||
extFile2 = listFilesWithExtension(path2, "ptx")[0]
|
||||
diff = diffFiles(extFile1, extFile2)
|
||||
if len(diff) > 0:
|
||||
diffs.append(diffFiles(extFile2, extFile1))
|
||||
if numComparisons == 0:
|
||||
errors.append(f"Did not find any matching files for {name}")
|
||||
return ComparisonResult(name=name, extension=extension, numComparisons=numComparisons, diffs=diffs, errors=errors)
|
||||
return ComparisonResult(name=name, numComparisons=numComparisons, diffs=diffs, errors=errors)
|
||||
|
||||
|
||||
def dumpResults(results: List[ComparisonResult], fileName: str):
|
||||
@@ -203,20 +202,15 @@ def main(args) -> bool:
|
||||
nameToHashes1 = getNameToHashesDict(args.path1)
|
||||
nameToHashes2 = getNameToHashesDict(args.path2)
|
||||
|
||||
yamlFilePath = args.kernels
|
||||
if not os.path.exists(yamlFilePath):
|
||||
print(f"Path {yamlFilePath} does not exist!")
|
||||
sys.exit(2)
|
||||
nameAndExtension = loadYamlFile(yamlFilePath)["name_and_extension"]
|
||||
# Get all kernels that need to be checked
|
||||
kernelNames = set(nameToHashes1.keys()).union(set(nameToHashes2.keys()))
|
||||
|
||||
results = []
|
||||
# iterate over the kernels that need to be checked
|
||||
for d in nameAndExtension:
|
||||
name = d["name"] # kernel name
|
||||
extension = d["extension"] # extension of the file to be compared (e.g. ptx)
|
||||
for name in kernelNames:
|
||||
# Compare all hashes on path 1 with all hashes on path 2
|
||||
# result is either the mismatching (file1, file2) with "extension" or empty tuple if no mismatch
|
||||
result = compareMatchingFiles(name, extension, nameToHashes1, nameToHashes2, args)
|
||||
result = compareMatchingFiles(name, nameToHashes1, nameToHashes2, args)
|
||||
print(result)
|
||||
# Otherwise, add it to the mismatches
|
||||
results.append(result)
|
||||
@@ -250,12 +244,5 @@ if __name__ == "__main__":
|
||||
required=True,
|
||||
help=("Path to second cache directory"),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--kernels",
|
||||
type=str,
|
||||
default=None,
|
||||
required=True,
|
||||
help=("Path to kernels yaml file"),
|
||||
)
|
||||
args = parser.parse_args()
|
||||
main(args)
|
||||
|
||||
Reference in New Issue
Block a user