diff options
| author | venkataram-nv <vedavamadath@nvidia.com> | 2024-08-30 15:18:14 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-30 15:18:14 -0700 |
| commit | 49862e764c6c873d7ee694663f226631b8a41353 (patch) | |
| tree | b5641f1ab272d2e69d38a0b9be45e80d8120ce9e /tools/benchmark | |
| parent | 3cf5935b434a8b9a07a6df5a6ab4c4dc373a1ac3 (diff) | |
Updated MDL shader sources for benchmarks (#4965)
* Updated MDL shader sources for benchmarks
* Shifting sources to external repository
* Changing repo URL syntax benchmark.yml
* Refactoring entry point names
Diffstat (limited to 'tools/benchmark')
| -rw-r--r-- | tools/benchmark/compile.py | 80 |
1 files changed, 31 insertions, 49 deletions
diff --git a/tools/benchmark/compile.py b/tools/benchmark/compile.py index 0d995636d..6717d3377 100644 --- a/tools/benchmark/compile.py +++ b/tools/benchmark/compile.py @@ -19,26 +19,20 @@ clear_mkdir('modules') clear_mkdir('targets') clear_mkdir('targets/generated') -target_choices = ['spirv', 'spirv-glsl', 'dxil', 'dxil-embedded'] +target_choices = [ + 'spirv', # SPIRV directly + 'spirv-glsl', # SPIRV through synthesized GLSL + 'dxil', # DXIL with HLSL and DXC + 'dxil-embedded' # DXIL with precompiled modules +] parser = argparse.ArgumentParser() parser.add_argument('--target', type=str, default='spirv', choices=target_choices) parser.add_argument('--samples', type=int, default=1) parser.add_argument('--output', type=str, default='benchmarks.json') -parser.add_argument('--ci', action='store_true') args = parser.parse_args(sys.argv[1:]) -repo = 'slang-benchmarks' -if args.ci: - repo = 'C:\\slang-benchmarks' - -if not os.path.exists(repo): - repo = 'ssh://git@gitlab-master.nvidia.com:12051/slang/slang-benchmarks.git' - command = f'git clone {repo}' - subprocess.check_output(command) - -dxc = 'dxc.exe' slangc = '..\\..\\build\\Release\\bin\\slangc.exe' target = args.target samples = args.samples @@ -110,67 +104,55 @@ def compile_cmd(file, output, stage=None, entry=None, emit=False): if emit: cmd += f' -target {target_ext}' output += '.' + target_ext + if target == 'dxil-embedded': + cmd += ' -profile lib_6_6' elif embed: cmd += ' -embed-dxil' - cmd += ' -profile lib_6_6' - cmd += ' -incomplete-library' cmd += f' -o {output}' return cmd +### Monolithic compilation ### + +hit = 'hit.slang' + +cmd = compile_cmd(hit, f'targets/dxr-ch-mono', stage='closesthit', entry='MdlRadianceClosestHitProgram', emit=True) +run(cmd, f'full/{target_ext}/mono/closesthit') +print(f'[I] compiled shadow (monolithic)') + +cmd = compile_cmd(hit, f'targets/dxr-ah-mono', stage='anyhit', entry='MdlRadianceAnyHitProgram', emit=True) +run(cmd, f'full/{target_ext}/mono/anyhit') +print(f'[I] compiled shadow (monolithic)') + +cmd = compile_cmd(hit, f'targets/dxr-sh-mono', stage='anyhit', entry='MdlShadowAnyHitProgram', emit=True) +run(cmd, f'full/{target_ext}/mono/shadow') +print(f'[I] compiled shadow (monolithic)') + ### Module precompilation ### modules = [] -for file in glob.glob(f'{repo}\\mdl\\*.slang'): - if file.endswith('hit.slang'): - run(compile_cmd(file, 'modules/closesthit.slang-module', stage='closesthit'), 'module/closesthit') - run(compile_cmd(file, 'modules/anyhit.slang-module', stage='anyhit'), 'module/anyhit') - run(compile_cmd(file, 'modules/shadow.slang-module', stage='anyhit', entry='shadow'), 'module/shadow') - else: +for file in glob.glob(f'*.slang'): + if not file.endswith('hit.slang'): basename = os.path.basename(file) run(compile_cmd(file, f'modules/{basename}-module'), 'module/' + file) - modules.append(f'modules/{basename}-module') - - print(f'[I] compiled {file}.') + print(f'[I] compiled {file}.') -### Entrypoint compilation ### -hit = 'slang-benchmarks/mdl/hit.slang' -files = ' '.join(modules) +### Module whole compilation ### -# Module -cmd = compile_cmd(f'{files} modules/closesthit.slang-module', f'targets/dxr-ch-modules', stage='closesthit', emit=True) +cmd = compile_cmd(hit, f'targets/dxr-ch-modules', stage='closesthit', entry='MdlRadianceClosestHitProgram', emit=True) run(cmd, f'full/{target_ext}/module/closesthit') - print(f'[I] compiled closesthit (module)') -cmd = compile_cmd(f'{files} modules/anyhit.slang-module', f'targets/dxr-ah-modules', stage='anyhit', emit=True) +cmd = compile_cmd(hit, f'targets/dxr-ah-modules', stage='anyhit', entry='MdlRadianceAnyHitProgram', emit=True) run(cmd, f'full/{target_ext}/module/anyhit') - print(f'[I] compiled anyhit (module)') -cmd = compile_cmd(f'{files} modules/shadow.slang-module', f'targets/dxr-sh-modules', stage='anyhit', entry='shadow', emit=True) +cmd = compile_cmd(hit, f'targets/dxr-sh-modules', stage='anyhit', entry='MdlShadowAnyHitProgram', emit=True) run(cmd, f'full/{target_ext}/module/shadow') - print(f'[I] compiled shadow (module)') -# Monolithic -cmd = compile_cmd(hit, f'targets/dxr-ch-mono', stage='closesthit', emit=True) -run(cmd, f'full/{target_ext}/mono/closesthit') - -print(f'[I] compiled shadow (monolithic)') - -cmd = compile_cmd(hit, f'targets/dxr-ah-mono', stage='anyhit', emit=True) -run(cmd, f'full/{target_ext}/mono/anyhit') - -print(f'[I] compiled shadow (monolithic)') - -cmd = compile_cmd(hit, f'targets/dxr-sh-mono', stage='anyhit', entry='shadow', emit=True) -run(cmd, f'full/{target_ext}/mono/shadow') - -print(f'[I] compiled shadow (monolithic)') - # Module precompilation time precompilation_time = 0 for k in timings: |
