Skip to content

CUDA Kernel fails at sqrt() or rsqrtf() operations #9

@JerryI

Description

@JerryI

I found a strange bug. Let me consider the simplest kernel

__global__ void makezeros(
    float4* spin
) {
    int blockId = blockIdx.x + blockIdx.y * gridDim.x + gridDim.x * gridDim.y * blockIdx.z;
    int gid = blockId * (blockDim.x * blockDim.y) + (threadIdx.y * blockDim.x) + threadIdx.x;
    
    spin[gid].x = 0.001;
}

It works absolutely perfect. However, it is enough to add a square root operation

__global__ void makezeros(
    float4* spin
) {
    int blockId = blockIdx.x + blockIdx.y * gridDim.x + gridDim.x * gridDim.y * blockIdx.z;
    int gid = blockId * (blockDim.x * blockDim.y) + (threadIdx.y * blockDim.x) + threadIdx.x;
    
    float empty = sqrt(3.3f);
    spin[gid].x = 0.001;
}

and the, the array spin will not be affected. However, It doesn't show any errors.
It looks like that this kernel code was not even called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions