[Issue]: Calling min(size_t, int) in ContractionSolution.cpp causes ambiguity #1977
Labels
change request
A code change requested by external or internal stakeholders
triaged
The issue has been reviewed by a team member and prioritized
Problem Description
when we try to fix a compiler bug about function min by llvm/llvm-project#82956 we encountered build failure in Tensile/rocBLAS. Then we found the line that causes the compilation failure is
https://github.com/ROCm/Tensile/blame/6aa9c335a5cecf573dc129adda79e284ac898904/Tensile/Source/lib/source/ContractionSolution.cpp#L1874
Basically this line is calling function min defined in clang header with (unsigned long, int). Previously the compiler only defined min(int, int). As we introduce min(unsigned, unsigned), min(long, long), min(unsigned long, unsigned long). The compiler could not choose among these candidates since there is no exact match.
We do not want to define min(unsigned long, int) because that would do implicit conversion from int to unsigned long then compare. This may cause unexpected results, e.g. min(1UL, -1) will return 1UL. We want users to do explicit cast to indicate their intention. We think it is better than doing silent implicit conversion.
Therefore we would like Tensile to modify the line https://github.com/ROCm/Tensile/blame/6aa9c335a5cecf573dc129adda79e284ac898904/Tensile/Source/lib/source/ContractionSolution.cpp#L1874
to be
Operating System
Ubuntu 22.04
CPU
any
GPU
AMD Instinct MI300X
ROCm Version
ROCm 6.1.0
ROCm Component
Tensile
Steps to Reproduce
No response
(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: