Skip to content

SyclReproSum 1.2.5

Choose a tag to compare

@lilohuang lilohuang released this 07 Sep 09:18
· 5 commits to main since this release

SyclReproSum 1.2.5 fixes two correctness hazards: an observed CPU OpenCL JIT
miscompilation in high-fold double conversion, and an environment-probe cache
collision between operation specializations compiled in different translation
units.

The library remains header-only, source-compatible with version 1.2.4, C++17,
and based on the Ahrens-Demmel-Nguyen (ADN) binned floating-point format. The
binned primitives remain adaptations of the ReproBLAS reference implementation.

Highlights

  • Guard generic SPIR double conversion against an observed CPU OpenCL JIT
    miscompilation.
  • Keep native NVPTX and AMDGCN sum and cumulative-sum operation kernels
    unchanged.
  • Isolate device arithmetic probes and their caches by operation, floating-point
    type, fold count, and work-group size.
  • Add a mixed-translation-unit regression test that combines strict and unsafe
    device floating-point options.
  • Add high-fold conversion-order coverage for scalar and cumulative sums across
    input permutations and small work-group sizes.
  • Update the encoded library version to 1.2.5.

SPIR double-conversion workaround

Some CPU OpenCL runtimes can miscompile the double accumulator conversion loop
when consuming generic SPIR device code. The failure was observed with higher
fold counts and small work-groups and can produce an incorrect final value after
large-magnitude cancellation.

Version 1.2.5 makes the running double conversion value volatile only in generic
SPIR device images. The arithmetic sequence, bin contents, scaling rules, and
rounding order are unchanged. Native NVIDIA and AMD device images retain the
ordinary non-volatile conversion loop, as does every float conversion.

The new regression coverage exercises:

  • Double fold counts 16, 32, and 52.
  • Float fold count 21.
  • Work-group sizes 2, 4, and 64.
  • All permutations of a large cancelling pair and a retained signal.
  • Inputs spanning work-item, tile, and recursive-scan boundaries.
  • Near-overflow scaled conversion terms.
  • Bit-identical scalar sums and cumulative prefixes.

Both adn::sum and adn::cumsum use the corrected conversion path.

Translation-unit-safe environment checks

Previous releases named the device arithmetic probe and cached its successful
result only by backend, device, and floating-point type. In a program containing
translation units built with different device floating-point options, a strict
translation unit could populate that cache before an operation from an unsafe
translation unit ran. The later operation could then skip the arithmetic probe.

Version 1.2.5 gives each sum and cumsum specialization its own probe identity
and cache. The identity includes the operation, floating-point type, K, and
WG_SIZE. An explicit adn::validate_environment<T>(q) call retains its own
cache and cannot suppress the check required by a later operation
specialization.

A new validation target compiles one translation unit with strict defaults and
another with -fdenormal-fp-math=positive-zero, links them into one application,
and verifies that every otherwise supported device rejects the unsafe
operation. The test fails against version 1.2.4 and passes with this release on
Intel, NVIDIA, and AMD devices.

Performance impact

The accumulator update, deposit, renormalization, merge, reduction, scan, and
operation-kernel conversion sequences are unchanged by the validation-cache
fix. Comparison of the common operation kernels found:

  • Identical NVIDIA SASS.
  • Identical NVIDIA PTX instruction sequences, apart from compiler-generated
    local label numbering.
  • Identical AMDGPU machine-code bytes.

Each new operation specialization performs its arithmetic probe once per device
and then uses the cached result. The normal throughput benchmark performs a
warmup call before timing, so this first-use check is outside the reported
measurements. Applications that instantiate many K and WG_SIZE combinations
may emit more small probe kernels and perform more one-time checks; steady-state
sum and cumulative-sum throughput is unaffected.

The README clarifies the three-invocation benchmark method and refreshes the
SPIR measurements and toolchain metadata. Published native NVIDIA and AMD
throughput values remain applicable because their timed operation kernels are
unchanged.

Testing and validation

The complete suite now contains:

  • 179 correctness cases and four throughput benchmarks per selected device.
  • Ten cross-device reproducibility cases.
  • One version test.
  • 743 total Google Tests on the four-device validation system.
  • One standalone mixed-translation-unit validation test.

Release validation covered:

  • NVIDIA RTX PRO 4500 Blackwell via CUDA (sm_120).
  • AMD Radeon Pro W7500 via HIP (gfx1102).
  • Intel Graphics [0x7d67] via Level Zero.
  • Intel Core Ultra 7 265 CPU via OpenCL.
  • Additional randomized sum and cumulative-sum checks on NVIDIA GB10 and Intel
    Arc Pro B70 systems.

Validation results:

  • CUDA, SPIR-V, and AMDGCN example and test fat binaries built successfully.
  • All 743 tests passed, including sixteen 100-million-element benchmarks.
  • All 727 non-benchmark tests passed under hostile host floating-point modes.
  • Denormal and signed-zero unsafe-device variants passed all expected rejection
    tests.
  • The compile-time unsafe evaluation-mode rejection check passed.
  • The mixed-translation-unit regression passed on all enabled backends.
  • Clang-format 18, ASCII, and release-diff whitespace checks passed.

Compatibility and upgrade notes

  • Version 1.2.5 is source-compatible with version 1.2.4.
  • Existing adn::sum, adn::cumsum, and adn::validate_environment calls
    require no changes.
  • Recompile applications after updating the header.
  • Supported K, WG_SIZE, pointer, dependency-event, and backend interfaces are
    unchanged.
  • Native NVIDIA and AMD steady-state operation performance is unchanged.
  • Explicit environment preflight remains available, while every operation
    specialization performs and caches its own first-use check.

Changes since 1.2.4

  • Add the generic-SPIR double-conversion JIT workaround.
  • Preserve the native NVIDIA and AMD conversion paths.
  • Add high-fold and small-work-group conversion-order regression tests.
  • Cover scalar sums, cumulative sums, permutations, and scaled terms.
  • Isolate environment probes and caches by operation specialization.
  • Add mixed-translation-unit unsafe-device validation.
  • Clarify benchmark methodology and refresh SPIR benchmark results.
  • Update the encoded library version from 1.2.4 to 1.2.5.

Full comparison:
v1.2.4...v1.2.5

Attribution and license

SyclReproSum is licensed under the BSD 3-Clause License. Portions of the binned
accumulator primitives are adapted from ReproBLAS, Copyright 2016, University
of California. See THIRD_PARTY_NOTICES for the complete attribution and
license terms.