Add explicit dGPU target device support - #243
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces explicit GPU device selection (e.g., GPU.0, GPU.1) to the benchmark scripts by adding centralized validation and wiring it into CLI argument parsing for benchmark entrypoints.
Changes:
- Added
validate_target_device()utility and unit tests for device string normalization/validation. - Updated benchmark argument parsing to validate
--target_device(includingGPU.<index>). - Documented supported target devices and examples in the root README, and added the new test module to the
python-testMakefile target.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents target device values and usage examples for explicit GPU selection. |
| benchmark-scripts/Makefile | Adds device_validation_test.py to unit test runs. |
| benchmark-scripts/device_validation.py | New validation helper for CPU/GPU/NPU/GPU.<index> values. |
| benchmark-scripts/device_validation_test.py | New unit tests validating accepted/rejected device strings. |
| benchmark-scripts/benchmark.py | Uses the new validator for --target_device parsing. |
| benchmark-scripts/benchmark_test.py | Adds device-validation tests (currently duplicated vs the dedicated test module). |
| benchmark-scripts/benchmark_order_accuracy.py | Uses the validator for --target_device parsing (but import/path ordering needs adjustment). |
Suppressed comments (2)
benchmark-scripts/benchmark_order_accuracy.py:33
sys.path.insert(...)is intended to make local benchmark-script imports work when this file is run from other working directories, but it currently happens after importingdevice_validation. If the script is executed without the script directory already onsys.path,from device_validation import ...will fail before the path tweak runs.
from device_validation import validate_target_device
# Import from performance-tools benchmark scripts
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import stream_density
benchmark-scripts/benchmark_test.py:64
- These target-device validation tests duplicate the coverage already provided by
device_validation_test.py. Keeping them in a single dedicated test module avoids having to update the same test cases in two places.
def test_validate_target_device_valid_values(self):
test_cases = {
'CPU': 'CPU',
'GPU': 'GPU',
'GPU.0': 'GPU.0',
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sainijit
approved these changes
Aug 7, 2026
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
This PR adds support for explicit GPU device selection in the performance-tools repository.
Previously, only generic device names such as
CPU,GPU, andNPUwere supported. This change extends the implementation to support explicit device identifiers such asGPU.0,GPU.1, andGPU.2, allowing individual GPU devices to be selected when multiple GPUs are available on the system.Changes
Supported devices
CPUGPUGPU.0GPU.1GPU.2NPUValidation
The changes were validated on a machine with dGPU support.
The benchmark workflow was executed successfully using:
TARGET_DEVICE=GPU.1The following components were verified:
graph.pbtxtupdate.