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

plugin system #146

Draft
wants to merge 53 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
5488cc8
Support plugin execution. Very limited capabilities for now.
m-kurtenacker Jan 31, 2023
0e1b609
Support for multiple input arguments.
m-kurtenacker Jul 28, 2022
3f0f38d
Use RTLD_GLOBAL to enable loading dependent plugins.
m-kurtenacker Sep 13, 2022
21e090e
Add plugin dependencies + option to return values from plugin intrins…
m-kurtenacker Sep 30, 2022
eaf6b75
Partial Evaluation between plugin steps.
m-kurtenacker Jan 20, 2023
da72529
Implement world.release to emit anydsl_release calls in backend, similar
m-kurtenacker Jun 23, 2023
5d2c468
Bugfix: llvm 14 needs pointer cast for release.
m-kurtenacker Jun 26, 2023
59aa49f
Fix MSVC build by disabling plugins
stlemme Jun 27, 2023
c706d3a
use proper CMAKE_DL_LIBS variable
stlemme Jun 27, 2023
a3d9092
Support return nullptr in plugins for void returns.
m-kurtenacker Jun 29, 2023
4d5b1b8
pass World and App to plugin function
michael-kenzel Jul 4, 2023
aea8051
Make plugins explicitly return a Def* to avoid UB.
m-kurtenacker Jul 5, 2023
986dc96
Do not const_cast the app node, use rebuild and replace_uses instead.
m-kurtenacker Jul 5, 2023
dd51c17
Gather plugins without copying continuations.
m-kurtenacker Jul 5, 2023
84fe231
Clearification on app nodes and world.cleanup().
m-kurtenacker Jul 5, 2023
c4423a0
Change plugin sorting comparisson to be asymetric.
m-kurtenacker Jul 5, 2023
3d73ba6
Do not build nvvm in debug mode. It produces broken ptx in some cases.
m-kurtenacker Apr 19, 2024
a81f7fc
Support plugin execution. Very limited capabilities for now.
m-kurtenacker Jan 31, 2023
51a0ae0
Support for multiple input arguments.
m-kurtenacker Jul 28, 2022
aa74f03
Use RTLD_GLOBAL to enable loading dependent plugins.
m-kurtenacker Sep 13, 2022
7d37d32
Add plugin dependencies + option to return values from plugin intrins…
m-kurtenacker Sep 30, 2022
4aed9b0
Partial Evaluation between plugin steps.
m-kurtenacker Jan 20, 2023
df0ceac
Implement world.release to emit anydsl_release calls in backend, similar
m-kurtenacker Jun 23, 2023
d4c4e13
Bugfix: llvm 14 needs pointer cast for release.
m-kurtenacker Jun 26, 2023
e6cb977
Fix MSVC build by disabling plugins
stlemme Jun 27, 2023
afb7d63
use proper CMAKE_DL_LIBS variable
stlemme Jun 27, 2023
6c704f0
Support return nullptr in plugins for void returns.
m-kurtenacker Jun 29, 2023
e45ae79
pass World and App to plugin function
michael-kenzel Jul 4, 2023
471d80b
Make plugins explicitly return a Def* to avoid UB.
m-kurtenacker Jul 5, 2023
8455787
Do not const_cast the app node, use rebuild and replace_uses instead.
m-kurtenacker Jul 5, 2023
807592e
Gather plugins without copying continuations.
m-kurtenacker Jul 5, 2023
1eebe0d
Clearification on app nodes and world.cleanup().
m-kurtenacker Jul 5, 2023
0c37e8d
Change plugin sorting comparisson to be asymetric.
m-kurtenacker Jul 5, 2023
d99f07c
Json: Export plugins and plugin dependencies.
m-kurtenacker Jan 20, 2023
968114c
[Json]: Export filters on plugins without dependencies.
m-kurtenacker Jan 20, 2023
20ab0c6
Plugin execution order: total ordering by calculating dependency depth.
m-kurtenacker Sep 4, 2023
4eb19d5
Bugfix Plugins: Work with new semantics for thorin.cleanup.
m-kurtenacker Oct 6, 2023
b44fbe4
Small improvements for internal continuations. Probably still buggy.
m-kurtenacker Nov 21, 2023
b345444
dump_scoped: Dump filters.
m-kurtenacker Nov 21, 2023
3ffeb3b
Fix handling and emission of external globals.
m-kurtenacker Dec 6, 2023
3c25ecc
Small bugfix in PE for multiple stacked run operations.
m-kurtenacker Dec 12, 2023
e3f8e45
Bugfix if no process can be made in plugin execution.
m-kurtenacker Dec 12, 2023
366f6b3
[JSON] Add support for inf and nan floating point.
m-kurtenacker Jan 19, 2024
63498d2
Some small changes to support edge cases created in certain plugins.
m-kurtenacker Feb 13, 2024
f4ef1d3
Allow disabling collored scoped_dump through environment variable.
m-kurtenacker Mar 19, 2024
417d8f3
WIP: evaluate plugins during PE, not after.
m-kurtenacker Mar 19, 2024
f4e655f
Improve plugin dependency management, allow filters with intrinsics.
m-kurtenacker Mar 27, 2024
138b6f4
Exceptions in plugins added back in.
m-kurtenacker Mar 28, 2024
2776537
Added Thorin::cleanup_fix_point as a less intrusive cleanup option.
m-kurtenacker Mar 28, 2024
a4c8aa0
Do not destroy external continuations during PE.
m-kurtenacker Apr 19, 2024
bf48e92
Merge remote-tracking branch 'origin/plugins' into plugins
m-kurtenacker Jun 20, 2024
50f60fd
Merge branch 'master' into plugins
m-kurtenacker Jun 24, 2024
53e3a87
Fix todo flag handling with plugins. Plugins can now return bottom.
m-kurtenacker Jul 24, 2024
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
Fix todo flag handling with plugins. Plugins can now return bottom.
  • Loading branch information
