For the PTX back-end, I would like to introduce a configure-time option to determine the number of architectural registers available to LLVM register allocation during code generation. The motivation for this is PTX is a virtual instruction set and the number of registers is configurable in the output file. Thus, the number of registers specified via tablegen is arbitrary. For different use-cases, it may be desirable to change this number. That said, my question is in regards to how best to implement this considering that the PTX back-end is a part of upstream LLVM and the new option will be committed to LLVM trunk. Creating a new option seems trivial for the CMake build scripts; just add a special target to automatically generate parts of the PTXRegisterInfo.td file. The Autotools build scripts seem to complicate matters, however. The makefiles for the different back-ends appear to be regular makefiles that are not processed by automake, making it difficult to introduce configure-time variables. Is the introduction of a configure-time variable in the CMake build scripts an acceptable addition in LLVM trunk? Is there any precedent for backend-specific configure options? Would the autotools-based build system need to be modified to get something like this to work? Thanks, Justin Holewinski -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110620/9e9892ad/attachment.html>
On 6/20/11 10:39 AM, Justin Holewinski wrote:> For the PTX back-end, I would like to introduce a configure-time > option to determine the number of architectural registers available to > LLVM register allocation during code generation. The motivation for > this is PTX is a virtual instruction set and the number of registers > is configurable in the output file. Thus, the number of registers > specified via tablegen is arbitrary. For different use-cases, it may > be desirable to change this number.Is it possible to make this option a command-line option to llc instead of a configure-time option? In my experience, it's better to make these options command-line options to tools when possible; that way, when someone wants to experiment with changing the parameter, they do not need to recompile. -- John T. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110620/49d74010/attachment.html>
On Jun 20, 2011, at 11:47 AM, John Criswell wrote:> On 6/20/11 10:39 AM, Justin Holewinski wrote: >> >> For the PTX back-end, I would like to introduce a configure-time option to determine the number of architectural registers available to LLVM register allocation during code generation. The motivation for this is PTX is a virtual instruction set and the number of registers is configurable in the output file. Thus, the number of registers specified via tablegen is arbitrary. For different use-cases, it may be desirable to change this number. > > Is it possible to make this option a command-line option to llc instead of a configure-time option?Ideally, that would be the way to go. However, as far as I know, LLVM requires static register data that is generated from tablegen files. The only way I can think of changing this data is by automatically generating the tablegen files at configure time.> > In my experience, it's better to make these options command-line options to tools when possible; that way, when someone wants to experiment with changing the parameter, they do not need to recompile.I completely agree. Unfortunately, I do not believe that is possible in this case (without major LLVM back-end changes).> > -- John T. >Thanks, Justin Holewinski -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110620/2e9334f1/attachment.html>
Jakob Stoklund Olesen
2011-Jun-20 17:06 UTC
[LLVMdev] New Configure Option for LLVM Builds
On Jun 20, 2011, at 8:39 AM, Justin Holewinski wrote:> For the PTX back-end, I would like to introduce a configure-time option to determine the number of architectural registers available to LLVM register allocation during code generation. The motivation for this is PTX is a virtual instruction set and the number of registers is configurable in the output file. Thus, the number of registers specified via tablegen is arbitrary. For different use-cases, it may be desirable to change this number. > > That said, my question is in regards to how best to implement this considering that the PTX back-end is a part of upstream LLVM and the new option will be committed to LLVM trunk. Creating a new option seems trivial for the CMake build scripts; just add a special target to automatically generate parts of the PTXRegisterInfo.td file. The Autotools build scripts seem to complicate matters, however. The makefiles for the different back-ends appear to be regular makefiles that are not processed by automake, making it difficult to introduce configure-time variables. > > • Is the introduction of a configure-time variable in the CMake build scripts an acceptable addition in LLVM trunk? > • Is there any precedent for backend-specific configure options? Would the autotools-based build system need to be modified to get something like this to work?This should be a run-time option. You should be able to define 'enough' registers in your RegisterInfo.td file, and then simply reserve the registers you don't want. /jakob
Justin Holewinski <justin.holewinski at gmail.com> writes: [snip]> Is the introduction of a configure-time variable in the CMake build > scripts an acceptable addition in LLVM trunk?Yes, but I'm just speaking just as the "official" maintainer of the CMake build so I'm not saying that it is the best solution for your problem. If you end adding the configure option, please put it in the PTX target CMakelists.txt file. Extra bonus if you document it on doc/CMake.html (you may create a new section "Target-specific options.") Instead of configuring a header file, try passing the option as a `define' (add_definitions -DPTX_FOO=BAR)> Is there any precedent for backend-specific configure options?No, AFAIR, but I don't think it matters if it turns to be the Right Thing for solving your problem.> Would the autotools-based build system need to be modified to get > something like this to work?Sure, you need to add the option to the scripts, just like CMake, but don't know the details. I'll look at the svn log for autoconf/configure.ac and see what modifications required a similar change. Then submit a patch for review. Once approved, you need to regenerate the scripts before committing. HTH
Possibly Parallel Threads
- [LLVMdev] New Configure Option for LLVM Builds
- [LLVMdev] New Configure Option for LLVM Builds
- [LLVMdev] [ptx] Propose a register class naming convention change
- [LLVMdev] Emulating an infinite register file in the backend
- [LLVMdev] [ptx] Propose a register class naming convention change