Stephen Fuld <sfuld@alumni.cmu.edu.invalid> posted:
My original proposal allows you to execute one instruction based on the
value in a register, i.e. if the register contains the value 3, then the
third instruction is the only one executed. The enhanced version allows
more flexibility. For example, you could allow to specify execute all
instructions up to the number in the register. As I said, while the use
case for the basic instruction is clear, emulating register indexing, I
am not sure there are any use cases for the enhancement.
Not sure what the source code would look like in order for the compiler
to recognize this pattern and optimize to your solution.
Stefan Monnier <monnier@iro.umontreal.ca> posted:
But instead of skipping, You can "predicate away" the undesirableIf the predicated instructions are used in at least 1 iteration, they
instructions. So, in sum, I think what you describe can be made to
work. The main problem is that it will "fill" your dataflow core with
many "useless" instructions, so it risks making the whole loop too large
for vVM and it risks also making it inefficient (in case all
N instructions end up speculatively executed and the predication
operates by throwing away N-1 of the values).
are not useless.
MitchAlsup [2026-05-29 16:55:38] wrote:
Stefan Monnier <monnier@iro.umontreal.ca> posted:
But instead of skipping, You can "predicate away" the undesirableIf the predicated instructions are used in at least 1 iteration, they
instructions. So, in sum, I think what you describe can be made to
work. The main problem is that it will "fill" your dataflow core with
many "useless" instructions, so it risks making the whole loop too large >>> for vVM and it risks also making it inefficient (in case all
N instructions end up speculatively executed and the predication
operates by throwing away N-1 of the values).
are not useless.
They may not be useless overall, but they still waste resources at each iteration where they're not used. Traditional predication of an `if`
gives a "50% waste" (for equal size branches or when each branch is
taken as often as the other), whereas a predicated `switch` results in
a waste of `N-1/N`. As N grows larger this becomes discouraging.
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,126 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 50:03:37 |
| Calls: | 14,414 |
| Calls today: | 2 |
| Files: | 186,400 |
| D/L today: |
10,397 files (2,824M bytes) |
| Messages: | 2,548,892 |
| Posted today: | 1 |