Skip to content

Commit fd4891b

Browse files
authored
[CI] Add test name option to the simt e2e tests script (#1155)
1 parent e17e8fc commit fd4891b

File tree

2 files changed

+92
-30
lines changed

2 files changed

+92
-30
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,12 @@ cmake --build build --target check-imex
138138
If you want to make sure changes you're going to merge in the upstream LLVM don't break XeGPU testing you can run
139139

140140
```sh
141-
./scripts/run_xegpu_integration_tests.sh path_to_build_dir_of_your_llvm_repo
141+
./scripts/run_xegpu_simt_integration_tests.sh path_to_build_dir_of_your_llvm_repo
142142
```
143143

144144
that will launch integration tests from Integration/Dialect/XeGPU/[SG, WG, SIMT] and Integration/Dialect/XeVM.
145145
Make sure you have Intel GPU availaible to get tests running.
146+
You can also run specific tests using option --test <pattern>.
146147

147148
### Building docs
148149
To build user documentation do

scripts/run_xegpu_integration_tests.sh renamed to scripts/run_xegpu_simt_integration_tests.sh

Lines changed: 90 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,58 @@ print_section() {
3333
echo -e "${GREEN}========================================${NC}\n"
3434
}
3535

36+
# Function to print usage
37+
print_usage() {
38+
print_error "Usage: $0 [options] <llvm-project-path> [imex-project-path]"
39+
echo ""
40+
echo "Arguments:"
41+
echo " <llvm-project-path> Path to llvm-project repository or pre-built installation"
42+
echo " [imex-project-path] Optional path to IMEX repository"
43+
echo " (default: current directory if it's IMEX root, or parent of script directory)"
44+
echo ""
45+
echo "Options:"
46+
echo " -t, --test <pattern> Test name pattern (regex) to pass to LIT --filter"
47+
echo " Example: -t 'load_nd.*f16' or -t 'transpose'"
48+
echo " -h, --help Show this help message"
49+
echo ""
50+
echo "Examples:"
51+
echo " $0 /path/to/llvm-project"
52+
echo " $0 -t 'load_nd.*f16' /path/to/llvm-project"
53+
echo " $0 --test 'transpose' /path/to/llvm-project /path/to/imex"
54+
}
55+
56+
# Parse command-line options
57+
TEST_NAME_FILTER=""
58+
POSITIONAL_ARGS=()
59+
60+
while [[ $# -gt 0 ]]; do
61+
case $1 in
62+
-t|--test)
63+
TEST_NAME_FILTER="$2"
64+
shift 2
65+
;;
66+
-h|--help)
67+
print_usage
68+
exit 0
69+
;;
70+
-*)
71+
print_error "Unknown option: $1"
72+
print_usage
73+
exit 1
74+
;;
75+
*)
76+
POSITIONAL_ARGS+=("$1")
77+
shift
78+
;;
79+
esac
80+
done
81+
82+
# Restore positional parameters
83+
set -- "${POSITIONAL_ARGS[@]}"
84+
3685
# Check if correct number of arguments provided
3786
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
38-
print_error "Usage: $0 <llvm-project-path> [imex-project-path]"
39-
print_error " <llvm-project-path>: Path to llvm-project repository"
40-
print_error " [imex-project-path]: Optional path to IMEX repository"
41-
print_error " (default: current directory if it's IMEX root, or parent of script directory)"
87+
print_usage
4288
exit 1
4389
fi
4490

@@ -213,10 +259,17 @@ if [ "$USE_PREBUILT_LLVM" = false ]; then
213259
print_info "Enabling: MLIR_INCLUDE_INTEGRATION_TESTS, MLIR_ENABLE_LEVELZERO_RUNNER, MLIR_ENABLE_SYCL_RUNNER, IMEX_ENABLE_L0_RUNTIME"
214260
print_info "Disabling: IMEX_BUILD_VC_CONVERSIONS (ArithToVC, MathToVC, XeGPUToVC)"
215261
print_info "Disabling: IMEX_ENABLE_XEGPU_LAYOUT_PASSES (MaterializeMatrixOp, OptimizeTranspose)"
216-
print_info "Setting LLVM_LIT_ARGS to filter XeGPU integration tests from IMEX"
217262

218263
# Build lit filter pattern for the specific test directories
219-
LIT_FILTER="Integration/Dialect/XeGPU/SG|Integration/Dialect/XeGPU/WG|Integration/Dialect/XeGPU/SIMT|Integration/Dialect/XeVM"
264+
if [ -n "$TEST_NAME_FILTER" ]; then
265+
# User provided a specific test filter
266+
LIT_FILTER="$TEST_NAME_FILTER"
267+
print_info "Using custom test filter: $LIT_FILTER"
268+
else
269+
# Default: all XeGPU integration test directories
270+
LIT_FILTER="Integration/Dialect/XeGPU/SG|Integration/Dialect/XeGPU/WG|Integration/Dialect/XeGPU/SIMT|Integration/Dialect/XeVM"
271+
print_info "Using default test filter for XeGPU integration tests"
272+
fi
220273

