Liberatedwinner commented on PR #18625:
URL: https://github.com/apache/tvm/pull/18625#issuecomment-3701734104

   Please run the code file I attached.
   
[test_tir_log.py](https://github.com/user-attachments/files/24392363/test_tir_log.py)
   
   The result of test code is:
   ```
   ============================================================
   PR version (tir.log)
   ============================================================
   low: T.max(T.float32(128.0) * T.log(T.float32(20.371832715762604)) / 
(T.float32(2.0) * T.log(T.float32(10000.0))), T.float32(0.0))
   high: T.min(T.float32(128.0) * T.log(T.float32(651.89864690440334)) / 
(T.float32(2.0) * T.log(T.float32(10000.0))), T.float32(127.0))
   
   ============================================================
   Original version (math.log)
   ============================================================
   low: T.float32(20.944481620636051)
   high: T.float32(45.026881273754547)
   ```
   
   Using `tir.log` instead of `math.log` in `yarn_find_correction_dim` causes 
Metal codegen to fail with "call to 'log' is ambiguous".
   
   `tir.log` creates a symbolic expression (e.g., 
`T.log(T.float32(20.3718...))`) that remains in the IR and gets compiled into 
Metal shader code. 
   Metal Shading Language has multiple overloads for math functions (float, 
half, etc.), and the compiler cannot resolve which one to use.
   See: [Metal Shading Language 
Specification](https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf)
 (Section 6.5 "Math Functions" and Table 6.4)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to