forked from icaven/glm
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Description
Hello,
Thank you for this great library.
I recently encountered unexpected behavior when using glm::max()
within a CUDA __global__
or __device__
function in the latest source version of GLM.
Here’s a minimal example illustrating the issue:
__global__ void function2_CUDA(...)
{
glm::vec2 h_0_ = glm::vec2(1e-4, 1e-4);
glm::vec2 h_0_1 = glm::vec2(1e-5, 1e3);
glm::vec2 h_0_2 = max(h_0_, h_0_1);
printf("h_0_: (%f, %f)\n", h_0_.x, h_0_.y);
printf("h_0_1: (%f, %f)\n", h_0_1.x, h_0_1.y);
printf("h_0_2: (%f, %f)\n", h_0_2.x, h_0_2.y);
}
void function1(...)
{
function2_CUDA<<<256, 256>>>(...);
}
Expected output for h_0_2
:
(1e-4, 1e3)
Actual output observed:
(1e-5, 1e3)
I verified that GLM version 1.0.1 produces the correct result. However, the latest source from the repository gives the incorrect output.
This leads me to suspect a compatibility issue in the current implementation of max()
when used in cuda code. Alternatively, am I possibly missing something in its usage with CUDA?
Any insights or clarification would be appreciated!
Metadata
Metadata
Assignees
Labels
No labels