Repository navigation
Astc compute_ideal_weights_for_decimation: drop redundant gather via pre-subtracted infill - #682
Closed
karthick-mcw wants to merge 1 commit into
Closed
karthick-mcw wants to merge 1 commit into
karthick-mcw wants to merge 1 commit into
Conversation
…n refine loop The refine loop gathered both infilled_weights and ei.weights per texel and subtracted them (old_weight - ideal_weight). Pre-subtract ei.weights from the infilled weight at store time instead, so the refine loop only needs a single gather (weight_diff) for the same result. Fewer gather ops on the hot refine loop. Output is bit-identical.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Drop a redundant gather in the refine loop of
compute_ideal_weights_for_decimation.compute_ideal_weights_for_decimation's refine loop gathered bothinfilled_weightsandei.weightsper texel and subtracted them (old_weight - ideal_weight). This pre-subtractsei.weightsfrom the infilled weight at store time instead, so the refine loop only needs a single gather (weight_diff) for the same result — one fewer gather per texel on the hot path.The result is bit-identical. The subtraction is reassociated to happen once at infill-store time instead of once per use in the refine loop, so the arithmetic — and therefore the output — doesn't change.
Files:
Source/astcenc_ideal_endpoints_and_weights.cppMeasured
Asset compression workload, gain in % (positive means faster).
Test plan
.astcoutput with and without the patch.astcencC++ unit test suite (ctest,-DASTCENC_UNITTEST=ON), 223/223 tests pass on the patched build.Test/astc_test_functional.py --encoder avx2gives the identical result with and without the patch (38/93 pass; the remaining 55 error only on a missingImageMagickdependency in this test environment, not on the code — zero assertion failures either way).