Skip to content

[mlir][SPIR-V] Question: How to lower math.isFinite to SPIR-V? #150778

@Rayfxl

Description

@Rayfxl

Hi, I'm working on a project that involves lowering math.isFinite to SPIR-V. I've noticed a few things and would like to confirm whether the current infrastructure supports this, and how best to proceed.

Current observations:

  1. math.isFinite is already supported and lowered to the LLVM and NVVM dialects.

  2. However, I couldn't find any existing support for lowering math.isFinite to the SPIR-V dialect.

  3. The SPIR-V dialect itself does not define an equivalent operation (e.g., spirv.IsFinite), but the SPIR-V specification does include the OpIsFinite instruction.

My questions:

  1. Is it expected that math.isFinite should eventually lower to a SPIR-V operation like OpIsFinite?

  2. If so, should a new spirv.IsFinite op be introduced in the SPIR-V dialect to support this?

  3. Or is there a recommended workaround for this case (e.g. combine isinf/isnan with boolean logic)?

I'm currently exploring the feasibility of this lowering and not yet planning to submit a patch. I’d appreciate any guidance on the intended direction for this feature.

Thanks!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions