Skip to content

GPU Codegen bug: bad cast of input scalar #2402

Description

@FlorianDeconinck

Dear DaCe team,

We encountered a bug in the codegen (SDFG linked and repro' below).

The quirk is that a tasklet takes a np.float32 scalar but is given a np.float64 - this triggers a malformed cast inside the kernel on the callsite of a nested function, e.g.

void nested_sdfg_0_0_3(const double&  scalar, float* __restrict__ out_field, int __i, int __j);

__global__ void  __launch_bounds__(32) horizontal_loop_139965476328208_0_0_5(float * __restrict__ stencil_out, const double stencil_scalar) {
       #code removed
       nested_sdfg_0_0_3(*(float *)(&stencil_scalar), &stencil_out[0], __i, __j);
       #--------------------------------^ bad idea
}

Rep:

import dace

sdfg = dace.SDFG.from_file("./bad_cast_on_scalar.sdfgz.zip")
sdfg.compile()

Activity

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

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