Skip to content

IntArray error #27

@1152995039

Description

@1152995039

Hi,

I use IntArray as funtion parameter in python side and compile passed. But a error occurs when I simulate by vcs:

Error-[DPI-ASSERT] Assertion failure in DPI call
Assertion failure in DPI function/task call: dimension 0 query is not supported. (svSize)
Please check the parameter passing in a DPI function/task call

And I find that the svSize is used in c file, which generated by compile_lib:

py::memoryview to_buffer(const svOpenArrayHandle array_handle) {
    ssize_t element_size = sizeof(int32_t);
    void *base_ptr = nullptr;
    std::vector<ssize_t> sizes = {};
    std::vector<ssize_t> strides = {};

    // we try to query the underlying representation
    base_ptr = svGetArrayPtr(array_handle);
    if (!base_ptr) {
        throw std::runtime_error("Array type does not have native C representation");
    }
    auto dim = svDimensions(array_handle);
    for (auto i = 0; i < dim; i++) {
        auto s = svSize(array_handle, i);
        sizes.emplace_back(s);
    }

    // assumes row major ordering
    ssize_t stride = element_size;
    strides = std::vector<ssize_t>(dim, element_size);
    for (int i = 0; i < dim - 1; i++) {
        stride *= sizes[i];
        strides[i] = stride;
    }
    return py::memoryview::from_buffer(
        base_ptr,                                 /* Pointer to buffer */
        element_size,                             /* Size of one scalar */
        py::format_descriptor<int32_t>::value, /* Python struct-style format descriptor */
        sizes,                                    /* Buffer dimensions */
        strides                                   /* Strides (in bytes) for each index */
    );
}

Maybe this (dim in for loop begins from 0 ) causes the error?

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