Date: Sat, 21 Sep 2019 21:37:09 +0300
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1609r1.html
First, this would be very useful to me. There is a class of servers,
which includes databases, that need to serve a wide variety of queries.
There queries involve processing an interpreted language, and so have a
high abstraction cost: copying, comparators, arithmetic operators all
involve virtual calls, and all must be prepared for the most complex
data types. It is not feasible to specialize these queries ahead of time
as every user has their own schema and their own queries.
My feedback:
1. Although it is implied, I would like it to be explicit that non-type
template parameters of class type are legitimate run-time template
parameters for jit. For example, I'd like an expression class that
defines some expression to be evaluated, and then
template <expression e>
[[jit]]
value evaluate(std::vector<value> inputs) {
...
}
would allow me to specialize evaluation at runtime. `expression` would
be a tree-type object including nested expression objects, so it would
need the full power of C++2a constexpr containers.
2. The proposal asks whether the jit indicator should be in the
declaration, or point of use. I believe it should be at the point of
use. This would allow using a type-erased version of the template
function compiled ahead of time, while some other thread invokes the jit
compiler and waits for compilation to complete. Or perhaps, the server
would only compile the function after the type-erased version has been
executed a sufficient amount of times to warrant jit. This also allows
limiting server memory allocated to jit functions.
3. Some mechanism should be allocated to ask how much memory a jit
function uses, and to allow unlinking and deallocating a jit function
after it is no longer used.
Thanks for the proposal! I hope it makes it into C++23 or even some
earlier technical specification.
First, this would be very useful to me. There is a class of servers,
which includes databases, that need to serve a wide variety of queries.
There queries involve processing an interpreted language, and so have a
high abstraction cost: copying, comparators, arithmetic operators all
involve virtual calls, and all must be prepared for the most complex
data types. It is not feasible to specialize these queries ahead of time
as every user has their own schema and their own queries.
My feedback:
1. Although it is implied, I would like it to be explicit that non-type
template parameters of class type are legitimate run-time template
parameters for jit. For example, I'd like an expression class that
defines some expression to be evaluated, and then
template <expression e>
[[jit]]
value evaluate(std::vector<value> inputs) {
...
}
would allow me to specialize evaluation at runtime. `expression` would
be a tree-type object including nested expression objects, so it would
need the full power of C++2a constexpr containers.
2. The proposal asks whether the jit indicator should be in the
declaration, or point of use. I believe it should be at the point of
use. This would allow using a type-erased version of the template
function compiled ahead of time, while some other thread invokes the jit
compiler and waits for compilation to complete. Or perhaps, the server
would only compile the function after the type-erased version has been
executed a sufficient amount of times to warrant jit. This also allows
limiting server memory allocated to jit functions.
3. Some mechanism should be allocated to ask how much memory a jit
function uses, and to allow unlinking and deallocating a jit function
after it is no longer used.
Thanks for the proposal! I hope it makes it into C++23 or even some
earlier technical specification.
Received on 2019-09-21 13:39:22