Skip to content

Commit b1387ce

Browse files
author
Nikku, Deepika
authored
AOCL LAPACK Testsuite: Added YAML files for all the available APIs (#219)
AOCL LAPACK Test-suite: Added YAML files for all the available APIs Added new yaml files for all the existing APIs in main test for generating API wise ctests
1 parent b2e2657 commit b1387ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+3929
-315
lines changed

test/main/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
###############################################################################
2-
# Copyright (C) 2022-2025, Advanced Micro Devices, Inc. All rights reserved.
2+
# Copyright (C) 2022-2026, Advanced Micro Devices, Inc. All rights reserved.
33
###############################################################################
44
if(WIN32)
55
project(test_libFLAME_main)
@@ -179,7 +179,6 @@ if(BUILD_TEST)
179179
message(WARNING "Test generation failed: ${GEN_ERROR}")
180180
else()
181181
message(STATUS "Generated API validation tests in ${TEST_OUTPUT_DIR}")
182-
message(STATUS "Test generation output:\n${GEN_OUTPUT}")
183182
endif()
184183
# Include generated test files from build directory
185184
file(GLOB YAML_TEST_FILES "${TEST_OUTPUT_DIR}/*_tests.cmake")
@@ -188,7 +187,6 @@ if(BUILD_TEST)
188187
get_filename_component(API_NAME ${TEST_FILE} NAME_WE)
189188
string(REPLACE "_tests" "" API_NAME ${API_NAME})
190189
include(${TEST_FILE})
191-
message(STATUS "Included API validation tests for ${API_NAME}")
192190
endforeach()
193191
else()
194192
message(WARNING "No API validation test files generated")

test/main/ReadMe.txt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ After `make` is complete, an executable named `test_lapack.x` is created.
5252
There are different ways to use the executable to perform different tests as given
5353
below.
5454

55+
NOTE: PyYAML is required for YAML parsing and YAML‑based test generation.
56+
5557
1. Config file based tests
5658

5759
In this method, input parameters to APIs are taken from config files present in
@@ -491,16 +493,21 @@ NOTE:
491493
Tests are automatically generated during CMake configuration when BUILD_TEST=ON.
492494
Generated files are in <build_dir>/test/main/validation_ctests/*_tests.cmake
493495

496+
Dependency:
497+
YAML‑based CTest generation depends on the PyYAML package for YAML parsing.
498+
Ensure that PyYAML is installed on your system.
499+
494500
For manual generation:
495501
$ cd test/main/validation_ctests
496502
$ python3 auto_generate_tests.py --api getrf /tmp/output
497503
$ python3 auto_generate_tests.py --all /tmp/output
498504

499505
Running tests:
500506
# Filter by label (case-insensitive for API name and group)
501-
$ ctest -L GETRF # Run all getrf tests
502-
$ ctest -L short # Run all tests with small or medium size
503-
$ ctest -L GETRF -L small # Run small GETRF tests (use multiple -L flags)
504-
$ ctest -L precision_d # Run all double precision tests
507+
$ ctest -L yaml_generated # Run all the ctests generated from yaml files
508+
$ ctest -L GETRF # Run all getrf tests
509+
$ ctest -L medium # Run all tests with small_size or medium_size (medium group)
510+
$ ctest -L precision_d # Run all double precision tests
511+
$ ctest -L getrf -R medium # Run all GETRF medium size tests
505512

506-
NOTE: For detailed documentation, see test/main/validation_ctests/README.md
513+
NOTE: For detailed documentation, see test/main/validation_ctests/ReadMe.txt
Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (C) 2026, Advanced Micro Devices, Inc. All rights reserved.
2+
13
##########################################################################################
24
Validation CTests - YAML-Based Test Generation
35
##########################################################################################
@@ -10,7 +12,7 @@ to define test cases in YAML format, which are then automatically converted to C
1012
test files during the build process.
1113

1214
The validation_ctests directory has the following contents:
13-
1. README.md - This file
15+
1. ReadMe.txt - This file
1416
2. auto_generate_tests.py - Python script that generates CMake test files from YAML
1517
3. auto_generate_label_groups.yaml - Global label group definitions and size threshold configuration
1618
4. <API>.yaml - Test definitions for each API. Each API has its own YAML file.
@@ -26,6 +28,11 @@ The test generation workflow follows this pattern:
2628
3. CMake Integration: Tests are generated at configure time in the build directory
2729
4. CTest Execution: Generated tests are executed via CMake's CTest framework
2830

31+
## Dependency
32+
33+
YAML‑based CTest generation depends on the PyYAML package for YAML parsing.
34+
Ensure that PyYAML is installed on your system.
35+
2936
## YAML File Format
3037

3138
Each API has its own YAML file (e.g., getrf.yaml, syev.yaml). The structure follows
@@ -62,8 +69,8 @@ Filter tests:
6269
$ ctest -L getrf # Lowercase also works (both cases supported)
6370

6471
# Multiple labels (use multiple -L flags, not semicolon)
65-
$ ctest -L GETRF -L small # Tests with both GETRF and small labels
66-
$ ctest -L avx2 -L precision_d # AVX2 tests with double precision
72+
$ ctest -L GETRF -L small_size # Tests with both GETRF and small_size labels
73+
$ ctest -L LIN -L precision_d # LIN tests with double precision
6774

6875
### Label Groups
6976

@@ -72,36 +79,30 @@ all API files. This avoids manually adding multiple labels to each test.
7279

7380
Example in auto_generate_label_groups.yaml:
7481
label_groups:
75-
postsubmit: [avx2, avx512]
82+
postsubmit: [small_size, medium_size, large_size]
7683

7784
When any test uses the "postsubmit" label, it automatically includes both "postsubmit"
78-
and its constituent labels (avx2, avx512). This allows managing labels centrally for
85+
and its constituent labels (small_size, medium_size, large_size). This allows managing labels centrally for
7986
multiple API files without editing each file individually. API-specific label_groups can
8087
override global groups if needed.
8188

8289
### Automatic Size-Based Labeling
8390

84-
Tests are automatically assigned size labels (small, medium, large) based on parameter
91+
Tests are automatically assigned size labels (small_size, medium_size, large_size) based on parameter
8592
values defined in auto_generate_label_groups.yaml. Group labels (e.g., "short") are then automatically
8693
assigned to tests matching certain size criteria.
8794

8895
Configuration in auto_generate_label_groups.yaml:
8996
size_thresholds:
9097
parameter: max # Check 'n', 'm', or 'max' (max of m and n)
9198
small: 16 # n < 16 or max(m,n) < 16
92-
medium: 100 # 16 <= n < 100 or 16 <= max(m,n) < 100
93-
# large is automatically assigned if >= medium threshold
99+
medium: 256 # 16 <= n < 256 or 16 <= max(m,n) < 256
100+
# large_size is automatically assigned if >= medium threshold
94101

95102
auto_assign_groups:
96-
short: [small, medium] # Automatically add "short" label to tests with small or medium size
103+
short: [small_size] # Automatically add "short" label to tests with small_size
97104

98-
Benefits:
99-
- Zero manual edits: Tests automatically get size and group labels based on parameters
100-
- Centralized configuration: All thresholds in auto_generate_label_groups.yaml
101-
- Works across all API files automatically
102-
- Flexible: Can define different thresholds for different parameters
103-
104-
Example: A test with m=16, n=16 automatically gets "medium" and "short" labels without
105+
Example: A test with m=16, n=16 automatically gets "medium_size" and "short" labels without
105106
any manual editing in the API YAML file.
106107

107108

@@ -116,7 +117,7 @@ To add tests for a new API, follow these steps:
116117
Check test/main/src/test_<api>.c to determine the correct parameter order.
117118

118119
3. Define Test Paths
119-
Add test cases covering different code paths: single element, small/large sizes,
120+
Add test cases covering different code paths: single element, small_size/large_size sizes,
120121
architecture-specific optimizations (AVX2, AVX512), and edge cases.
121122

122123
4. Verify Generation
@@ -148,10 +149,13 @@ For manual generation:
148149
$ python3 auto_generate_tests.py --all /tmp/output
149150

150151
Run tests:
152+
# Run all the tests generated from yaml files
153+
$ ctest -L yaml_generated
154+
151155
# Filter by label (case-insensitive for API name and group)
152156
$ ctest -L GETRF # Matches tests with GETRF label
153157
$ ctest -L getrf # Also matches (both cases supported)
154-
$ ctest -L GETRF -L small # Multiple labels (use multiple -L flags)
158+
$ ctest -L GETRF -L small_size # Multiple labels (use multiple -L flags)
155159
$ ctest -L avx2 # Architecture-specific tests
156160

157161
# Filter by test name regex (uppercase API name)
@@ -161,7 +165,7 @@ Run tests:
161165
# Combined filtering
162166
$ ctest -L GETRF -R ".*kernel.*" # GETRF tests with "kernel" in name
163167

164-
## Example
168+
## Example of generated ctests
165169

166170
Generated CMake test files are in
167171
<build_dir>/test/main/validation_ctests/getrf_tests.cmake after configuration.
@@ -170,4 +174,4 @@ Generated CMake test files are in
170174

171175
The test generation is integrated into the CMake build system via test/main/CMakeLists.txt.
172176
Tests are generated at configure time in the build directory and are not committed to
173-
the source tree.
177+
the source tree.
Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
1+
# Copyright (C) 2025-2026, Advanced Micro Devices, Inc. All rights reserved.
2+
13
# Global Label Groups Configuration
4+
25
# Define label groups here that can be used across all API YAML files
36
# When a test uses a group label (e.g., "postsubmit"), it automatically includes
4-
# all labels defined in the group (e.g., [avx2, avx512])
7+
# all labels defined in the group.
58

69
label_groups:
7-
# Example: postsubmit group includes architecture-specific optimization labels
8-
postsubmit: []
10+
presubmit: [small_size, medium_size]
11+
postsubmit: [small_size, medium_size, large_size]
912

10-
# Size threshold definitions for automatic labeling
11-
# Tests are automatically assigned size labels (small, medium, large) based on
13+
# Size threshold definitions for automatic labeling:
14+
# Tests are automatically assigned size labels (small_size, medium_size, large_size) based on
1215
# parameter values. The parameter to check is specified below.
16+
1317
size_thresholds:
1418
# Parameter to check: 'n', 'm', or 'max' (checks max of m and n)
1519
parameter: max
20+
1621
# Threshold definitions: value < threshold
17-
small: 16 # n < 16 or m < 16 or max(m,n) < 16
18-
medium: 100 # 16 <= n < 100 or 16 <= m < 100 or 16 <= max(m,n) < 100
19-
# large is automatically assigned if >= medium threshold
22+
small: 16 # n < 16 or m < 16 or max(m,n) < 16
23+
medium: 256 # 16 <= n < 256 or 16 <= m < 256 or 16 <= max(m,n) < 256
24+
# large_size is automatically assigned if >= medium threshold
2025

21-
# Auto-assign group labels based on size labels
26+
# Auto-assign group labels based on size labels:
2227
# Group labels are automatically added to tests that have matching size labels
2328
auto_assign_groups:
24-
short: [small, medium] # Automatically add "short" label to tests with small or medium size
25-
29+
short: [small_size] # Automatically add "short" label to tests with small_size
30+
medium: [small_size, medium_size] # Automatically add "medium" label to tests with small_size or medium_size
31+
long: [small_size, medium_size, large_size] # Automatically add "long" label to all the tests

0 commit comments

Comments
 (0)