Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

5.2 KiB

hipDNN Testing

This document provides an overview of hipDNN's testing approach and links to detailed testing documentation.

Running Tests

Prior to running tests, follow the Quick Start Guide to clone hipDNN and prepare your environment.

Afterwards, proceed to run the tests:

# Configure the project (if not already configured).
cmake -GNinja ..

# Build and run all tests
ninja check

# Run all tests with additional details
ninja check-verbose

# Run YAML-defined test categories. Each category in test_categories.yaml creates
# both `<category>-check` and `<category>-check-verbose`.
ninja quick-check
ninja standard-check
ninja unit-check        # Current unit-test category.
ninja integration-check # Current integration-test category.

# Run all tests with additional details for one category
ninja quick-check-verbose

# Run with Address Sanitizer
cmake -GNinja -DBUILD_ADDRESS_SANITIZER=ON ..
ninja check

Testing Documentation

Testing Strategy

Comprehensive guide covering hipDNN's multi-layered testing approach:

  • White box testing (unit tests) for internal implementations
  • Black box testing (API tests) for public interfaces
  • Integration testing for end-to-end functionality
  • Performance testing roadmap

Test Plan

Release testing checklist with prerequisites and test cases:

  • CI pipeline verification
  • Documentation currency checks
  • Expected results from regular tests and ASAN

Test Run Template

Standardized template for recording and tracking test results:

  • Test environment documentation
  • Result recording format
  • Example test runs
  • Best practices for test reporting

Quick Reference

Test Organization

Component Test Location Type
Backend backend/tests/ Unit tests
Frontend frontend/tests/ Unit tests
Data SDK data_sdk/tests/ Unit tests
Plugin SDK plugin_sdk/tests/ Unit tests
Test SDK test_sdk/tests/ Unit tests
Plugins plugins/<name>/tests/ Unit tests
Plugins plugins/<name>/integration_tests/ Integration tests
API tests/backend/ Black box API tests
Frontend Integration tests/frontend/ Integration tests

Choosing Between TYPED_TEST and TEST_P

Need to test across multiple data types (float, half, bfloat16)?
│
├── NO → Use TEST() or TEST_F()
│
└── YES → Also need parameterized test cases?
          │
          ├── NO → Use TYPED_TEST
          │        (Compile-time type safety, simple)
          │
          └── YES → Use TEST_P with multi-declarations
                    (Handles both types AND parameters)

Key Principle: Prefer TEST_P over TYPED_TEST when both type variation and parameterized cases are needed. TYPED_TEST and TEST_P don't mix well together.

Scenario Approach
Single type, no params TEST() / TEST_F()
Single type, with params TEST_P()
Multi-type, no params TYPED_TEST
Multi-type, with params TEST_P + multi-declarations

Multi-Declaration Pattern (for types + parameters)

When you need both type variation AND parameterized tests, use explicit type aliases with TEST_P:

template <typename DataType>
class ConvTest : public ::testing::TestWithParam<ConvTestCase> { };

// Explicit type aliases - one per type
using ConvTestFp32 = ConvTest<float>;
using ConvTestFp16 = ConvTest<half>;
using ConvTestBfp16 = ConvTest<hip_bfloat16>;

// Separate TEST_P for each type
TEST_P(ConvTestFp32, Correctness) { runTest(); }
TEST_P(ConvTestFp16, Correctness) { runTest(); }
TEST_P(ConvTestBfp16, Correctness) { runTest(); }

// Separate instantiation for each type
INSTANTIATE_TEST_SUITE_P(Smoke, ConvTestFp32, testing::ValuesIn(getCases()));
INSTANTIATE_TEST_SUITE_P(Smoke, ConvTestFp16, testing::ValuesIn(getCases()));
INSTANTIATE_TEST_SUITE_P(Smoke, ConvTestBfp16, testing::ValuesIn(getCases()));

Why multi-declarations over macros? Modern tooling makes boilerplate easy to handle, and avoiding macros makes tests easier to debug and understand.

Type Combinations with TypePair

For testing type combinations (e.g., input type + compute type), define a struct to hold the types:

template <typename T1, typename T2>
struct TypePair
{
    using InputType = T1;
    using ComputeType = T2;
};

using TypeCombinations = ::testing::Types<TypePair<float, float>,
                                          TypePair<half, float>,
                                          TypePair<hip_bfloat16, float>>;
TYPED_TEST_SUITE(MyTypedTest, TypeCombinations);

TYPED_TEST(MyTypedTest, Correctness)
{
    using InputType = typename TypeParam::InputType;
    using ComputeType = typename TypeParam::ComputeType;
    // Test implementation using InputType and ComputeType
}

Testing Requirements

  • Coverage Target: 80% overall, with each component maintaining >80% individually
  • GPU Tests: Must be marked with SKIP_IF_NO_DEVICE() macro
  • Platform Support: All tests must work on Windows and Linux
  • Performance: Unit tests must execute quickly
  • CI: All CI pipelines must pass on every PR