<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><p style="color:#000;">On April 22, 2014 at 1:06:58 PM, Eric Christopher (<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>) wrote:</p> <div><blockquote type="cite" class="clean_bq" style="color: rgb(0, 0, 0); font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><span><div><div></div><div>On Tue, Apr 22, 2014 at 11:22 AM, Filip Pizlo <fpizlo@apple.com> wrote:<span class="Apple-converted-space"> </span><br>><span class="Apple-converted-space"> </span><br>><span class="Apple-converted-space"> </span><br>> On April 22, 2014 at 11:09:40 AM, Tim Northover (t.p.northover@gmail.com)<span class="Apple-converted-space"> </span><br>> wrote:<span class="Apple-converted-space"> </span><br>><span class="Apple-converted-space"> </span><br>>> No, I'm saying that the default CPU in the JIT should always be the CPU<span class="Apple-converted-space"> </span><br>>> we're actually running on. That's not insane, that's how any sensible JIT<span class="Apple-converted-space"> </span><br>>> would work.<span class="Apple-converted-space"> </span><br>><span class="Apple-converted-space"> </span><br>> Possibly (though the lldb developers may quibble about their JIT not<span class="Apple-converted-space"> </span><br>> being sensible).<span class="Apple-converted-space"> </span><br>><span class="Apple-converted-space"> </span><br>> Sure, but lldb already manually sets the CPU.<span class="Apple-converted-space"> </span><br>><span class="Apple-converted-space"> </span><br>> The question here is what behavior to give to those who don't manually set<span class="Apple-converted-space"> </span><br>> the CPU. I'm arguing that the API previously guaranteed that the JIT would<span class="Apple-converted-space"> </span><br>> target the CPU flavor that the process was running on, and that we should<span class="Apple-converted-space"> </span><br>> arrange for the JIT to continue to obey this in the case that the JIT's<span class="Apple-converted-space"> </span><br>> client doesn't manually set the CPU.<span class="Apple-converted-space"> </span><br>><span class="Apple-converted-space"> </span><br><br>This is patently false except for the single cpu that changed.<span class="Apple-converted-space"> </span></div></div></span></blockquote></div><p>I think it would be useful if you were more specific about what is false about the above statement. I think this is worth clearing up.</p><p>The MCJIT doesn't require the module to have a target set, and it doesn't require the caller to set the target of the ExecutionEngine. It also doesn't require the client to set Arch or CPU. This is true both in the C and C++ APIs. EngineBuilder will set these things for you to sensible defaults on all platforms *except* ARM64, where things get murky. For example on X86, even if you don't explicitly set the CPU the MCJIT will figure out what CPU you're running on along with all of its relevant features (whether it has AVX, etc) and it will generate code accordingly. Also, the C API currently only lets you set the target on the module, not the ExecutionEngine, and so this prevents you from setting the Arch+CPU.</p><p>The MCJIT has explicit code to set the target/CPU/etc to a sensible default that is appropriate for JITing code into the process in which the JIT itself runs.</p><p>On ARM64 things were murky before r206228 and they are still murky now; the only thing that changed is that one flavor of ARM64 was broken: it's now the only target on which you cannot reliably create a module and an MCJIT without setting the target and expect code to run correctly.</p><p>And yes, LLDB does explicitly set the target/cpu/arch by using one of the C++ EngineBuilder methods that allows you to do it. There may be other clients that do this. But that doesn't mean that others should *have* to also do this.</p><p>It would be useful if you were more specific about what you think is false about any of this.</p><p>Anyway, I would be against any change to the C API that would require JIT clients to set the CPU, Arch, or target triple as a prerequisite to using the MCJIT. This would be a breaking change to stable API and the MCJIT should continue to do as it always did: target the host by default.</p><div><div><blockquote type="cite" class="clean_bq" style="color: rgb(0, 0, 0); font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><span><div><div><br><br>> In the future, if someone does break one platform to fix another -<span class="Apple-converted-space"> </span><br>> especially when it involves stable API, and where it's clear what the right<span class="Apple-converted-space"> </span><br>> fix is - then we should revert to avoid a situation where clients have to<span class="Apple-converted-space"> </span><br>> blacklist a series of LLVM revisions.<span class="Apple-converted-space"> </span><br>><span class="Apple-converted-space"> </span><br><br>It's only stable between releases. Anything else is anything goes. As<span class="Apple-converted-space"> </span><br>I don't believe it was in 3.4...<span class="Apple-converted-space"> </span></div></div></span></blockquote></div><p>MCJIT C API was in 3.4.</p><p>-Filip</p><div><blockquote type="cite" class="clean_bq" style="color: rgb(0, 0, 0); font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><span><div><div><br></div></div></span></blockquote></div></div></body></html>