KhronosGroup / KhronosGroup/SPIRV-LLVM-Translator
Incorrect llvm.minimum/llvm.maximum to fmin/fmax ExtInst mapping wrt NaN handling
- 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
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