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

samples/neohookean: second derivative and samples-loose-types #11

Merged
merged 2 commits into from
Apr 19, 2024

Conversation

jedbrown
Copy link
Collaborator

@ZuseZ4 I spoke too soon about this working. I haven't tried to reduce yet -- there seems to be something between this and higher/mod.rs. If it's not obvious to you, I can work on reducing.

$ cargo +enzyme test
[compiler/rustc_codegen_llvm/src/back/lto.rs:622:9] "running llvm pm opt pipeline" = "running llvm pm opt pipeline"
   Compiling samples v0.1.0 (/home/jed/src/rustbook/samples)
[compiler/rustc_codegen_llvm/src/back/lto.rs:622:9] "running llvm pm opt pipeline" = "running llvm pm opt pipeline"
[compiler/rustc_codegen_llvm/src/back/lto.rs:622:9] "running llvm pm opt pipeline" = "running llvm pm opt pipeline"
source_id: DefId(0:160 ~ mod[ef24]::reverse::forward_and_reverse::f)
source_id: DefId(0:231 ~ mod[ef24]::neohookean::logdet)
source_id: DefId(0:160 ~ mod[ef24]::reverse::forward_and_reverse::f)
source_id: DefId(0:260 ~ mod[ef24]::traits::volumetric::{impl#1}::psi)
source_id: DefId(0:82 ~ mod[ef24]::forward::dual_return::f)
source_id: DefId(0:71 ~ mod[ef24]::forward::empty_return::f)
source_id: DefId(0:146 ~ mod[ef24]::reverse::active_return::f)
source_id: DefId(0:202 ~ mod[ef24]::higher::f)
source_id: DefId(0:223 ~ mod[ef24]::neohookean::psi)
source_id: DefId(0:127 ~ mod[ef24]::reverse::self_duplicated::{impl#0}::f)
source_id: DefId(0:116 ~ mod[ef24]::reverse::active_only::f)
source_id: DefId(0:107 ~ mod[ef24]::reverse::square::square)
source_id: DefId(0:96 ~ mod[ef24]::forward::dual_only_return::f)
source_id: DefId(0:188 ~ mod[ef24]::higher::df2)
source_id: DefId(0:116 ~ mod[ef24]::reverse::active_only::f)
source_id: DefId(0:96 ~ mod[ef24]::forward::dual_only_return::f)
source_id: DefId(0:225 ~ mod[ef24]::neohookean::stress_enz)
source_id: DefId(0:171 ~ mod[ef24]::second::forward_of_reverse::f)
source_id: DefId(0:135 ~ mod[ef24]::reverse::empty_return::f)
source_id: DefId(0:176 ~ mod[ef24]::second::forward_of_reverse::g)
num_fnc_args: 2
input_activity.len(): 2
num_fnc_args: 2
input_activity.len(): 2
num_fnc_args: 1
input_activity.len(): 1
num_fnc_args: 1
input_activity.len(): 1
num_fnc_args: 2
input_activity.len(): 2
num_fnc_args: 2
input_activity.len(): 2
num_fnc_args: 1
input_activity.len(): 1
num_fnc_args: 2
input_activity.len(): 2
num_fnc_args: 1
input_activity.len(): 1
num_fnc_args: 1
input_activity.len(): 1
num_fnc_args: 1
input_activity.len(): 1
error: /home/jed/src/rust-enzyme/library/core/src/num/mod.rs:1269:5: in function preprocess__ZN49_$LT$usize$u20$as$u20$core..iter..range..Step$GT$17forward_unchecked17hc80983b215786c3dE i64 (i64, i64): Enzyme: ; Function Attrs: inlinehint mustprogress nonlazybind sanitize_hwaddress willreturn uwtable
define internal i64 @"preprocess__ZN49_$LT$usize$u20$as$u20$core..iter..range..Step$GT$17forward_unchecked17hc80983b215786c3dE"(i64 %0, i64 %1) unnamed_addr #95 !dbg !386152 {
  call void @llvm.dbg.value(metadata i64 %0, metadata !17207, metadata !DIExpression()), !dbg !386156
  call void @llvm.dbg.value(metadata i64 %0, metadata !386154, metadata !DIExpression()), !dbg !386158
  call void @llvm.dbg.value(metadata i64 %1, metadata !17212, metadata !DIExpression()), !dbg !386156
  call void @llvm.dbg.value(metadata i64 %1, metadata !386155, metadata !DIExpression()), !dbg !386158
  %3 = add nuw i64 %0, %1, !dbg !386159
  ret i64 %3, !dbg !386160
}

 constantarg[i64 %0] = 0 type: {} - vals: {}
 constantarg[i64 %1] = 1 type: {[-1]:Integer} - vals: {1,}
 constantinst[  call void @llvm.dbg.value(metadata i64 %0, metadata !17207, metadata !DIExpression()), !dbg !386156] = 1 val:1 type: {}
 constantinst[  call void @llvm.dbg.value(metadata i64 %0, metadata !386154, metadata !DIExpression()), !dbg !386158] = 1 val:1 type: {}
 constantinst[  call void @llvm.dbg.value(metadata i64 %1, metadata !17212, metadata !DIExpression()), !dbg !386156] = 1 val:1 type: {}
 constantinst[  call void @llvm.dbg.value(metadata i64 %1, metadata !386155, metadata !DIExpression()), !dbg !386158] = 1 val:1 type: {}
 constantinst[  %3 = add nuw i64 %0, %1, !dbg !1358] = 0 val:0 type: {}
 constantinst[  ret i64 %3, !dbg !1359] = 1 val:1 type: {}
cannot handle unknown binary operator:   %3 = add nuw i64 %0, %1, !dbg !1358


error: could not compile `samples` (test "mod")

@ZuseZ4
Copy link
Member

ZuseZ4 commented Apr 17, 2024

I think you just forgot the Enzyme_LOOSE_TYPES env variable, about which we've been chatting.

@jedbrown jedbrown force-pushed the neohookean-second branch from 5a7207a to a63a3cb Compare April 18, 2024 16:43
@jedbrown jedbrown changed the title WIP: samples/neohookean: second derivative samples/neohookean: second derivative and samples-loose-types Apr 18, 2024
@jedbrown
Copy link
Collaborator Author

I think this can be merged now, and will be used by EnzymeAD/rust#117

@ZuseZ4
Copy link
Member

ZuseZ4 commented Apr 19, 2024

thanks for splitting it up!

@ZuseZ4 ZuseZ4 merged commit 7d2e09b into main Apr 19, 2024
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.

2 participants