Skip to content

math_brute_force: Refactor input generation & reduce default test size#2697

Open
rjodinchr wants to merge 3 commits into
KhronosGroup:mainfrom
rjodinchr:math-brute-force-special-values
Open

math_brute_force: Refactor input generation & reduce default test size#2697
rjodinchr wants to merge 3 commits into
KhronosGroup:mainfrom
rjodinchr:math-brute-force-special-values

Conversation

@rjodinchr
Copy link
Copy Markdown
Collaborator

@rjodinchr rjodinchr commented May 19, 2026

This patch addresses execution time and input coverage in the
math_brute_force tests by centralizing input generation and scaling
down the default number of tested values.

Key changes:

  • Abstracted input generation: Replaced duplicated array-filling logic
    across test files with shared fill*Input helper functions (for unary,
    binary, and ternary operations). This ensures that special edge-case
    values (NaNs, Infs, denormals) and random payloads are consistently
    injected across all tests.
  • Reduced default test size: The default loop bounds have been reduced
    from an exhaustive 1ULL << 32 values to a randomized subset of
    1ULL << 27 inputs. This drastically speeds up standard test runs.
  • Added exhaustive -a flag: Introduced a new -a command-line option
    that restores the exhaustive testing behavior, allowing validation
    against all 2^32 sequential values when needed.
  • Improved wimpy mode scaling: Removed the scale and step skip logic,
    which could inadvertently skip combinations of special values. Instead,
    the patch now directly reduces the total input_count_power_of_two by
    using a De Bruijn sequence bit-hack to calculate the log2 of the
    wimpyReductionFactor.
  • Consolidate the hardcoded arrays of edge-case test values from multiple
    individual test files into a single, shared location.

Ref #2669

@rjodinchr rjodinchr force-pushed the math-brute-force-special-values branch 2 times, most recently from 25ff430 to 65ad379 Compare May 19, 2026 14:43
@rjodinchr rjodinchr force-pushed the math-brute-force-special-values branch from 65ad379 to cc958dc Compare May 22, 2026 09:23
@rjodinchr rjodinchr changed the title math_brute_force: Group special values to reduce code duplication math_brute_force: Refactor input generation & reduce default test size May 22, 2026
@rjodinchr rjodinchr force-pushed the math-brute-force-special-values branch 6 times, most recently from 6917a88 to 8c6d9be Compare May 27, 2026 07:10
rjodinchr added 2 commits May 28, 2026 16:50
The primary goal of this commit is to improve CI tracking by
introducing a new golden format that can differentiate test results
based on command-line arguments. To cleanly extract and pass these
arguments into the JSON result outputs, the command-line parsing
infrastructure across the CTS required a significant refactoring.

Key changes include:
* Enhanced CI Tracking: Updates `ci/compare_results.py`,
`ci/pocl/golden.json`, and `saveResultsToJson` to include and evaluate
an `args` key. The golden JSON now uses a nested format mapping
specific argument strings (e.g., `--wimpy -1`) to their expected
results, allowing the CI to validate the same binary run under
different parameters.
* Centralized Parsing Infrastructure: Introduces the `ParseArgsFn`
callback and `runTestHarnessWithCheckAndParse`. This offloads custom
argument parsing from individual test `main()` functions and safely
extracts the arguments used so they can be logged by the test harness.
* Help Text Consolidation: Replaces fragmented `printUsage()`
functions with unified `help` string references populated directly by
the standard parsing callbacks.

[run-test: test_computeinfo]
[run-test: test_bruteforce -1 -w]
[run-test: test_cl_copy_images small_images --num-worker-threads 2 1D]
[run-test: test_image_streams 1D --num-worker-threads 2 CL_R CL_FILTER_NEAREST]
This patch consolidates the hardcoded arrays of edge-case test values
from multiple individual test files into a single, shared location.

Ref KhronosGroup#2669
@rjodinchr rjodinchr force-pushed the math-brute-force-special-values branch from 8c6d9be to e6d7f0d Compare May 28, 2026 15:05
@rjodinchr
Copy link
Copy Markdown
Collaborator Author

Depends on #2706

This patch addresses execution time and input coverage in the
math_brute_force tests by centralizing input generation and scaling
down the default number of tested values.

Key changes:
* Abstracted input generation: Replaced duplicated array-filling logic
  across test files with shared `fill*Input` helper functions (for unary,
  binary, and ternary operations). This ensures that special edge-case
  values (NaNs, Infs, denormals) and random payloads are consistently
  injected across all tests.
* Reduced default test size: The default loop bounds have been reduced
  from an exhaustive `1ULL << 32` values to a randomized subset of
  `1ULL << 27` inputs. This drastically speeds up standard test runs.
* Added exhaustive `-a` flag: Introduced a new `-a` command-line option
  that restores the exhaustive testing behavior, allowing validation
  against all 2^32 sequential values when needed.
* Improved wimpy mode scaling: Removed the `scale` and `step` skip logic,
  which could inadvertently skip combinations of special values. Instead,
  the patch now directly reduces the total `input_count_power_of_two` by
  using a De Bruijn sequence bit-hack to calculate the `log2` of the
  `wimpyReductionFactor`.

Fixes: KhronosGroup#2669
[run-test: test_bruteforce -w -1]
@rjodinchr rjodinchr force-pushed the math-brute-force-special-values branch from e6d7f0d to ed3000d Compare May 28, 2026 15:19
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