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

Automatic function call insertion #523

Draft
wants to merge 48 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
533a19d
wip trace function call
jumerckx Dec 11, 2024
04690e8
multiple return values
jumerckx Dec 12, 2024
180604f
halfway there with caching: new tracemode `CallCache` transforms trac…
jumerckx Dec 12, 2024
caf0e0e
add `enable_tracing` scopedvalue
jumerckx Dec 13, 2024
dbf1dac
wip
jumerckx Dec 13, 2024
d914f04
caching!
jumerckx Dec 13, 2024
670a8c5
add ScopedValues as a dependency
jumerckx Dec 13, 2024
48be2e9
actually use ScopedValues...
jumerckx Dec 13, 2024
ae8701d
properly handle arg and result tracedvalues in `traced_call`
jumerckx Dec 13, 2024
c40e585
don't tranpose results when `do_tranpose=false`
jumerckx Dec 13, 2024
531d1b2
a few tests
jumerckx Dec 14, 2024
f0723e8
CallCache mode: support TracedRNumber
jumerckx Dec 14, 2024
5ead000
one more test
jumerckx Dec 14, 2024
1f05bc9
add Cached object with custom equality and hash for use a dict key
jumerckx Dec 15, 2024
e1852c5
caching test
jumerckx Dec 15, 2024
0cea97a
fix
jumerckx Dec 16, 2024
38e098c
callcache
jumerckx Dec 16, 2024
236babf
add deepcopy to Cached constructor
jumerckx Dec 17, 2024
2c87ddc
`within_tracing`, approach taken from Enzyme.jl
jumerckx Dec 17, 2024
ccb585f
make callcache a default arg
jumerckx Dec 17, 2024
469a2ff
`within_tracing` --> `within_compile`
Dec 22, 2024
84dd0d1
TracedToTypes tracing mode.
jumerckx Jan 1, 2025
39b07c9
remove ScopedValues from Project.toml
jumerckx Jan 2, 2025
af8ac2d
Merge branch 'main' into jm/funccall
jumerckx Jan 10, 2025
739977c
Merge branch 'main' into jm/funccall
jumerckx Jan 13, 2025
a34a228
support broadcasted calls in `@trace`
jumerckx Jan 22, 2025
be583d2
initial attemt at automatic function call tracing
jumerckx Jan 13, 2025
541529d
revert changes to utils
jumerckx Jan 20, 2025
77209af
split make_mlir_fn into pieces
jumerckx Jan 20, 2025
6bae476
insert setup and breakdown around execution of the oc.
jumerckx Jan 21, 2025
7d53410
WIP
jumerckx Jan 21, 2025
a27294e
doesn't cache, and no broadcasting yet (and code cleanup still required)
jumerckx Jan 21, 2025
390b4fd
Merge branch 'main' into jm/funccal_insertion
jumerckx Feb 6, 2025
a509164
fixup merge commit
jumerckx Feb 6, 2025
f082c7a
small fixes
jumerckx Feb 7, 2025
6f078f7
fix mutation handling
jumerckx Feb 9, 2025
f394381
fix more uninitialized tracedrarray construction
jumerckx Feb 11, 2025
e8cd78d
handle make_tracer of memory
jumerckx Feb 11, 2025
6fb74d5
debugging stuff
jumerckx Feb 12, 2025
e07ef73
remove debugging stuff
jumerckx Feb 12, 2025
bfcdd35
move `__lookup_unique_name_in_module` out of `final_func!`
jumerckx Feb 12, 2025
69b9ff0
fix
jumerckx Feb 12, 2025
bf8c7ca
fix
jumerckx Feb 12, 2025
a2619c2
Ops.concat
jumerckx Feb 13, 2025
9cc7c3b
change `_typed_hvncat` implementation.
jumerckx Feb 13, 2025
b01a126
small changes
jumerckx Feb 13, 2025
ba66caa
hackily detect if Ops.call has already executed in make_mlir_fn
jumerckx Feb 16, 2025
2c29d0e
fix everything wrong with `@trace` for calls.
jumerckx Feb 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
caching test
  • Loading branch information
jumerckx committed Jan 2, 2025
commit e1852c5ab94b810ec054ec2b6f6613a527609e19
25 changes: 25 additions & 0 deletions test/control_flow.jl
Original file line number Diff line number Diff line change
@@ -631,3 +631,28 @@ end
@test length(ops) == 5 # call3, .+, .*, _call3 (2X)
end

struct Foo
x
end
struct Bar
x
end

_call4(foobar::Union{Foo, Bar}) = foobar.x
function call4(foo, foo2, bar)
@trace _call4(foo)
@trace _call4(foo2)
@trace _call4(bar)
end

begin
a = rand(10)
b = rand(10)
foo = Foo(Reactant.to_rarray(a))
foo2 = Foo(Reactant.to_rarray(b))
bar = Foo(Bar(Reactant.to_rarray(b))) # typeof(foo) == typeof(bar), but these don't match!
ir = @code_hlo optimize=false call4(foo, foo2, bar)
ops = [op for op in Reactant.MLIR.IR.OperationIterator(Reactant.MLIR.IR.body(ir))]
@test length(ops) == 3 # call4, _call4 for {foo, foo2}, and _call4 for bar
end