KhronosGroup / KhronosGroup/SPIRV-LLVM-Translator

Incorrect llvm.minimum/llvm.maximum to fmin/fmax ExtInst mapping wrt NaN handling

Open
#3,282 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
LLVM
Stars
625
Forks
279
Avg merge
3d 5h
Merged PRs (30d)
34

Description

In SPIRVWriter.cpp, it's incorrect to map `minimum` to `OpenCLLIB::Fmin` due to differences in NaN behaviour:

`llvm.minimum`:
> If either operand is a NaN, returns NaN.

`fmin`:
> If one operand is a NaN, fmin returns the other argument. If both arguments are NaNs, fmin returns a NaN.

Contributor guide

Open the contributing guide

Research direction

Start in SPIRVWriter.cpp, where llvm.minimum and llvm.maximum are mapped to OpenCLLIB::Fmin and the corresponding maximum operation. Compare the LLVM NaN semantics in the issue with the target ExtInst behavior and inspect nearby mappings for context. Done means both operations preserve the documented behavior when either operand is NaN.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.