Skip to content

Commit

Permalink
Add options to save and load pipeline caches
Browse files Browse the repository at this point in the history
Add three options `--save-pipeline-cache`, `--load-pipeline-cache`
and `--add-new-pipeline-caches` to manually handle pipeline cache
creation/loading instead of using the ones saved in the capture file.

This is useful when pipeline creation is slow on the target system.
You can generate the cache once then run the trace multiple times,
or generate it on a faster device type with the same GPU and driver.

When using `--save-pipeline-cache` the contents of the pipeline
caches are written to the specified file just before their
destruction, and just before the destruction of the last bound
pipeline for caches created by `--create-new-pipeline-cache`, or at
the end of the program if no destruction occurs before.

When using `--load-pipeline-cache` the contents of the pipeline
caches are loaded just before their creation, and just before the
creation of the pipeline for caches created by
`--create-new-pipeline-cache`.

If set, allows gfxreconstruct to create new vkPipelineCache objects
when it encounters a pipeline created without cache. This option
can be used in coordination with `--save-pipeline-cache` and
`--load-pipeline-cache`.

Change-Id: I40667416efe4c88033c386f6ec5fd53a86dd58ca
  • Loading branch information
marius-pelegrin-arm authored and charles-lunarg committed Jul 24, 2024
1 parent 5720914 commit c7adb88
Show file tree
Hide file tree
Showing 10 changed files with 534 additions and 36 deletions.
17 changes: 17 additions & 0 deletions USAGE_android.md
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,23 @@ optional arguments:
Enables dumping of resources that are used as inputs in the commands requested for dumping
--dump-resources-dump-all-image-subresources
Enables dumping of all image sub resources (mip map levels and array layers)
--save-pipeline-cache DEVICE_FILE
If set, produces pipeline caches at replay time instead
of using the one saved at capture time and save those
caches in DEVICE_FILE.
(forwarded to replay tool)
--load-pipeline-cache DEVICE_FILE
If set, loads data created by the
`--save-pipeline-cache` option in DEVICE_FILE
and uses it to create the pipelines instead of the
pipeline caches saved at capture time.
(forwarded to replay tool)
--add-new-pipeline-caches
If set, allows gfxreconstruct to create new
vkPipelineCache objects when it encounters a pipeline
created without cache. This option can be used in
coordination with `--save-pipeline-cache` and
`--load-pipeline-cache`. (forwarded to replay tool)
```

The command will force-stop an active replay process before starting the replay
Expand Down
12 changes: 12 additions & 0 deletions USAGE_desktop_Vulkan.md
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,18 @@ Optional arguments:
Enables dumping of all image sub resources (mip map levels and array layers).
--pbi-all Print all block information.
--pbis <index1,index2>Print block information between block index1 and block index2.
--save-pipeline-cache <cache-file>
If set, produces pipeline caches at replay time instead of using
the one saved at capture time and save those caches in <cache-file>.
--load-pipeline-cache <cache-file>
If set, loads data created by the `--save-pipeline-cache`
option in <cache-file> and uses it to create the pipelines instead
of the pipeline caches saved at capture time.
--add-new-pipeline-caches
If set, allows gfxreconstruct to create new vkPipelineCache objects
when it encounters a pipeline created without cache. This option can
be used in coordination with `--save-pipeline-cache` and
`--load-pipeline-cache`.
```

### Key Controls
Expand Down
14 changes: 14 additions & 0 deletions android/scripts/gfxrecon.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ def CreateReplayParser():
parser.add_argument('--dump-resources-dump-all-image-subresources', action='store_true', default=False, help= 'Dump all available mip levels and layers when dumping images.')
parser.add_argument('--pbi-all', action='store_true', default=False, help='Print all block information.')
parser.add_argument('--pbis', metavar='RANGES', default=False, help='Print block information between block index1 and block index2')
parser.add_argument('--save-pipeline-cache', metavar='DEVICE_FILE', help='If set, produces pipeline caches at replay time instead of using the one saved at capture time and save those caches in DEVICE_FILE. (forwarded to replay tool)')
parser.add_argument('--load-pipeline-cache', metavar='DEVICE_FILE', help='If set, loads data created by the `--save-pipeline-cache` option in DEVICE_FILE and uses it to create the pipelines instead of the pipeline caches saved at capture time. (forwarded to replay tool)')
parser.add_argument('--add-new-pipeline-caches', action='store_true', default=False, help='If set, allows gfxreconstruct to create new vkPipelineCache objects when it encounters a pipeline created without cache. This option can be used in coordination with `--save-pipeline-cache` and `--load-pipeline-cache`. (forwarded to replay tool)')
return parser

def MakeExtrasString(args):
Expand Down Expand Up @@ -277,6 +280,17 @@ def MakeExtrasString(args):
arg_list.append('--pbis')
arg_list.append('{}'.format(args.pbis))

if args.save_pipeline_cache:
arg_list.append('--save-pipeline-cache')
arg_list.append('{}'.format(args.save_pipeline_cache))

if args.load_pipeline_cache:
arg_list.append('--load-pipeline-cache')
arg_list.append('{}'.format(args.load_pipeline_cache))

if args.add_new_pipeline_caches:
arg_list.append('--add-new-pipeline-caches')

if args.file:
arg_list.append(args.file)
elif not args.version:
Expand Down
Loading

0 comments on commit c7adb88

Please sign in to comment.