Skip to content

Add explicit dGPU target device support - #243

Merged
sainijit merged 3 commits into
intel-retail:mainfrom
TanmayeeSharvani22:main
Aug 7, 2026
Merged

Add explicit dGPU target device support#243
sainijit merged 3 commits into
intel-retail:mainfrom
TanmayeeSharvani22:main

Conversation

@TanmayeeSharvani22

Copy link
Copy Markdown
Contributor

Summary

This PR adds support for explicit GPU device selection in the performance-tools repository.

Previously, only generic device names such as CPU, GPU, and NPU were supported. This change extends the implementation to support explicit device identifiers such as GPU.0, GPU.1, and GPU.2, allowing individual GPU devices to be selected when multiple GPUs are available on the system.

Changes

  • Added support for explicit GPU device selection.
  • Updated device validation logic.
  • Preserved backward compatibility with existing device names.

Supported devices

  • CPU
  • GPU
  • GPU.0
  • GPU.1
  • GPU.2
  • NPU

Validation

The changes were validated on a machine with dGPU support.

The benchmark workflow was executed successfully using:

TARGET_DEVICE=GPU.1

The following components were verified:

  • Correct target device propagation.
  • Successful graph.pbtxt update.
  • Successful benchmark execution.
  • No impact on existing functionality.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (including GPU.<index>).
  • Documented supported target devices and examples in the root README, and added the new test module to the python-test Makefile 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 importing device_validation. If the script is executed without the script directory already on sys.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.

Comment thread benchmark-scripts/benchmark.py
Comment thread benchmark-scripts/benchmark_test.py Outdated
Comment thread README.md
@sainijit
sainijit merged commit 48eb534 into intel-retail:main Aug 7, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants