-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simpler treatment of variadic operands with zero occurrences in Rewri…
…teToCallKernelOpPass. - Some DaphneIR operations have variadic operands, i.e., operands which can occur an arbitrary number of times (including zero). - When lowering DaphneIR operations to the DaphneIR CallKernelOp, this poses a problem as the C++ kernels cannot be pre-compiled for any number of operands. - Thus, the kernels expect an array of operands (pointer plus size); in DaphneIR this is represented by a value of type daphne::VariadicPack, which stores all occurrences of a variadic operand. - So RewriteToCallKernelOpPass needs to convert variadic operands of DaphneIR operations to DaphneIR's VariadicPack. - In the past there have been problems in case of variadic operands with zero occurrences. - As GroupOp was the only problematic op so far, a workaround has been provided in PRs #564 and #543. - This commit improves the treatment of variadic operands with zero occurrences in RewriteToCallKernelOpPass: - First, the code is more general now and clearly expresses that this problem is not about GroupOp, but about instances of ops with variadic operands with zero occurrences, in general. - Second, the code for treating individual such ops is significantly simpler and more extensible now, since one only has to provide a default MLIR type for the variadic operand. - Furthermore, a simplified version of the example DaphneDSL code mentioned in issue #562, that failed before PR #564, was added as a test case now.
- Loading branch information
Showing
4 changed files
with
58 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Group with and without aggregation in the same DaphneDSL script. | ||
|
||
f = createFrame([1, 2, 3, 2], "a"); | ||
registerView("f", f); | ||
|
||
res1 = sql("SELECT f.a FROM f GROUP BY f.a;"); | ||
print(res1); | ||
|
||
res2 = sql("SELECT sum(f.a) FROM f GROUP BY f.a;"); | ||
print(res2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Frame(3x1, [f.a:int64_t]) | ||
1 | ||
2 | ||
3 | ||
Frame(3x1, [sum(f.a):int64_t]) | ||
1 | ||
4 | ||
3 |