Skip to content

Conversation

@umar456
Copy link
Member

@umar456 umar456 commented Nov 25, 2022

Fix tests and improve the AF_WITH_FAST_MATH option in OpenCL and CUDA

Description

  • Pass fast math flag to nvcc
  • Pass fast math flag to nvrtc
  • Pass fast math flag to OpenCL
  • Fix min and max function when AF_WITH_FAST_MATH is set because infinity doesn't exist with fast math
  • Set cuBLAS math mode to CUBLAS_TF32_TENSOR_OP_MATH when AF_WITH_FAST_MATH is set

Changes to Users

N/A

Checklist

  • Rebased on latest master
  • Code compiles
  • Tests pass
  • [ ] Functions added to unified API
  • [ ] Functions documented

Copy link
Member

@9prady9 9prady9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have any fast mode specific tests ?

@umar456
Copy link
Member Author

umar456 commented Nov 26, 2022

We don't have fast math specific tests. I am not sure how we could write one. We can lower precision but I don't think that will be helpful. A lot of tests still fail with these changes. I am not sure if we can fix all of them.

@umar456 umar456 merged commit 2181739 into arrayfire:master Nov 26, 2022
@umar456 umar456 deleted the more_fast_math branch November 26, 2022 18:23
@WilliamTambellini
Copy link
Contributor

Perhaps you could add some fastmath specific refs values using the macro :
https://stackoverflow.com/questions/43140581/how-to-use-the-gcc-preprocessor-macro-fast-math
But what I ve seen is that results with fastmath depend on many vars (os, cpu arch, compiler, ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants