Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

const array breaks StructMutualRef #452

Closed
domluna opened this issue Oct 31, 2023 · 1 comment · Fixed by #453
Closed

const array breaks StructMutualRef #452

domluna opened this issue Oct 31, 2023 · 1 comment · Fixed by #453

Comments

@domluna
Copy link

domluna commented Oct 31, 2023

    struct ggml_tensor {
        enum ggml_type         type;
        enum ggml_backend_type backend;

        struct ggml_backend_buffer * buffer;

        int     n_dims;
        int64_t ne[GGML_MAX_DIMS]; // number of elements
        size_t  nb[GGML_MAX_DIMS]; // stride in bytes:
                                   // nb[0] = ggml_type_size(type)
                                   // nb[1] = nb[0]   * (ne[0] / ggml_blck_size(type)) + padding
                                   // nb[i] = nb[i-1] * ne[i-1]

        // compute data
        enum ggml_op op;

        // op params - allocated as int32_t for alignment
        int32_t op_params[GGML_MAX_OP_PARAMS / sizeof(int32_t)];

        bool is_param;

        struct ggml_tensor * grad;
        struct ggml_tensor * src[GGML_MAX_SRC];

        // performance
        int     perf_runs;
        int64_t perf_cycles;
        int64_t perf_time_us;
        //
        struct ggml_tensor * view_src;
        size_t               view_offs;
        //
        void * data;

        char name[GGML_MAX_NAME];

        void * extra; // extra things e.g. for ggml-cuda.cu

        char padding[12];
    };

https://github.com/JuliaInterop/Clang.jl/blob/master/src/generator/codegen.jl#L546

when int64_t ne[GGML_MAX_DIMS]; or size_t nb[GGML_MAX_DIMS]; is encountered the assert will throw saying it's expecting that type to be a pointer.

Now if the self references to ggml_tensor are removed codegen works or if the const array fields are removed it works.

@Gnimuc Gnimuc mentioned this issue Nov 1, 2023
@Gnimuc
Copy link
Member

Gnimuc commented Nov 1, 2023

fixed in #453

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants