-
Notifications
You must be signed in to change notification settings - Fork 6
560 alp reference sort primitive #113
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
560 alp reference sort primitive #113
Conversation
include/alp/reference/blas1.hpp
Outdated
| const Vector< ValueType, ValueStructure, Density::Dense, ValueView, ValueImfR, ValueImfC, reference > &toSort, | ||
| Compare cmp | ||
| //PHASE &phase = EXECUTE | ||
| CompareType cmp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can there be one version of sort with default cmp = less_then ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be addressed soon by allowing a single variant of the function which always expects a poset/total order.
81f3cc4 to
c29a452
Compare
7b56fcb to
3722ad2
Compare
|
Based on previous discussion I've added a first draft of an ALP relation concept including few basic cases directly usable with alp::sort. Possible items of discussion/review:
|
3ae3ce3 to
7315f18
Compare
djelovina
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also update (if needed)
| // permutations which sort dtmp |
| }; | ||
|
|
||
| /** | ||
| * Used to inspect whether a given type is an ALP relation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider replacing "Used to inspect" -> "Inspects".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem with this. Should we adapt all surrounding docs as well? Just to keep the wording similar across the header.
One question here, btw: could a relation be an interpretation of said binary operator, thus potentially preventing duplication? (E.g., the less-than relation could "wrap" around the less-than operator?) |
anyzelman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more minor additional comment, while not duplicating existing review comments:) Looking great!
I think it is ok to do it in this branch. |
I think this could be a possibility for relations that have similar assumptions on the existence of their respective c++ operators. Assumes native availability of \a operator> on the given data types to something like Assumes availability of ALP operator \a less_than forming a strict total order on SET This way we could decide the best way to wrap around. Eg, the On the pros side, I think it would be a way to rely on a single apply logic when this exists. Still the dependence on the existence of an operator would not be strictly enforced, allowing if needed/desired the definition of relations not based on any particular operator (eg, I could decide to create a relation, perhaps with no properties at all, where I could literally enumerate a subset of Perhaps on the cons side, we would always have to allocate a variable for the boolean output Does this make sense? |
Yeah I think that makes sense. The other advantage is that all of the ALP operator mechanics get inherited -- auto-vectorisation (if ever applicable), but also operator overloads to specific backends (e.g., Banshee/Snitch). The allocation of a boolean -- yes and no: a place for it is required, but it need not be dynamically allocated, it goes on the stack? Like |
anyzelman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok for me, pending perhaps the dependence of relations on operators issue
Correct we would use stack memory there. And I agree the compiler might optimize things anyway given that they are very short (inline-able) function calls. OK I think I'll try wrapping around existing operators (equal/not-equal if I am not mistaken) before merging into 303 and later if we are OK with it we could also add missing operators. |
…ex >, use alp::sort in symm_tridiag_dac_eigensolver algorithm.
…equal only for now)
bcc21a2 to
fdc7f48
Compare
PR for introducing iterator-based (vector) sort primitive. Its use in existing algorithms will follow with a separate PR.