Open wimrijnders opened 6 years ago
Kernel code:
void kernel(Ptr<Int> result) {
Int outIndex = 0;
result[outIndex++] = 0;
// This works, of course
// result[outIndex] = 0;
// outIndex++;
}
Results in compile error:
error: no match for ‘operator[]’ (operand types are ‘QPULib::Ptr<QPULib::Int>’ and ‘void’)
result[outIndex++] = 0;
^
Cond
and BoolExpr
?When scanning their definition in the Library, they are practically identical. Can't they be combined?
I also encountered the following:
struct BoolExpr
{
// Abstract syntax tree
BExpr* bexpr;
// Constructor
BoolExpr(BExpr* b) { bexpr = b; }
// Cast to Cond
//operator Cond(); // <----- THIS commented out
};
This makes good sense to me and would nullify this question. Why is it commented out? Are there issues with it?
This are things I encountered during kernel development.
Operators
Given:
... the following should work:
The first three have alternatives:
...but I personally would truly appreciate it if the initial versions worked. I can sort of understand if you want to have explicit casts, but still.
Conversion of number values to DSL
I would appreciate the possibility to mix constants with DSL variables, for example:
Related, when using generator functions, it would be nice if a Float/Int can be initialized with a (C++) constant, just like with
k.run()
:If
that works likeWhere
I would like to see an
If
-operator that works likeWhere
:This works per vector element; if a given element satisfies the condition, the if-block is executed. Other elements are untouched.
Currently,
Where
only allows assignments and expressions. AnIf
that works analogously, and which allows all statements, would be appreciated.