221274
cmake -S llvm -B "$BUILD_DIR" -G Ninja \
222275
-DCMAKE_BUILD_TYPE=Release \
@@ -241,12 +294,24 @@ else
241294
print_info "Disabling: IMEX_BUILD_VC_CONVERSIONS (ArithToVC, MathToVC, XeGPUToVC)"
242295
print_info "Disabling: IMEX_ENABLE_XEGPU_LAYOUT_PASSES (MaterializeMatrixOp, OptimizeTranspose)"
243296

297+
# Build lit filter pattern
298+
if [ -n "$TEST_NAME_FILTER" ]; then
299+
# User provided a specific test filter
300+
LIT_FILTER="$TEST_NAME_FILTER"
301+
print_info "Using custom test filter: $LIT_FILTER"
302+
LLVM_LIT_ARGS_OPTION="-DLLVM_LIT_ARGS=-v --filter='$LIT_FILTER'"
303+
else
304+
# No filter for out-of-tree build by default
305+
LLVM_LIT_ARGS_OPTION=""
306+
fi
307+
244308
cmake -S . -B "$BUILD_DIR" -G Ninja \
245309
-DCMAKE_BUILD_TYPE=Release \
246310
-DMLIR_DIR="$MLIR_CMAKE_DIR" \
247311
-DIMEX_ENABLE_L0_RUNTIME=1 \
248312
-DIMEX_BUILD_VC_CONVERSIONS=OFF \
249-
-DIMEX_ENABLE_XEGPU_LAYOUT_PASSES=OFF
313+
-DIMEX_ENABLE_XEGPU_LAYOUT_PASSES=OFF \
314+
$LLVM_LIT_ARGS_OPTION
250315
fi
251316

252317
if [ $? -eq 0 ]; then
@@ -283,12 +348,16 @@ fi
283348
print_section "Running IMEX XeGPU Integration Tests"
284349

285350
if [ "$USE_PREBUILT_LLVM" = false ]; then
286-
print_info "Running check-imex target with filtered XeGPU integration tests"
287-
print_info "Test directories:"
288-
print_info " - Integration/Dialect/XeGPU/SG"
289-
print_info " - Integration/Dialect/XeGPU/WG"
290-
print_info " - Integration/Dialect/XeGPU/SIMT"
291-
print_info " - Integration/Dialect/XeVM"
351+
print_info "Running check-imex target with filtered tests"
352+
if [ -n "$TEST_NAME_FILTER" ]; then
353+
print_info "Test filter: $TEST_NAME_FILTER"
354+
else
355+
print_info "Test directories:"
356+
print_info " - Integration/Dialect/XeGPU/SG"
357+
print_info " - Integration/Dialect/XeGPU/WG"
358+
print_info " - Integration/Dialect/XeGPU/SIMT"
359+
print_info " - Integration/Dialect/XeVM"
360+
fi
292361
echo ""
293362

294363
# Run tests and capture exit code, but don't stop on failure
@@ -298,6 +367,9 @@ if [ "$USE_PREBUILT_LLVM" = false ]; then
298367
set -e
299368
else
300369
print_info "Running check-imex target for out-of-tree build"
370+
if [ -n "$TEST_NAME_FILTER" ]; then
371+
print_info "Test filter: $TEST_NAME_FILTER"
372+
fi
301373
echo ""
302374

303375
# Run tests and capture exit code, but don't stop on failure
@@ -314,22 +386,6 @@ else
314386
print_info "Continuing to cleanup section..."
315387
fi
316388

317-
# Ask user about reverting llvm_version.txt
318-
print_section "Cleanup"
319-
320-
echo ""
321-
read -p "Do you want to revert llvm_version.txt in IMEX project? (y/n): " -n 1 -r
322-
echo ""
323-
324-
if [[ $REPLY =~ ^[Yy]$ ]]; then
325-
cd "$IMEX_PROJECT_PATH"
326-
print_info "Reverting llvm_version.txt..."
327-
echo "$OLD_LLVM_SHA" > "$LLVM_VERSION_FILE"
328-
print_success "Reverted llvm_version.txt to: $OLD_LLVM_SHA"
329-
else
330-
print_info "Keeping updated llvm_version.txt: $LLVM_HEAD_SHA"
331-
fi
332-
333389
# Final summary
334390
print_section "Summary"
335391
echo -e "${GREEN}LLVM Project:${NC} $LLVM_PROJECT_PATH"
@@ -351,6 +407,11 @@ else
351407
fi
352408
echo -e "${GREEN}VC Conversions:${NC} Disabled (IMEX_BUILD_VC_CONVERSIONS=OFF)"
353409
echo -e "${GREEN}XeGPU Layout Passes:${NC} Disabled (IMEX_ENABLE_XEGPU_LAYOUT_PASSES=OFF)"
410+
if [ -n "$TEST_NAME_FILTER" ]; then
411+
echo -e "${GREEN}Test Filter:${NC} $TEST_NAME_FILTER"
412+
else
413+
echo -e "${GREEN}Test Filter:${NC} Default (all XeGPU integration tests)"
414+
fi
354415
echo -e "${GREEN}Test Exit Code:${NC} $TEST_EXIT_CODE"
355416

356417
print_success "Script completed successfully!"

0 commit comments

Comments
 (0)