Add FuncVec convenience type - #9387
Conversation
| std::vector<Halide::Func> func_vector(const std::string &name, int size) { | ||
| std::vector<Halide::Func> funcs; | ||
| for (int i = 0; i < size; i++) { | ||
| funcs.emplace_back(Halide::Func{name + "_" + std::to_string(i)}); |
There was a problem hiding this comment.
What do you think about: name + "[" + std::to_string(i) + "]"
There was a problem hiding this comment.
I'm not sure what [ would do in a Func name.
There was a problem hiding this comment.
I think I prefer to keep f0, f1, ..., fN rather than burn two characters (on []) of std::string's short-string optimizations.
There was a problem hiding this comment.
I think [ eventually gets legalized into ___ (three underscoeres)
except if the Func is used as an input/output generator, in which case it gets rejected. Seems safer to avoid [.
There was a problem hiding this comment.
I really like e.g. gPyramid[3] because it reads way better in the profiler output and corresponds more closely to source code. That's what I've been using locally.
There was a problem hiding this comment.
If we hard-reject it for output funcs though, that seems decisive
There was a problem hiding this comment.
How about this: Have the constructor also take an optional suffix string. Right now it's a prefix string and a count. If it had a suffix too I could just say:
FuncVec v("foo[", 17, "]");
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## alexreinking/rfactor-hoisting #9387 +/- ##
==============================================================
Coverage 70.06% 70.06%
==============================================================
Files 261 261
Lines 79471 79483 +12
Branches 19379 19382 +3
==============================================================
+ Hits 55683 55693 +10
+ Misses 17913 17911 -2
- Partials 5875 5879 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
1ebb1b7 to
8ed11d4
Compare
Add a FuncVec type that decays to Func in the n=1 case. This:
Func output = pipeline.outputs()when you know that your pipeline is single-output.apps/changes.Breaking changes
None — the FuncVec type inherits from std::vector without adding state.
Checklist
Stack created with GitHub Stacks CLI • Give Feedback 💬