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

Add pointer offsetting (add) and intrinsic parsing #125

Merged
merged 1 commit into from
May 9, 2024
Merged

Conversation

edg-l
Copy link
Member

@edg-l edg-l commented May 7, 2024

Added the ability to offset a pointer, this allows us to do the following:

mod HelloWorld {
    pub extern fn malloc(size: u64) -> *mut u8;
    pub extern fn puts(data: *mut u8) -> i32;

    fn main() -> i32 {
        let origin: *mut u8 = malloc(12);
        let mut p: *mut u8 = origin;

        *p = 'H';
        p = p + 1;
        *p = 'e';
        p = p + 1;
        *p = 'l';
        p = p + 1;
        *p = 'l';
        p = p + 1;
         *p = 'o';
        p = p + 1;
         *p = ' ';
        p = p + 1;
         *p = 'W';
        p = p + 1;
         *p = 'o';
        p = p + 1;
         *p = 'r';
        p = p + 1;
         *p = 'l';
        p = p + 1;
         *p = 'd';
        p = p + 1;
        *p = '\0';
        puts(origin);

        return 0;
    }
}

Which prints "Hello World"

Also added the ability to add attributes to functions, and declare intrinsics:

mod MyMod {
    #[intrinsic = "simdsomething"]
    pub extern fn myintrinsic();
}

Copy link

github-actions bot commented May 7, 2024

Benchmarking factorial

Compiling factorial (factorial.con)
Finished release in 30.809279ms
Running 5000000 iterations
Using input value: 20
Concrete Result = 2432902008176640000 Time taken : 59.21 ms
Rust Result = 2432902008176640000 Time taken : 60.24 ms

Benchmarking fib

Compiling fib (fib.con)
Finished release in 26.396626ms
Running 5000 iterations
Using input value: 20
Concrete Result = 6765 Time taken : 135.98 ms
Rust Result = 6765 Time taken : 85.24 ms

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 71.42857% with 20 lines in your changes are missing coverage. Please review.

Project coverage is 61.78%. Comparing base (27904dc) to head (aff819d).

Files Patch % Lines
crates/concrete_codegen_mlir/src/codegen.rs 69.44% 11 Missing ⚠️
crates/concrete_ir/src/lib.rs 0.00% 6 Missing ⚠️
crates/concrete_ir/src/lowering.rs 84.21% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #125      +/-   ##
==========================================
+ Coverage   61.63%   61.78%   +0.15%     
==========================================
  Files          25       25              
  Lines        4329     4394      +65     
==========================================
+ Hits         2668     2715      +47     
- Misses       1661     1679      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@juanbono juanbono added this pull request to the merge queue May 9, 2024
Merged via the queue into main with commit 20cfd8d May 9, 2024
5 checks passed
@juanbono juanbono deleted the ptr_add branch May 9, 2024 16:41
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 this pull request may close these issues.

4 participants