NXP backend: Unify testing infrastructure.#19112
NXP backend: Unify testing infrastructure.#19112MartinPavella wants to merge 6 commits intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19112
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 15 New FailuresAs of commit 52cac91 with merge base 32a6cec ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
b1d018f to
c213c9f
Compare
624eae4 to
61606df
Compare
7171bff to
8f5cc1d
Compare
| ) -> EdgeProgramManager: | ||
| calibration_inputs = get_random_calibration_inputs(to_model_input_spec(input_spec)) | ||
|
|
||
| example_input = calibration_inputs[0] |
There was a problem hiding this comment.
Probably should also use
example_input = _get_example_input(input_spec)
| case _: | ||
| raise ValueError(f"Unsupported dim_order: {spec.dim_order}") | ||
|
|
||
| sample_vector = rng.random(np.prod(shape), spec.type).reshape(shape) |
There was a problem hiding this comment.
Use
from executorch.backends.nxp.backend.ir.converter.conversion.translator import torch_type_to_numpy_type`
sample_vector = rng.random(np.prod(shape), torch_type_to_numpy_type(spec.dtype)).reshape(shape)
| @dataclass | ||
| class ModelInputSpec: | ||
| shape: tuple[int, ...] | ||
| type: np.dtype = np.float32 |
There was a problem hiding this comment.
Please don't add separate numpy type, keep only torch type. Adding numpy type means duplicity and space for unequal numpy and torch types. It was pointed to me by some external dev I don't remember when I added it several months ago, so I removed it. I use conversion function
from executorch.backends.nxp.backend.ir.converter.conversion.translator import torch_type_to_numpy_type
in dataset_creator.py.
https://github.com/pytorch/executorch/pull/19112/changes#r3147341415
There was a problem hiding this comment.
👍 for moving tests to generic dir.
| raise ValueError(f"Unsupported dim_order: {spec.dim_order}") | ||
|
|
||
| sample_vector = rng.random(np.prod(shape), spec.type).reshape(shape) | ||
| sample_vector.tofile( |
There was a problem hiding this comment.
| file_name = f"{str(spec_idx).zfill(2)}.bin" if len(input_spec) > 1 else f"{str(idx).zfill(4)}.bin" | |
| sample_vector.tofile(os.path.join(sample_dir, file_name)) |
This is the fix data creation for single model input.
There was a problem hiding this comment.
Are those inits needed or were they added by IDE?
ea50847 to
352195d
Compare
Change type: ignore[import-not-found] to type: ignore[import] to match MYPY's expected error code for these dynamic module imports.
352195d to
52cac91
Compare
Summary
Unify infrastructure for tests comparing edge dialect <-> Neutron IR with tests comparing lowered edge programs <-> lowered Neutron delegated programs.
Test plan
Tested by all existing tests.
cc @robert-kalmar @JakeStevens @digantdesai