Skip to content

Connector does not infer correct type + wrong index calculation #4

@aydogdub

Description

@aydogdub

Description

When applying a pass that moves transient arrays stored in GPU_Global out of a kernel, two bugs occur:

  1. The added input connectors fail to infer the correct type and default to "void". This results in references to void, which are invalid in C++ and cause compilation errors.

Example: the generated code attempts to create a reference to void, which is not allowed when no explicit types for the connectors are provided.

Image

leading to:

Image
  1. To work around (1), I tried explicitly setting the type for added connectors as pointer(data_descriptor.dtype), since the connector should be a reference to an array. While this compiles, it introduces a new bug: the array index is calculated incorrectly.

How I explicitly set connector types:

Image

Now, the accessed value in mask_r12[i,j] is wrong.

Image

How the generated code computes the index:

Image

The correct generated code should compute the index:

mask_r12[i * N + j]

To Reproduce
Steps to reproduce the behavior:

  1. Checkout to the branch newgpucodegen

  2. Run the GPU test example provided in
    dace/tests/npbench/misc/azimint_naive_test.py, which triggers the error.

    • Currently, the connectors are set explicitly in the pass:
      dace/transformations/passes/move_array_out_of_kernel.py
      → This triggers bug (2).
  3. To trigger bug (1) instead, search for "dtypes.pointer" in the code (i.e. dace/transformations/passes/move_array_out_of_kernel.py ) and remove the additional explicit input from any connector.

    • This will cause the auto-detection to fail and default to void.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions