diff options
author | Tim Rowley <[email protected]> | 2017-06-26 13:00:27 -0500 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2017-06-30 13:26:19 -0500 |
commit | cae53b24d7a739647193711e9a16c7face7ec72a (patch) | |
tree | 2d70ab5c42624d507b10816187b116c1fc3470a0 /src/gallium/drivers/swr/rasterizer/codegen | |
parent | b89bd3694c12f95a74af02e8095edcd631a05801 (diff) |
swr/rast: Split backend.cpp to improve compile time
Hardcode split to four files currently. Decreases swr build
time on a quad-core by ~10%.
Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer/codegen')
3 files changed, 63 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py index f65f7648c41..3f0790c8dae 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py +++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py @@ -35,7 +35,9 @@ def main(args=sys.argv[1:]): parser.add_argument('--dim', help='gBackendPixelRateTable array dimensions', nargs='+', type=int, required=True) parser.add_argument('--outdir', help='output directory', nargs='?', type=str, default=thisDir) parser.add_argument('--split', help='how many lines of initialization per file [0=no split]', nargs='?', type=int, default='512') + parser.add_argument('--numfiles', help='how many output files to generate', nargs='?', type=int, default='0') parser.add_argument('--cpp', help='Generate cpp file(s)', action='store_true', default=False) + parser.add_argument('--hpp', help='Generate hpp file', action='store_true', default=False) parser.add_argument('--cmake', help='Generate cmake file', action='store_true', default=False) args = parser.parse_args(args); @@ -43,11 +45,14 @@ def main(args=sys.argv[1:]): class backendStrs : def __init__(self) : self.outFileName = 'gen_BackendPixelRate%s.cpp' + self.outHeaderName = 'gen_BackendPixelRate.hpp' self.functionTableName = 'gBackendPixelRateTable' self.funcInstanceHeader = ' = BackendPixelRate<SwrBackendTraits<' self.template = 'gen_backend.cpp' + self.hpp_template = 'gen_header_init.hpp' self.cmakeFileName = 'gen_backends.cmake' self.cmakeSrcVar = 'GEN_BACKEND_SOURCES' + self.tableName = 'BackendPixelRate' backend = backendStrs() @@ -77,6 +82,8 @@ def main(args=sys.argv[1:]): numFiles = 1 else: numFiles = (len(output_list) + args.split - 1) // args.split + if (args.numfiles != 0): + numFiles = args.numfiles linesPerFile = (len(output_list) + numFiles - 1) // numFiles chunkedList = [output_list[x:x+linesPerFile] for x in range(0, len(output_list), linesPerFile)] @@ -94,6 +101,18 @@ def main(args=sys.argv[1:]): fileNum=fileNum, funcList=chunkedList[fileNum]) + if args.hpp: + baseHppName = os.path.join(args.outdir, backend.outHeaderName) + templateHpp = os.path.join(thisDir, 'templates', backend.hpp_template) + + MakoTemplateWriter.to_file( + templateHpp, + baseHppName, + cmdline=sys.argv, + numFiles=numFiles, + filename=backend.outHeaderName, + tableName=backend.tableName) + # generate gen_backend.cmake file if args.cmake: templateCmake = os.path.join(thisDir, 'templates', 'gen_backend.cmake') diff --git a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_backend.cpp b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_backend.cpp index 4eb4ad4f2b3..088b1cd79d5 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_backend.cpp +++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_backend.cpp @@ -32,6 +32,7 @@ //============================================================================ #include "core/backend.h" +#include "core/backend_impl.h" void InitBackendPixelRate${fileNum}() { diff --git a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_header_init.hpp b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_header_init.hpp new file mode 100644 index 00000000000..5625ef8a0de --- /dev/null +++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_header_init.hpp @@ -0,0 +1,43 @@ +//============================================================================ +// Copyright (C) 2017 Intel Corporation. All Rights Reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice (including the next +// paragraph) shall be included in all copies or substantial portions of the +// Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +// @file ${filename} +// +// @brief auto-generated file +// +// DO NOT EDIT +// +// Generation Command Line: +// ${'\n// '.join(cmdline)} +// +//============================================================================ + +%for num in range(numFiles): +void Init${tableName}${num}(); +%endfor + +static INLINE void Init${tableName}() +{ + %for num in range(numFiles): + Init${tableName}${num}(); + %endfor +} |