When modeling vector WriteRes, there are some fields that we can
specify to model its costs like Latency, ResourceCycles, etc.
For Latency, it may not be relevant to LMUL with mechanisms like
chaining[1].
But for ResourceCycles, it may be different. The cycles of some
resources can be relevant to LMUL. For example, the generation and
issuing of uops.
In this patch, we add two new template parameter latency and
resourceCycles. The latency is a function that accepts LMUL and
SEW and returns cycles. The resourceCycles is a list of such
function, each presents the cycles of resource.
We provide pre-defined function fixed that returns a function who
returns fixed-value to model latency/resources which are not relevant
to LMULs. User may definde their own functions according to their
processor model.
References:
[1] Chaining (vector processing)
When we call latency("WorstCase") and resourceCycle("WorstCase"), we're treating WorstCase as an LMUL value since we're passing it as the parameter that is used to pass LMUL. The last few changes to this file have aimed to move away from this by trying to have WorstCase mean worst case SchedWrite, not mean worst case LMUL.
We still need to get the Latency and ResourceCycles for the worst case WriteRes though, and it would make sense to get it from this list. I thought about a solution where we pass a boolean parameter which signifies to return the WorstCase value:
However, calling latency(true) feels worst than calling latency("WorstCase"). It also makes the body of the lambda messier. As a result, I am willing to concede to passing WorstCase` to these functions as the LMUL parameter. Curious if anyone has any input here.