{"push_id":2624815002,"size":1,"distinct_size":1,"ref":"refs/heads/master","head":"b1d27c609a09aa3aafd49ebb32c25f8fb61f9793","before":"1116b5a24c1ecf34de545b3ea1de6d1d5b01af08","commits":[{"sha":"b1d27c609a09aa3aafd49ebb32c25f8fb61f9793","author":{"name":"Roman Levenstein","email":"e18aabdf9e8eb69d578f7ff8b07a391b7e88620a@fb.com"},"message":"[llvm] Limit the size of the emitted LLVM IR in the \"main\" function. Split it into multiple functions if required.\n\nSome NN models result in really huge number of Glow IR instructions. When they are emitted as LLVM IR it in turn results in very, very big \"main\" functions. And this is really bad for JIT performance, because it significantly increases the compilation times as many LLVM optimization passes have to iterate over very long instruction lists.\n\nThis commit introduces the logic to split big \"main\" function in LLVM IR into smaller ones. This is done during the LLVMIRGen phase. The algorithm basically allows to irgen at most N Glow IR instructions into a single LLVM function. If there are more Glow IR instructions to be lowered into LLVM IR, then a new LLVM function is created and called at the very end of the current LLVM function currently generated by LLVMIRGen. From this moment, LLVMIRGen emits all subsequent LLVM instructions into this new function. If it becomes too big as well, the process repeats. As a result, it may produce a bunch of \"main\" functions forming a chain of invocations.\n\nIn case of using the CPU backend as a JIT, i.e. when \"main\" is being called from \"jitmain\", all invocations of these \"main\" functions are specialized for the constant parameters used for the base addresses of the activations memory region, weights memory region, etc. This guarantees that the produced optimized code is as efficient as it was when there was only a single, huge main function.","distinct":true,"url":"https://api.github.com/repos/pytorch/glow/commits/b1d27c609a09aa3aafd49ebb32c25f8fb61f9793"}]}
{"actor":{"display_login":"opti-mix"}}