-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to call trigonometric functions? #85
Comments
@AlexBatsev, for your purpose, I think you can just use the standard However, not every function in |
@MoFtZ, thank you very much for an answer. I'm using only floats in my kernels, no doubles at all, and need just natively supported versions of
I get the following error on Cuda which forces me to enable Algorithms |
@AlexBatsev, just to confirm, are you using Cuda or OpenCL? In your original post, you mentioned looking into the OpenCL source code. However, in your follow-up post, you are trying to use Cuda. If Cuda, the reason If you are using .NET Core, you should instead use Alternatively, if you are only going to use single-precision floats, you could try setting the
I'm not sure what other side-effects this will have, so use at your own risk. For example, even simple addition and division of double-precision floats will probably be treated as single-precision floats. |
@MoFtZ, thanks again.
let’s compare 2 versions.
kernel void ILGPUKernel( and results produced by all 4 accelerators (CPU, CUDA, OpenCL on GPU, OpenCL on CPU) are exactly the same within accuracy.
kernel void ILGPUKernel( One may notice that the buffer is declared as |
Thanks for the clarification @AlexBatsev, that clears things up a lot. The latest code on the This will allow you to use |
Also, with regards to seeing double* in the OpenCL code generator, this looks like a bug. |
@AlexBatsev Thanks for posting this question. I always recommend using the |
Just in time @m4rs-mt - I was just looking into a fix for that double* issue, but now you can do it instead 😄 |
Cuda code itself can be considered as an "extension to the C/C++" language. However, the Cuda compiler compiles Cuda code into |
I see 🔢 Well you can also dive into this issue if you like 😄 If this problem is related to the |
I found one issue here - the loop sets Float32 to use the word "double". It looked like there were one or two other spots that might need investigation too. |
@MoFtZ, @m4rs-mt thanks a lot for your feedbacks. I'll try an approach with temp package for Algorithms. |
@AlexBatsev Makes sense to me. We should extend the documentation while pointing users to leverage more "specifically" designed classes. |
I will close this issue for now, as the problems mentioned have either been resolved or are currently being processed in different issues. |
Looks like it’s not possible to use basic trig. functions without need to enable Algorithms. Call to eg. Math.Sin() is translated to SinF which is implemented only in Algorithms. That is really strange that these functions are missing from IntrinsicMath where they would be sought in the first place. After examining OpenCL source generated by ILGPU+Algorithms, I’ve noticed that calls to XMath.Sin/Cos are translated to plain sin()/cos() calls, which is correct, that is why the logic of placing them among complex Algorithms escapes me.
My unwillingness to use Algorithms is that it is not updated to the latest 0.8.0 ILGPU, which contains dynamic SharedMemory allocation and RuntimeKernelConfig I really need. How can I get around this problem as I do not really need Algorithms, but only basic trigonometry, dynamic SharedMemory and RuntimeKernelConfig?
The text was updated successfully, but these errors were encountered: