8.4.1. Using Test Suite - 5.2 English - 57404

AOCL User Guide (57404)

Document ID
57404
Release Date
2025-12-29
Version
5.2 English

Building Tests:

To build the test suite:

# Clone and navigate to repository
git clone https://github.com/amd/aocl-dlp.git
cd aocl-dlp

# Create build directory
mkdir build && cd build

# Configure build with tests enabled
cmake -DBUILD_TESTING=ON -DDLP_TESTING_CTEST_DISABLED=OFF ..

# Build tests
make -j$(nproc)

Note: CTest is disabled by default in AOCL-DLP. The -DDLP_TESTING_CTEST_DISABLED=OFF flag is required to enable test execution.

Running Tests:

Using CTest (Recommended):

# Run all tests with failure output
ctest --output-on-failure

# Run specific test pattern
ctest -R "yaml_0" --output-on-failure

Direct Test Binary Execution:

# Run with default configuration
./build/tests/classic/test_gemm

# Run with specific YAML configuration
./build/tests/classic/test_gemm -f tests/classic/configs/gemm_test_config.yaml

# Run with verbose output
./build/tests/classic/test_gemm --verbose --gtest_color=yes

Test Configuration with YAML:

AOCL-DLP tests use YAML configuration files to specify test parameters. Here’s a basic example:

gemm_tests:
  - name: "f32_small"
    a_type: ["f32"]
    b_type: ["f32"]
    c_type: ["f32"]
    acc_type: ["f32"]
    storage_format: ["row-major"]
    transA: [false, true]
    transB: [false, true]
    m:
      lb: 10
      ub: 20
      step: 5
    n: 10
    k: 10
    alpha: [2.5, 0, -2.5]
    beta: [2.5, 0, -2.5]
    mtagA: ["none", "pack"]
    mtagB: ["reorder", "pack", "none"]
    tolerances:
      float: 1.0e-5
      bfloat16: 1.0e-2
      int8: 0

YAML Parameters:

  • name: Unique identifier for the test case

  • a_type, b_type, c_type, acc_type: Data types for matrices and accumulator

  • storage_format: “row-major” or “column-major”

  • transA, transB: Transpose flags (true/false)

  • m, n, k: Matrix dimensions (supports multiple input methods)

  • alpha, beta: GEMM scalars

  • mtagA, mtagB: Matrix optimization tags (“none”, “pack”, “reorder”)

  • tolerances: Acceptable error tolerances for different data types

Parameter Input Methods:

AOCL-DLP testing supports three flexible methods for specifying parameter values:

  1. Direct Value Method (Single Value):

# Simple single value assignment
m: 128
n: 64
k: 256
alpha: 1.0
beta: 0.0
  1. Range Method (Lower Bound, Upper Bound, Step):

# Generate values from lb to ub with step increment
m:
  lb: 16    # Lower bound (inclusive)
  ub: 64    # Upper bound (inclusive)
  step: 16  # Step size (16, 32, 48, 64)
n:
  lb: 8
  ub: 32
  step: 8   # Generates: 8, 16, 24, 32
k:
  lb: 100
  ub: 100
  step: -1  # Special case: step=-1 means single value (100)
  1. List Method (Explicit Value List):

# Specify exact values to test
m: [16, 32, 64, 128, 256]
n: [8, 16, 32]
k: [64, 128]
alpha: [0.0, 1.0, 2.5, -1.0]
beta: [0.0, 0.5, 1.0]

Test Command Line Options:

Table 8.2 DLP-Specific Options#

Option

Description

Example

-f, –file <path>

Specify YAML configuration file

-f tests/classic/configs/gemm_test_config.yaml

-h, –help

Show help message

–help

–verbose

Enable verbose output

–verbose

Table 8.3 Google Test Options#

Category

Option

Description

Example

Test Selection

–gtest_list_tests

List all tests

–gtest_list_tests

–gtest_filter

Run tests matching pattern

–gtest_filter=”yaml_0

Test Execution

–gtest_repeat

Run tests repeatedly

–gtest_repeat=5

–gtest_shuffle

Randomize test order

–gtest_shuffle

Test Output

–gtest_color

Enable colored output

–gtest_color=yes

–gtest_output

Generate XML/JSON report

–gtest_output=xml:results.xml

For comprehensive examples and advanced configurations, see the DLP Testing Wiki.