Skip to content

feat: add IsInf op builder to QNN EP#403

Draft
qti-yuduo wants to merge 1 commit into
mainfrom
qnn-isinf-op-builder
Draft

feat: add IsInf op builder to QNN EP#403
qti-yuduo wants to merge 1 commit into
mainfrom
qnn-isinf-op-builder

Conversation

@qti-yuduo
Copy link
Copy Markdown
Collaborator

Maps ONNX IsInf -> QNN_OP_IS_INF, wiring the detect_positive and detect_negative ONNX attributes (default 1) to the corresponding QNN_DATATYPE_BOOL_8 scalar params. Without this, models containing IsInf (typically emitted by torch.nan_to_num decompositions) fall back to CPU and shatter the single-graph requirement of qnn_context_binary compilation.

Validates input is FP32/FP16 and output is BOOL_8 per the QNN op contract.

Maps ONNX IsInf -> QNN_OP_IS_INF, wiring the detect_positive and
detect_negative ONNX attributes (default 1) to the corresponding
QNN_DATATYPE_BOOL_8 scalar params. Without this, models containing
IsInf (typically emitted by torch.nan_to_num decompositions) fall
back to CPU and shatter the single-graph requirement of
qnn_context_binary compilation.

Validates input is FP32/FP16 and output is BOOL_8 per the QNN op
contract.
@qti-yuduo qti-yuduo marked this pull request as ready for review May 18, 2026 23:31
@github-actions
Copy link
Copy Markdown
Contributor

Diff Coverage

-------------
Diff Coverage
Diff: origin/main...HEAD, staged and unstaged changes
-------------
onnxruntime/core/providers/qnn/builder/op_builder_factory.cc (100%)
onnxruntime/core/providers/qnn/builder/opbuilder/isinf_op_builder.cc (100%)
-------------
Total:   38 lines
Missing: 0 lines
Coverage: 100%
-------------


Copy link
Copy Markdown
Collaborator

@yath1 yath1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm


#if defined(__aarch64__) || defined(_M_ARM64) || defined(__linux__)

// HTP supports IsInf only in FP16 mode (per QAIRT HtpOpDefSupplement). The
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: HTP supports both in FP16 and FP32. Maybe we can add the same test for FP32 as well?

@qti-yuduo qti-yuduo marked this pull request as draft May 19, 2026 00:34
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.

2 participants