Skip to content

[libspirv] use generic isfinite/isinf/isnan for NVPTX#22413

Open
wenju-he wants to merge 2 commits into
intel:syclfrom
wenju-he:libspirv-nvptx-use-generic-relational
Open

[libspirv] use generic isfinite/isinf/isnan for NVPTX#22413
wenju-he wants to merge 2 commits into
intel:syclfrom
wenju-he:libspirv-nvptx-use-generic-relational

Conversation

@wenju-he

@wenju-he wenju-he commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Motivation is to delete include/libspirv/relational.h.

Delete wrong implementation nvptx/relational/clc_isinf.cl, which returns 1 for true in vector input,
while the generic clc_isinf.cl is conforming to OpenCL spec.

Generic implementations are better for nvptx:

  • IsFinite: fully vectorized; elimiates fpext and __nv_isfinited calls.
  • IsInf: fully vectorized; eliminates __nv_isinf calls.
  • IsNan: fully vectorized; elimiates __nv_isnan calls.

Motivation is to delete include/libspirv/relational.h.

Generic implementations are better for nvptx:
- IsFinite: fully vectorized; elimiates fpext and __nv_isfinited calls.
- IsInf: vectorized icmp and ext.
- IsNan: fully vectorized; elimiates __nv_isnan calls.
@wenju-he wenju-he requested review from a team and Maetveis as code owners June 24, 2026 11:31
@wenju-he wenju-he requested a review from pbalcer June 24, 2026 11:32
wenju-he added a commit to llvm/llvm-project that referenced this pull request Jun 25, 2026
The file calls __nv_isinf which return 1 for true on vector input, while
the generic clc_isinf which return -1 for true on vector input. Using
nvptx clc_isinf in OpenCL isinf violates OpenCL spec.

Found the issue in intel/llvm#22413
llvm-sync Bot pushed a commit to arm/arm-toolchain that referenced this pull request Jun 25, 2026
…699)

The file calls __nv_isinf which return 1 for true on vector input, while
the generic clc_isinf which return -1 for true on vector input. Using
nvptx clc_isinf in OpenCL isinf violates OpenCL spec.

Found the issue in intel/llvm#22413
llvm-upstreamsync Bot pushed a commit to qualcomm/cpullvm-toolchain that referenced this pull request Jun 25, 2026
…699)

The file calls __nv_isinf which return 1 for true on vector input, while
the generic clc_isinf which return -1 for true on vector input. Using
nvptx clc_isinf in OpenCL isinf violates OpenCL spec.

Found the issue in intel/llvm#22413
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