Skip to content

could not statically determine size of realloc #39

Closed
@ZuseZ4

Description

@ZuseZ4
#![feature(bench_black_box)]
use autodiff::autodiff;
use std::ptr;

#[autodiff(sin_vec, Reverse, Active)]
fn cos_vec(#[dup] x: &Vec<f32>) -> f32 {
    // uses enum internally and breaks
    let res = x.into_iter().collect::<Vec<&f32>>();

    *res[0]
}

fn main() {
    let x = vec![1.0, 1.0, 1.0];
    let mut d_x = vec![0.0; 3];

    sin_vec(&x, &mut d_x, 1.0);

    dbg!(&d_x, &x);
}
updating analysis of val:   %37 = tail call noundef ptr @__rust_alloc(i64 noundef %2, i64 noundef %1) #105 current: {[-1]:Pointer} new {[-1]:Pointer} from   %37 = tail call noundef ptr @__rust_alloc(i64 noundef %2, i64 noundef %1) #105 Changed=0 legal=1
analyzing function preprocess___rust_realloc
 + knowndata: ptr %0 : {} - {}
 + knowndata: i64 %1 : {} - {}
 + knowndata: i64 %2 : {} - {}
 + knowndata: i64 %3 : {} - {}
 + retdata: {[-1]:Pointer}
updating analysis of val: ptr %0 current: {} new {} from ptr %0 Changed=0 legal=1
updating analysis of val: i64 %1 current: {} new {} from i64 %1 Changed=0 legal=1
updating analysis of val: i64 %2 current: {} new {} from i64 %2 Changed=0 legal=1
updating analysis of val: i64 %3 current: {} new {} from i64 %3 Changed=0 legal=1
updating analysis of val: ptr %0 current: {} new {} from ptr %0 Changed=0 legal=1
updating analysis of val: i64 %1 current: {} new {} from i64 %1 Changed=0 legal=1
updating analysis of val: i64 %2 current: {} new {} from i64 %2 Changed=0 legal=1
updating analysis of val: i64 %3 current: {} new {} from i64 %3 Changed=0 legal=1
updating analysis of val:   %5 = tail call ptr @__rdl_realloc(ptr %0, i64 %1, i64 %2, i64 %3) #105 current: {} new {[-1]:Pointer} from   %5 = tail call ptr @__rdl_realloc(ptr %0, i64 %1, i64 %2, i64 %3) #105 Changed=1 legal=1
updating analysis of val:   %5 = tail call ptr @__rdl_realloc(ptr %0, i64 %1, i64 %2, i64 %3) #105 current: {[-1]:Pointer} new {[-1]:Pointer} from   %5 = tail call ptr @__rdl_realloc(ptr %0, i64 %1, i64 %2, i64 %3) #105 Changed=0 legal=1
 starting IPO of   %5 = tail call ptr @__rdl_realloc(ptr %0, i64 %1, i64 %2, i64 %3) #105
 ending IPO of   %5 = tail call ptr @__rdl_realloc(ptr %0, i64 %1, i64 %2, i64 %3) #105
 updating ptr %0 = {}  via IPO of   %5 = tail call ptr @__rdl_realloc(ptr %0, i64 %1, i64 %2, i64 %3) #105 arg ptr %0
updating analysis of val: ptr %0 current: {} new {} from   %5 = tail call ptr @__rdl_realloc(ptr %0, i64 %1, i64 %2, i64 %3) #105 Changed=0 legal=1
 updating i64 %1 = {}  via IPO of   %5 = tail call ptr @__rdl_realloc(ptr %0, i64 %1, i64 %2, i64 %3) #105 arg i64 %1
updating analysis of val: i64 %1 current: {} new {} from   %5 = tail call ptr @__rdl_realloc(ptr %0, i64 %1, i64 %2, i64 %3) #105 Changed=0 legal=1
 updating i64 %2 = {[-1]:Integer}  via IPO of   %5 = tail call ptr @__rdl_realloc(ptr %0, i64 %1, i64 %2, i64 %3) #105 arg i64 %2
updating analysis of val: i64 %2 current: {} new {[-1]:Integer} from   %5 = tail call ptr @__rdl_realloc(ptr %0, i64 %1, i64 %2, i64 %3) #105 Changed=1 legal=1
 updating i64 %3 = {[-1]:Integer}  via IPO of   %5 = tail call ptr @__rdl_realloc(ptr %0, i64 %1, i64 %2, i64 %3) #105 arg i64 %3
updating analysis of val: i64 %3 current: {} new {[-1]:Integer} from   %5 = tail call ptr @__rdl_realloc(ptr %0, i64 %1, i64 %2, i64 %3) #105 Changed=1 legal=1
updating analysis of val:   %5 = tail call ptr @__rdl_realloc(ptr %0, i64 %1, i64 %2, i64 %3) #105 current: {[-1]:Pointer} new {[-1]:Pointer} from   %5 = tail call ptr @__rdl_realloc(ptr %0, i64 %1, i64 %2, i64 %3) #105 Changed=0 legal=1
error: <unknown>:0:0: in function preprocess___rdl_realloc ptr (ptr, i64, i64, i64): Enzyme: could not statically determine size of realloc   %23 = tail call noundef ptr @realloc(ptr noundef %0, i64 noundef %3) #107 - because of - ptr %0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions