Skip to content

Add Comprehensive Vector Unary Operation Test Suite#8172

Open
ehsankianifar wants to merge 1 commit into
eclipse-omr:masterfrom
ehsankianifar:AddVectorUnaryOpcodesTrilTests
Open

Add Comprehensive Vector Unary Operation Test Suite#8172
ehsankianifar wants to merge 1 commit into
eclipse-omr:masterfrom
ehsankianifar:AddVectorUnaryOpcodesTrilTests

Conversation

@ehsankianifar

Copy link
Copy Markdown
Contributor

Summary

This PR introduces a new comprehensive test suite (VectorUnaryTest.cpp) for vector unary operations in the OMR compiler's Tril test framework. The test suite provides parameterized testing for six vector operations across multiple data types and vector lengths.

What's New

Tested Vector Operations

  • vabs - Vector absolute value (all types)
  • vneg - Vector negation (all types)
  • vnot - Vector bitwise NOT/complement (integral types only)
  • vpopcnt - Vector population count (integral types only)
  • vnolz - Vector number of leading zeros (integral types only)
  • vnotz - Vector number of trailing zeros (integral types only)

Test Coverage

  • Data Types: int8_t, int16_t, int32_t, int64_t, float, double
  • Vector Lengths: 128-bit (all platforms), 256-bit (x86 only)
  • Edge Cases: Zero, min/max values, infinity, NaN, denormalized numbers, epsilon values

Implementation Details

Key Features

  1. Parameterized Testing: Uses Google Test's typed test framework to automatically generate tests for all type/operation combinations
  2. Reference Implementations: Includes pure C++ reference implementations for each operation to validate compiler output
  3. Platform-Aware: Automatically skips tests for unsupported operations on the current CPU
  4. Comprehensive Test Data: Tests include boundary values and floating-point special cases
  5. IL Tree Generation: Dynamically generates Tril IL trees for each test configuration

Architecture

  • Template-based design allows easy addition of new operations
  • Helper functions (makeDelegate, generateTestTree, getTestSourceData) provide reusable test infrastructure
  • Conditional compilation for platform-specific vector lengths (256-bit on x86)
  • Tests multiple vector-sized chunks of data per operation

This comprehensive test suite ensures correctness of vector unary operations across the OMR compiler's supported platforms and data types.

@ehsankianifar ehsankianifar force-pushed the AddVectorUnaryOpcodesTrilTests branch from 371ad04 to 078989a Compare March 19, 2026 17:30
@ehsankianifar

Copy link
Copy Markdown
Contributor Author

@gita-omr @hzongaro @r30shah Could you please review this test suite?
I used typed tests to make it easier to test for different opcodes. I used a single test data generator with a good variation of source data to make sure we cover different scenarios. It is also very easy to add data to the test data.
I opened the PR for the simplest opcodes (unary) to gather feedback and make improvements before opening PRs for other opcode groups like binary and masked version of unary and binary.
I kept everything in a single file for now but later I will move the supporting functions to a shared file.

Introduces VectorUnaryTest.cpp, a parameterized test suite for vector
unary operations in the compiler's Tril test framework.

Covers six vector operations (vabs, vneg, vnot, vpopcnt, vnolz, vnotz)
across multiple data types (int8_t, int16_t, int32_t, int64_t, float,
double) and vector lengths (128-bit and 256-bit on x86).

Tests validate compiled code against reference implementations with
comprehensive edge case coverage including min/max values, zero,
infinity, NaN, and denormalized numbers.

signed-off-by: Ehsan Kiani Far <ehsan.kianifar@gmail.com>
@ehsankianifar ehsankianifar force-pushed the AddVectorUnaryOpcodesTrilTests branch from 078989a to 323227d Compare March 19, 2026 17:47
@hzongaro hzongaro requested review from hzongaro and removed request for vijaysun-omr May 25, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants