-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Zimop and Zcmop Extensions #723
base: master
Are you sure you want to change the base?
Conversation
Makes sense. It's a bit hard to follow the flow though... What if you have:
I think that's a lot easier to follow. |
Why do we need all this rather than just having multiple encdec clauses in decreasing precedence order, i.e. compiling Zicfiss before Zimop? |
Good suggestion. That is definitely easier to follow. I think I still prefer |
See previous related discussion here: #538 (comment). The general sense is having different results for the model based on the compilation order seems unnecessarily fragile. Especially as we (hopefully) move to the new module system that makes it easier than ever to include or exclude various files from compilation. |
Hmm. That approach may actually not work after all. Somewhat surprisingly, the error messages come about in the C compilation after sail itself is done.
Seems like it's not able to come up with a backwards function for the mapping. I'll see if I can manually define one that will work, but it may end up being cleaner to have the tiered mappings that are in the current version. |
Hmm could be a Sail compiler bug? Can you make a small reproducible example? Also we may be able to work around it with |
We shouldn't produce any broken C code for Sail code that type-checks, so certainly a bug. Looks like the tree-shaking that we do to prune unused definitions is removing things it shouldn't in this case, I'll try to create a smaller test case. I recently introduced an optimisation that introduces The original idea was to use the order of files to control this. The module system I've been working on makes this more explicit, as you can write explicitly |
Yeah. Seems like if the scattered mapping is empty (which the overrides mappings are in this PR are), then Sail optimizes them away but still leaves the call to them in the other mapping that calls the (now pruned) scattered mapping. I can create a smaller test case if that would be helpful. |
Isn't this overriding better solved by injecting overrides into the generated C zdecode/zexecute? |
Per the TGMM today, we're going to skip the overrides and rely on the upcoming module system that adds support for explicitly declaring module precedence. This is a good balance between the slightly unreliable pure file ordering and the slightly convoluted nested mappings. |
Removed the changes related to overrides. Since we are going to go with the module system, nothing related to that needs to go into this PR and this should be good to review from a purely Zimop/Zcmop perspective. The modules only become relevant when we are ready to implement extensions like Zicfiss. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not looked at the spec but seems reasonable overall
Co-authored-by: Ved Shanbhogue <[email protected]>
This either needs the |
Extracted and updated the
Zimop
andZcmop
extensions from #377.One of the tricky parts with this extension is that it is designed to have its instructions overridden by other extensions (like
Zicfiss
). The implementation in #377 had a function dedicated to Zimop and Zcmop in each of their files that listed which specific instructions were overridden. I'd rather avoid the need to modify this file each time a new extension is added that reuses one of its encodings, so I added new scatteredencdec_overrides
andencdec_compressed_overrides
mappings for this purpose. These mappings are checked first, and only if there is no match does it check the normalencdec
mappings. This allows each new extension (likeZicfiss
andZicflp
) to be self-contained. It also opens the door to properly supporting hints from extensions likeZicbop
andZihintpause
. While the hints don't do anything architecturally, having the correct assembly in the log would still be beneficial.This new mapping can be split out into a separate PR, but I'm introducing it here to clarify the motivation behind it.