Comments (4)
make
A makefile might be a good idea to simplify using the cmake commands. (Especially since the lit commands as described in the documentation do not work me right now).
from thorin2.
I think I identified the problem:
The code produced after ds2cps (before the failing cps2ds pass) is:
.lam Uf_54920 _54941: «2; %math.F (52, 11)»: ★ = {
.Idx 2
};
.con _cps_54993 _54994::[_54998: «2; %math.F (52, 11)», _54996: .Cn .Idx 2]@(0:(.Idx 2)) = {
.let _54999: .Idx 2 = %core.bitcast «2; %math.F (52, 11)» .Idx 2 _54998;
_54996 _54999
};
.lam eta__54897 _55002: «2; %math.F (52, 11)»: .Idx 2 = {
%direct.cps2ds_dep («2; %math.F (52, 11)», Uf_54920) _cps_54993 _55002
};
.lam eta__55004 _55005: «2; %math.F (52, 11)»: .Idx 2 = {
%direct.cps2ds_dep («2; %math.F (52, 11)», Uf_54920) _cps_54993 _55005
};
.con .extern stuff ... = {
...
.let _55110: %mem.M = %bug.map_reduce 1 ‹2; (4, (1, 2, 15, 15), (%math.F (52, 11), 0:(%math.F (52, 11)), 4607182418800017408:(%math.F (52, 11)), %math.abs (52, 11) 0, eta__54897, eta__55004))› apply_55089 (_55104#0:(.Idx 2), _55104#1:(.Idx 2), _55104#1:(.Idx 2));
return_54864 _55110
};
(Side note: eta__54897 and eta__55004 look like they should be unified as equal.)
The call to _cps_54993
is now tackled by cps2ds.
This is done (similar to the fun stuff) by calling it in cps with continuations for the rest.
Therefore, the body of eta__55004
is replaced by _cps_54993 ...
.
This, however, results in the type error above.
The issue lies in the assumptions of the pass:
As direct style functions can not generate code, all functions should fall into three categories:
- Lowered by ds2cps into a cps function (that is just wrapped into a cps2ds call at its old position)
- statically resolvable
- higher order function that ends in a cps function
eta__54897
is used a as higher order argument contradicting these assumptions.
from thorin2.
A makefile might be a good idea to simplify using the cmake commands. (Especially since the lit commands as described in the documentation do not work me right now).
Reproducing bugs is a major pain and one of the reasons, I'm not pursuing them as tenaciously as I should. I should open an issue to ease the process. Basically by providing a bunch of scripts and you only have to press one button to reproduce a bug. That would definitely help a lot (Edit: see #224).
(Side note: eta__54897 and eta__55004 look like they should be unified as equal.)
Rn, Thorin doesn't have a reason to unify them. If you had (eta__54897, eta__55004)
, we would hopefully see ‹2; eta__54897›
. If we want to get rid of duplicates more aggressively, we would need a proper GVN or so.
Coming to the actual issue:
It seems to me, the real solution here, would be to detect this and throw an appropriate error message to notify anyone running into this issue, what needs to be done to fix this. There are a couple problems like this with several passes/phases within Thorin that make some implicit assumptions and will silently crash, if these are not met.
from thorin2.
b398b7d warns if direct style functions remain and ignores them.
The example now goes through without crashing.
Although it will crash during llvm code generation.
(No fix is suggested as there is not one way to resolve all possible cases (e.g. non-callee direct style functions))
from thorin2.
Related Issues (20)
- Code generation for floating point casts HOT 2
- Scheduler returns wrong position dynamically
- Automatic Dialect Loading HOT 4
- Shadowing for variables HOT 1
- Association Dialect HOT 4
- Application Error with matching domain HOT 7
- Grammar Improvements HOT 1
- Add mem problem with dependent types
- Add mem adds too many mems HOT 2
- Backend Preparation: Nested Extract Splitting
- Float Infer Unification Issue
- Reshape phase messes up types
- Matrix map_reduce: missing token for extractvalue in generated llvm code HOT 4
- one button to reproduce them all
- Parametrized packs fail for arity <= 1
- %affine.For breaks without scalerize pass HOT 2
- Invalid intermediate code HOT 3
- `%core.wrap.sub nuw (a, 1:(.Idx n))` incorrectly normalizes to `%core.wrap.add nuw (a, n - 1)`
- cps2ds sometimes introduces ownerless Vars HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thorin2.