Using instregex for simple instruction opcode is much slower than
instrs. This patch replaces them with instrs.
Github issue: 35303
Paths
| Differential D137841
[X86] Reduce unnecessary instregex for AlderlakeP schedule model ClosedPublic Authored by HaohaiWen on Nov 11 2022, 7:09 AM.
Details Summary Using instregex for simple instruction opcode is much slower than Github issue: 35303
Diff Detail
Event TimelineComment Actions @RKSimon , you can compare diff of patch1 and patch2 to see what changed for instregex. Comment Actions All I'm actually requiring is that the instregex that end in "_Int$" are replaced with (_Int)?$ Comment Actions
I have converted something like instregex "^SHA1MSG2rr$" to nstrs SHA1MSG2rr. _Int version is not CodeGenOnly but the same prefix instruction without _Int is usually CodeGenOnly. @RKSimon , If you need a quick fix for _Int issue, please feel free to modify this schedule model. I will auto gen a new model after solving this problem. Comment Actions Thanks - the instregex -> instrs diffs LGTM Do you have any suggestions for scheduler classes that we could add/change to help reduce the number of overrides? After finishing my cleanup of the the conversions I want to look at the old x86 (not BMI) shift / rotate instructions are they aren't setup properly for RMW etc. Have you noticed anything else? This revision is now accepted and ready to land.Nov 11 2022, 9:08 AM Closed by commit rG8b3f7833e0d2: [X86] Reduce unnecessary instregex for AlderlakeP schedule model (authored by HaohaiWen). · Explain WhyNov 11 2022, 8:32 PM This revision was automatically updated to reflect the committed changes. Comment Actions
schedtool has tried to reuse same WriteRes and minimize the amount of extra SchedWriteRes. 1. Manually pre associate some schedwrite to it resources so that for each instruction, there's at most 1 schedule write that haven't been associated with resources. 2. For each schedule write that haven’t been associated with schedule resources 2.1 Find out instructions which use it as part of default schedule write. 2.2 For each instruction, infer Latency, NumMicroOps, Ports so that if this instruction finally use this default schedwrite, then it will get same Lat/NumMicroOps/Ports as we provided in input json. 2.3 Find out which schedwrite parameters is the most common one and set this to it. 3. For rest instructions, since they can’t get correct result with default schedwrite, we need to create a new schedule write, associate it with correct resources, and use InstRW replace instructions main schedwrite with it. Does overrides have side effect than default one? I think It's not easy to modify default schedreadwrite since it is used by all X86 schedule modes. If we want to change default schedreadwrite to another one, then we may need to update X86 schedmodels.
I didn't notice this carefully.
Revision Contents
Diff 474916 llvm/lib/Target/X86/X86SchedAlderlakeP.td
|