kernelfoundry.conftest¶
This is the conftest file for configuring pytest for kernelfoundry tasks.
Fixtures in this file are available in the task.py file and provide utilities to measure performance, switch between reference and kernel code, and use template arguments.
Functions
|
Session-scoped fixture to add cleanup code after all tests have run. |
|
Create a generic runtime measurement helper with shared output. |
|
Create a torch runtime measurement helper with shared output. |
|
This store is used to collect per-test performance results in a dictionary. |
|
Expose the current pytest node id to runtime helpers used during profiling. |
|
Adds CLI options for performance measurements and templating behavior. |
|
This function registers the "performance" custom marker and configures pytest logging. |
|
Fixture to apply template arguments |
|
Deprecated. |
|
Fixture to easily switch to the reference implementation. |
- kernelfoundry.conftest.pytest_configure(config)[source]¶
This function registers the “performance” custom marker and configures pytest logging.
Note
This function is not intended to be called directly by test code.
- kernelfoundry.conftest.pytest_addoption(parser)[source]¶
Adds CLI options for performance measurements and templating behavior.
Note
This function is not intended to be called directly by test code.
- kernelfoundry.conftest.use_reference(request) bool[source]¶
Fixture to easily switch to the reference implementation.
This can be used in tests to conditionally run the reference code instead of the kernel code, for example to collect performance data on the reference implementation or to verify that the reference implementation runs correctly.
Example
Run the test with the reference implementation:
python -m pytest --ref task.py
- kernelfoundry.conftest.profile_store(request) dict[source]¶
This store is used to collect per-test performance results in a dictionary.
The keys of the dictionary are the test node ids, and the values are lists of measurements collected during the test. Tests can append to the list to collect multiple measurements.
- Returns:
Mutable store keyed by test node id.
- Return type:
- kernelfoundry.conftest.profiler_test_label(request)[source]¶
Expose the current pytest node id to runtime helpers used during profiling.
- kernelfoundry.conftest.measure_runtime_torch(request, profile_store) Callable[source]¶
Create a torch runtime measurement helper with shared output.
- Parameters:
request (pytest.FixtureRequest) – Pytest fixture request.
profile_store (dict) – Mutable store for per-test measurements.
- Returns:
Wrapped measure_runtime_torch callable.
The callable is
kernelfoundry.eval_pipeline.utils.performance.measure_runtime_torch()with the use_itt and output parameters pre-configured.- Return type:
Callable
- kernelfoundry.conftest.torch_profile(measure_runtime_torch) Callable[source]¶
Deprecated. Alias for the torch runtime measurement helper.
Attention
This fixture is deprecated. Please use
measure_runtime_torch()instead.- Parameters:
measure_runtime_torch (Callable) – Runtime measurement helper.
- Returns:
Same helper passed in.
- Return type:
Callable
- kernelfoundry.conftest.measure_runtime(request, profile_store) Callable[source]¶
Create a generic runtime measurement helper with shared output.
- Parameters:
request (pytest.FixtureRequest) – Pytest fixture request.
profile_store (dict) – Mutable store for per-test measurements.
- Returns:
Wrapped measure_runtime callable.
The callable is
kernelfoundry.eval_pipeline.utils.performance.measure_runtime()with the use_itt and output parameters pre-configured.- Return type:
Callable