Skip to content

[SYCL][Test] Guard imf_half_type_cast subnormal tests by device fp_co… - #22981

Open
vishwajithupendra wants to merge 1 commit into
intel:syclfrom
vishwajithupendra:imf_half_type_cast_subnormal_guards
Open

[SYCL][Test] Guard imf_half_type_cast subnormal tests by device fp_co…#22981
vishwajithupendra wants to merge 1 commit into
intel:syclfrom
vishwajithupendra:imf_half_type_cast_subnormal_guards

Conversation

@vishwajithupendra

Copy link
Copy Markdown
Contributor

…nfig subnormal flag

The Adreno GPU does not support FP16 or FP32 subnormal values - they are flushed to zero. This caused test failures when subnormal inputs produced results that did not match the reference values computed assuming subnormal preservation.

Add a check_subnormal() helper template that instantiates with a SYCL device info descriptor and queries the device's fp_config flags at runtime to check for the subnormal bit.

Use it to derive two boolean guards:

has_half_subnormal : gates subnormal sub-cases in all
half2int/uint/short/ushort/ll/ull blocks
has_single_subnormal: gates two sub-cases within float2half -
(a) FP32 normal inputs whose magnitude is so small
they produce a FP16 subnormal output
(gated by has_half_subnormal)
(b) FP32 subnormal inputs, where the input itself
must not be flushed before conversion
(gated by has_single_subnormal only)

In each block, subnormal inputs are removed from the main unconditional input list and moved into a separate if (has_*_subnormal) sub-block with its own ref values.

Test blocks that depend on subnormal behaviour are skipped when the corresponding fp_config subnormal flag is absent, making the test portable across devices with and without subnormal support.

…nfig subnormal flag

The Adreno GPU does not support FP16 or FP32 subnormal values - they are
flushed to zero. This caused test failures when subnormal inputs produced
results that did not match the reference values computed assuming subnormal
preservation.

Add a check_subnormal() helper template that instantiates with a SYCL device
info descriptor and queries the device's fp_config flags at runtime to check
for the subnormal bit.

Use it to derive two boolean guards:

  has_half_subnormal  : gates subnormal sub-cases in all
                        half2int/uint/short/ushort/ll/ull blocks
  has_single_subnormal: gates two sub-cases within float2half -
                        (a) FP32 normal inputs whose magnitude is so small
                            they produce a FP16 subnormal output
                            (gated by has_half_subnormal)
                        (b) FP32 subnormal inputs, where the input itself
                            must not be flushed before conversion
                            (gated by has_single_subnormal only)

In each block, subnormal inputs are removed from the main unconditional
input list and moved into a separate if (has_*_subnormal) sub-block with
its own ref values.

Test blocks that depend on subnormal behaviour are skipped when the
corresponding fp_config subnormal flag is absent, making the test portable
across devices with and without subnormal support.
@vishwajithupendra
vishwajithupendra requested a review from a team as a code owner August 20, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant