|
13 | 13 | 1. Other agenda items |
14 | 14 | 1. Further discussion of ISLE, the proposed instruction selector DSL, as outlined in [RFC #15](https://github.com/bytecodealliance/rfcs/pull/15) |
15 | 15 |
|
16 | | -## Notes |
17 | | - |
18 | 16 | ### Attendees |
19 | 17 |
|
| 18 | +* cfallin |
| 19 | +* fitzgen |
| 20 | +* uweigand |
| 21 | +* alexcrichton |
| 22 | +* bjorn3 |
| 23 | +* afonso360 |
| 24 | +* akirilov |
| 25 | +* jlbirch |
| 26 | + |
20 | 27 | ### Notes |
| 28 | + |
| 29 | +#### ISLE |
| 30 | + |
| 31 | +* cfallin - Hoping bbouvier could be here but conflict! Will catch up later. Anyone |
| 32 | + have any concerns to discuss? |
| 33 | +* jlbirch - what were concerns? |
| 34 | +* cfallin - not necessarily as "simple" as what we have right now. Currently |
| 35 | + everything is straightforward to jump in and "see" Rust code. Tracing things |
| 36 | + is easy and you can see what to modify. Also works with IDEs and rust-analyzer |
| 37 | + and other Rust tools. bbouvier wants to preserve this if possible since it's |
| 38 | + open and inviting, minimal knowledge required. Downside is that the benefits |
| 39 | + of the DSL aren't there, fitzgen and I mentioned on thread. There are |
| 40 | + some things we can only do with a DSL such as verification, optimizations, |
| 41 | + refactorings (new regalloc API), ... I think it's also more open and welcoming |
| 42 | + if you can understand the patterns and see them, that way you don't track |
| 43 | + subtle invariants from custom open-coding. More welcoming with custom language |
| 44 | + or to have Rust to read? |
| 45 | +* fitzgen - The goal of the DSL should be to thinking about the domain at hand |
| 46 | + rather than the low-level bits and I think it does a good job of that. If you |
| 47 | + see some lowering is missing adding the new operation should be writing a |
| 48 | + pattern and just focusing on the pattern, not also how it fits into the |
| 49 | + hand-written matcher-trees. With the DSL compiler handling all that it's nice |
| 50 | + that it handles performance (optimized lowering) but you're also just talking |
| 51 | + about the pattern you want to match instead of manually doing the lowering. |
| 52 | +* cfallin - aspect oriented programming anyone? The DSL brings all the little |
| 53 | + things spread throughout the code into one place in the compiler -- raising |
| 54 | + the level of abstraction and not having to worry about doing unsafe or illegal |
| 55 | + things. Understand Ben's concerns though. Anyone else have similar concerns? |
| 56 | +* akirilov - I'm in the middle, leaning towards what you're describing with |
| 57 | + ISLE. |
| 58 | +* jlbirch - Worked on compilers awhile ago! No DSL involved. Mostly with |
| 59 | + bytecodealliance I've seen DSLs. Would ISLE looks similar to the wasm backend |
| 60 | + for v8? |
| 61 | +* cfallin - not familiar with v8, but you/Andrew have described open-coding, is |
| 62 | + that right? |
| 63 | +* jlbirch - looking at a lowering language of some sorts |
| 64 | +* cfallin - link? |
| 65 | +* jlbirch - should be able to compare what we have to v8 and how it's easy to |
| 66 | + look at and dive in. Haven't had experience debugging v8 though and that's |
| 67 | + presumably where the issues come in. |
| 68 | +* cfallin - speaks to a tooling concern and trace what some code becomes and |
| 69 | + why. The output of the DSL should be human readable and should ideally have |
| 70 | + comments for where things came from. Does this in the prototype, not beautiful |
| 71 | + code but still readable. Has comments though and says "this came from ISLE |
| 72 | + line 123". Should be able to step through and see various cases. Maybe higher |
| 73 | + level thing like log/trace to show what was applied? I understand the |
| 74 | + debugging point though, very important. |
| 75 | +* fitzgen - regarding what other compilers do, gcc has its own DSL, LLVM has |
| 76 | + tablegen, Go has a DSL for this sort of thing. ISLE does have unique things |
| 77 | + but this shouldn't be too too foreign. |
| 78 | +* cfallin - "term rewriting system" - studied for awhile -- not to say it's |
| 79 | + automatically easier. Is understood though. |
| 80 | +* jlbirch - Yeah understand it's not too too crazy. Trying to imagine someone |
| 81 | + with no experience in compilers jumping in. |
| 82 | +* cfallin - Trying to prevent bugs that have come in with ISLE preventing things |
| 83 | + from being incorrect. Lots of stuff to worry about today with |
| 84 | + regalloc/metadata/sinking loads/etc. Extra mental state we don't want authors |
| 85 | + to have to carry with ISLE. |
| 86 | +* jlbirch - generally agree |
| 87 | +* cfallin - should catch up with Ben later. Sounds like others agree? |
| 88 | +* akirilov - haven't touched the old backend which seems like it has a somewhat |
| 89 | + similar DSL. Would be good to have a guide for how to add a new instruction. |
| 90 | + Main challenge is that there's no guide right now and would be helpful to |
| 91 | + have. Good to know how to add one instruction and to debug. |
| 92 | +* cfallin - good idea! |
| 93 | +* akirilov - ideally information is close to the project (as opposed to blog |
| 94 | + posts, which are great!) since contributors may not always be aware of |
| 95 | + articles. We have Wasmtime guide with section for contributing? Doesn't cover |
| 96 | + Cranelift though. |
| 97 | +* cfallin - Whole `docs` repo to write stuff into, would be great to do. |
| 98 | +* fitzgen - would be good to have Cranelift-specific book. |
| 99 | +* cfallin - yes! |
| 100 | +* akirilov - should link from the Wasmtime book since it appears at the top of |
| 101 | + the repository. Cranelift should be visible too. |
| 102 | +* cfallin - agreed! Should document new instructions, new lowerings. Could |
| 103 | + probably source from RFCs and such. |
| 104 | +* cfallin - brief mention of progress. The prototype of ISLE exists and they can |
| 105 | + dig into it. Happy to explain more in a call. Nick is going to try to carry |
| 106 | + forward and implement more things end-to-end with polish. Nick? |
| 107 | +* fitzgen - Plan is to get one lowering implemented all the way through with |
| 108 | + ISLE and then try ISLE first in existing lowering, falling back to handwritten |
| 109 | + thing. Afterwards knocking out all the patterns. Probably still a week or so. |
| 110 | + This'll quickly be parallelizable where it's mostly just porting patterns, |
| 111 | + talk to me! |
| 112 | +* jlbirch - will do my homework and reread these issues and will take you both |
| 113 | + up on the offer and plan to help out |
| 114 | +* fitzgen - Looking at pattern -> Rust code translation was very helpful and |
| 115 | + gave me confidence that it's doing what it should do. Confident approach is |
| 116 | + nice and could understand well that what I'm doing maps well. |
| 117 | +* cfallin - any other thoughts on ISLE? |
| 118 | + |
| 119 | + |
| 120 | +#### Endianness |
| 121 | + |
| 122 | +* cfallin - Thank you s390x for making sure we're correct here! Consensus last |
| 123 | + year we have tri-state approach, we have a little/big/native flag on all |
| 124 | + loads/stores. Native important for interacting with the rest of the system. |
| 125 | + Concern that with the interpreter that this makes clif behavior |
| 126 | + platform-dependent. Should have a single defined semantics for clif to prevent |
| 127 | + breaking things up the stack. The suggestion in the issue is that we |
| 128 | + reconsider this and go back to a world where have explicit endian on |
| 129 | + everything, and for native things we bake it in based on the knowledge when we |
| 130 | + generate the clif. Basic approach is to do what other compilers do like LLVM |
| 131 | + with early-bind rather than late-bind. Any objections? |
| 132 | +* akirilov - agree! Especially about clif semantics I agree we don't want them |
| 133 | + dependent on the interpreter's host platform. |
| 134 | +* cfallin - ok sounds like not much controversy. Sticky point is the API change. |
| 135 | + When you create a clif function or you get a builder you need to give a notion |
| 136 | + of endianness if not more platform information. Corresponds to LLVM which has |
| 137 | + datalayout at the top of every file. Don't think that this will break things |
| 138 | + other than that it's an API change which you should already know. |
| 139 | +* uweigand - Confused about how other IRs have been created from the start for a |
| 140 | + particular target and will build different IR for different targets. Have to |
| 141 | + know the target for the IR to do anything with it anyway. Need to keep |
| 142 | + specifying the same target when working with the same file. Or LLVM annotates |
| 143 | + at the top. Sometimes datalayout also has target too. Having an interpreter |
| 144 | + which doesn't know the intended target will really fully work even if |
| 145 | + endianness is fixed. Won't there be other reasons? |
| 146 | +* cfallin - one distinction is that the specific target is less important and |
| 147 | + more important about details like endianness. Native loads/stores defined by |
| 148 | + this. Pointer width can also be important. If you give me x86 IR it should be |
| 149 | + possible to in theory compile on a 64-bit big-endian system with byteswaps? |
| 150 | +* uweigand - don't have a full overview of the IR, but wondering if we have |
| 151 | + things like pointer offsets which changes offsets and such? |
| 152 | +* cfallin - not in the same way of LLVM, the code producer might assume this and |
| 153 | + we may want to check. How would this work. If we're lowering heap_addr on |
| 154 | + 64-bit system from IR targeted from 32-bit system maybe... |
| 155 | +* uweigand - the specific question seems fine here, tried last year and it |
| 156 | + seemed possible. Lots of code to change though, including code outside of the |
| 157 | + Cranelift repository. |
| 158 | +* cfallin - no API stability right now though. Folks here produce clif IR so |
| 159 | + this would impact you. Providing endianness to a builder isn't the biggest |
| 160 | + dealbreaker though since it's often ... |
| 161 | +* fitzgen - to what uweigand said, the front/middle generate different IR |
| 162 | + depending on the backend. Are we doing this today in Cranelift? All else being |
| 163 | + equal it would be nice if we always generated the same IR. Some issues with |
| 164 | + endianness though. I liked you recent comment of setting the endianness once |
| 165 | + and still a tri-state native option, but native is explicitly defined. If the |
| 166 | + declaration of what native is the only thing that's different that seems like |
| 167 | + a nice property. |
| 168 | +* uweigand - to clarify I wasn't referring to Cranelift, referring to compilers |
| 169 | + like gcc/LLVM where it generates different IR since IR already encodes |
| 170 | + features like the calling convention, struct sizes, etc. |
| 171 | +* cfallin - we don't have calling convention details but we do have struct |
| 172 | + layout depending on what the producer is doing. No concept of struct in |
| 173 | + cranelift, but we do have producers that compile structs. Pointer-width fields |
| 174 | + have different sizes. |
| 175 | +- acrichto - wasmtime has platform dependent things for VMContext yeah |
| 176 | +- afonso - control type for stack\_addr and such is pointer type |
| 177 | +- cfallin - if you use 32-bit on 64-bit should be compiled correctly? Would be |
| 178 | + nice to be independent but there's lots of details |
| 179 | +- fitzgen - imagining on the cranelift-wasm frontend it's the same |
| 180 | +- cfallin - I think it's already true except argument loads/stores? |
| 181 | +- uweigand - other way around. All loads/store have explicit endianness. More |
| 182 | + places "leave native" than use little. Most probably use little-endian though |
| 183 | + since it's wasm. |
| 184 | +- cfallin - almost have this property nick? maybe don't enforce? |
| 185 | +- fitzgen - we have environment traits which customize things we want different. |
| 186 | + Not mad about hook points for those using the frontend. If cranelift-wasm |
| 187 | + decides to ask about the current platform and change the lowering that feels |
| 188 | + bad. |
| 189 | +- cfallin - agreed that's bad. This should be used to make behavior |
| 190 | + deterministic. Don't have other platform-specific properties. |
| 191 | +- bjorn3 - how test native loads/stores? |
| 192 | +- cfallin - different tests? No duplication? Not sure I understand. |
| 193 | +- cfallin - other points? Ok sounds like a reasonable approach, Afonso would you |
| 194 | + like to try this? |
| 195 | +- afonso - Will probably need guidance but happy to try. |
| 196 | + |
| 197 | +#### Status |
| 198 | + |
| 199 | +- cfallin: ISLE! |
| 200 | +- uweigand: s390x - final patches merged and testsuite passes out-of-the-box. PR |
| 201 | + to add s390x to CI. As we were speaking the run finished! |
| 202 | +- akirilov: looking into pointer authentication support and code branch target |
| 203 | + indication. These two are related. Just starting to working on an RFC since |
| 204 | + this will probably merit discussions. |
0 commit comments