Code Monkey home page Code Monkey logo

Comments (10)

Gerson2102 avatar Gerson2102 commented on September 27, 2024 1

Let me know if i can work in this one.

from cairo_native.

azteca1998 avatar azteca1998 commented on September 27, 2024 1

helper.init_block() is the block at which the operation is appended. We want to append the init block (helper.init_block()) instead of entry (the default block for each libfunc), or any other block internally created within the libfunc (only present in complex libfuncs).

Basically, every .append_operation(llvm::alloca(...)) and its dependencies (the constant) should append to helper.init_block().

from cairo_native.

rvalenciano avatar rvalenciano commented on September 27, 2024

Hey, whats up! I'm a first time contributor and would love to introduce myself in the codebase. Let me know if I can grab this or any other issue :)

from cairo_native.

Gerson2102 avatar Gerson2102 commented on September 27, 2024

@azteca1998 Hello mate. When you say llvm.alloca you mean llvm::alloca? Do i have to check in libfuncs for those things?

All llvm::alloca should be like this right?:

let stack_ptr = helper
                .init_block()
                .append_operation(llvm::alloca(
                    context,
                    value_len,
                    llvm::r#type::opaque_pointer(context),
                    location,
                    AllocaOptions::new()
                        .align(Some(IntegerAttribute::new(
                            IntegerType::new(context, 64).into(),
                            inner_layout.align() as i64,
                        )))
                        .elem_type(Some(TypeAttribute::new(inner_ty))),
                ))
                .result(0)?
                .into();

And i dont get the part that you say "and their dependencies".

from cairo_native.

azteca1998 avatar azteca1998 commented on September 27, 2024

Hello,

With llvm.alloca I'm referring to the alloca instructions in the llvm dialect. In MLIR they're written as llvm.alloca, but we have them available as llvm::alloca in Rust.

The llvm.alloca instruction accepts other values as arguments (which are dependencies). In your example, the argument would be value_len. They also need to be on the init block, otherwise the generated MLIR would be invalid.

All llvm.alloca operations must be in the init block instead of entry or whatever other local block every libfunc has. I know there's at least one place where it's not in the init block.

from cairo_native.

Gerson2102 avatar Gerson2102 commented on September 27, 2024

Hello,

With llvm.alloca I'm referring to the alloca instructions in the llvm dialect. In MLIR they're written as llvm.alloca, but we have them available as llvm::alloca in Rust.

The llvm.alloca instruction accepts other values as arguments (which are dependencies). In your example, the argument would be value_len. They also need to be on the init block, otherwise the generated MLIR would be invalid.

All llvm.alloca operations must be in the init block instead of entry or whatever other local block every libfunc has. I know there's at least one place where it's not in the init block.

In the previous example, llvm::alloca and the dependencie, are in the init block right? Because I'm using the helper where is located the init function.

When you say entry, is the variable we use to call init_block() right? And we dont want that, we want the LibFuncHelper, am I right?

from cairo_native.

Gerson2102 avatar Gerson2102 commented on September 27, 2024

Ok. And i have to look through all the code of the project, not just the libfuncs directory?

from cairo_native.

azteca1998 avatar azteca1998 commented on September 27, 2024

Ideally yes, but outside the libfuncs (and a few helper functions I think) you won't have the helper. If you find something outside libfuncs' implementations just letting us know is fine, we'll fix it later.

from cairo_native.

edg-l avatar edg-l commented on September 27, 2024

This is already done

from cairo_native.

Gerson2102 avatar Gerson2102 commented on September 27, 2024

This is already done

In my PR or someone else did this? @edg-l

from cairo_native.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.