Repository navigation
test(functional-ci): add a backend capability table and shared case helpers - #91
Closed
knowicki-nvidia wants to merge 5 commits into
Closed
knowicki-nvidia wants to merge 5 commits into
knowicki-nvidia wants to merge 5 commits into
Conversation
… cases Signed-off-by: Konrad Nowicki <knowicki@nvidia.com>
Contributor
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
Drop the artifact capability (artifact_format already encodes it) and the unused dynamic_dims capability. Tests receive the BackendCase directly. Empty parameter sets now fail at collection repo-wide via empty_parameter_set_mark. Signed-off-by: Konrad Nowicki <knowicki@nvidia.com>
…ross cases Add pinned_strategy() and Tolerance.assert_close() in lifecycle.py and use them in every functional case. test_structured_io widens atol 5x for every backend instead of special-casing TensorRT, and test_shapes builds each backend once. Signed-off-by: Konrad Nowicki <knowicki@nvidia.com>
…e TensorRT factory
Pytype infers frozenset({...}) as frozenset[str], so the table now builds capability sets with _capabilities(*names: Capability), which still rejects misspelled names. test_strategies uses BACKENDS["tensorrt"].factory() instead of a copy, and the TensorRT plan runner asserts contiguous inputs instead of passing the address of a temporary copy.
Signed-off-by: Konrad Nowicki <knowicki@nvidia.com>
devin-ai-integration
Bot
force-pushed
the
devin/ber-528-backend-capability-table
branch
2 times, most recently
from
October 16, 2026 10:57
4e711c6 to
0579b64
Compare
…d-artifact case Add assert_matches_eager() and an expected type on selected_backend() in lifecycle.py and use them in every case. run_lifecycle returns the restored module, Tolerance is frozen, and models.seeded() replaces the copied RNG block. test_precision builds TensorRT with tensorrt_backend(**overrides) and replays every case on two new inputs. Deployable artifacts move to test_exported_artifact under a new export capability, which BackendCase keeps in step with artifact_format. PROFILING_STRATEGIES is typed as ProfilingTuneStrategy. Signed-off-by: Konrad Nowicki <knowicki@nvidia.com>
devin-ai-integration
Bot
force-pushed
the
devin/ber-528-backend-capability-table
branch
from
October 16, 2026 10:58
0579b64 to
243af83
Compare
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
Resolves BER-528. Based on #77 (top of the BER-425
tests/functional_cistack).Adds one backend table,
tests/functional_ci/backends.py, and removes the per-file dictsBACKENDS,SHAPE_BACKENDS,TOPOLOGY_BACKENDS,JIT_BACKENDS, andONNX_BACKENDS.save_load,export,dynamic_batch,structured_io,multigraph,onnx_input,jit. The table builds them with_capabilities(*names: Capability), so pytype rejects a misspelled name.exportbackends (inductor-aot,tensorrt,onnxruntime-cuda) also setartifact_format(pt2,tensorrt_plan,onnx).BackendCase.__post_init__asserts that both are set or neither is.dynamic_dimsin BER-529.pyproject.tomlsetsempty_parameter_set_mark = "fail_at_collect", so a capability that no backend has fails collection; pytest does not skip it silently. This option applies to the whole repository.aituneandtests/unitstill collect without errors.Shared helpers in
lifecycle.py, used by every functional case (includingtest_precision,test_strategies,test_kernel_selector):pinned_strategy(backend)replaces 6 copies ofOneBackendStrategy(b).enable_performance_validation(False)+enable_find_max_batch_size(False).Tolerance.assert_close(actual, expected)replaces 11 unpackedtorch.testing.assert_closecalls.Toleranceis frozen because cases share instances.assert_matches_eager(tuned, reference, device, tolerance, batch_sizes=(2,), seeds=(5,))replaces the eager-comparison loops, including two different_assert_matches_eagerhelpers.selected_backend(module, expected=None)also checks the selected backend type. This replaces 6type(selected_backend(...)) is ...asserts.run_lifecyclereturns the restored module; theLifecycleResultdataclass is removed.models.seeded(device, seed)replaces the RNG block thattest_topologycopied frommake_mlp.Changes that are not pure moves:
test_exported_artifact[inductor-aot|tensorrt|onnxruntime-cuda](@with_backends("export")) runs the native artifact. Before,test_backend_lifecycledid this behind anartifact_format is Noneearly return, on the reloaded module. Now it uses the tuned module, so 3 extra toy tunes run.test_precisionbuilds TensorRT withtensorrt_backend(**overrides)frombackends.pyand replays every case on two new inputs (seeds 11 and 12). Before, onlycuda-graphs-fp32did the replay.test_structured_iowidensatol5x for every backend (row sums instatsaccumulate per-element error) instead of the TensorRT-onlyTENSORRT_ROW_SUM. TensorRT keepsrtol=1e-3, atol=5e-3; Inductor goes fromatol=1e-5to5e-5.test_partial_wrap_multigraph[inductor-aot]now uses the Inductor tolerance from the table (rtol=1e-4, atol=1e-5). Before, it usedTENSORRT_FP32for both backends.10 + batch_size; existing-ONNX tests use it instead of20 + batch_size.tensor.contiguous().data_ptr(), which can point to a temporary copy.onnxruntime-cudain the shape and existing-ONNX tests now setsexecution_provider=CUDAexplicitly. Before, it usedNone, which defaults to CUDA.Verification
pytest --co tests/functional_ci: the 39 test ids of test(functional-ci): cover KernelSelectorBackend attention selection #77 plus the 3test_exported_artifactids (diffed).pytest --co aitune tests/unitpasses withfail_at_collect.pre-commitpasses. pytype 2024.10.11 on Python 3.11 reports no errors fortests/functional_ci.Functional CI GPUjob runs the cases.Link to Devin session: https://nvidia-cloud.devinenterprise.com/sessions/73f65ef5923744f7902f69e2ce14574a
Open in Devin Desktop: https://nvidia-cloud.devinenterprise.com/desktop/session/73f65ef5923744f7902f69e2ce14574a?variant=devin
Requested by: @knowicki-nvidia
Summary by CodeRabbit