m-kurtenacker committed Jul 25, 2024
commit 53e3a87b7cc3775ee8c7641e61606b09198ee53a
18 changes: 15 additions & 3 deletions src/thorin/transform/partial_evaluation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ bool PartialEvaluator::run() {
queue_.push(const_cast<Continuation*>(cont));
}
}
todo = true;
continue;
}
}
Expand All @@ -171,6 +170,9 @@ bool PartialEvaluator::run() {
}
}

if (not body->arg(body->num_args() - 1)->isa<Continuation>())
fold = false; //Cannot execute plugin if the target is not a continuation.

if (fold) {
std::vector<const Def*> specialize(body->arg(body->num_args() - 1)->as<Continuation>()->num_params());
specialize[0] = body->arg(0);
Expand All @@ -189,6 +191,17 @@ bool PartialEvaluator::run() {
}

const Def* output = plugin_function(&world(), body);
if (output->isa<Bottom>()) { //The plugin cannot produce an output, but we should run another iteration.
world().ddef(continuation, "Plugin did not produce a usable output: {}", callee);
for (auto arg : body->args()) {
if (auto cont = arg->isa<Continuation>()) {
queue_.push(const_cast<Continuation*>(cont));
}
}
todo = true;
continue;
}

if (output)
specialize[1] = output;

Expand All @@ -197,14 +210,13 @@ bool PartialEvaluator::run() {
}

continuation->jump(target, specialize);
} catch (const std::runtime_error& e) {
} catch (const std::runtime_error& e) { //The plugin is unhappy about the general state. We should not use it to determine the fixed-point state.
std::cerr << "Error in plugin function: " << e.what() << "\n";
for (auto arg : body->args()) {
if (auto cont = arg->isa<Continuation>()) {
queue_.push(const_cast<Continuation*>(cont));
}
}
todo = true;
continue;
}

Expand Down