Proposal for resolving benign validation errors when auto-optimizing for non-CPU devices #1323
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A standard workflow for optimizing programs to run on non-CPU devices involves instrumenting smaller kernels assuming that the inputs and output (non-transient data) are already on the device, i.e., no copies from the host to the device and back are needed. This is usually achieved by changing the non-transient data's storage to, e.g., GPU or FPGA global memory and then applying the appropriate device-specific transformation. However, when auto-optimizing, many other transformations are executed before GPU/FPGATransform. During this process, the SDFG is most likely invalid because the non-transient data on the device may appear to be accessed in the host's context, resulting in validation errors. Such errors are benign since the device-specific transformations will appropriately update schedules and storages, and they will introduce any needed copies.
This PR proposes a quick way to address the above issue. It introduces a new configuration parameter,
check_accessibility
, under theexperimental
category, having by default the valueTrue
. The fix consists of two components:dace.sdfg.validation._accessible
helper method checks the parameter's value and immediately returnsTrue
if the parameter is set toFalse
.False
, if the selected device is other than CPU. It restores the original value of the parameter (as set by the user) just before applying GPU or FPGATransform.