Skip to content

feat: support privateuse1 backends in benchmark harness - #2708

Open
markc-614 wants to merge 2 commits into
pytorch:mainfrom
markc-614:mashaobin/benchmark/adapt-privateuse1-bench
Open

markc-614 wants to merge 2 commits into
pytorch:mainfrom
markc-614:mashaobin/benchmark/adapt-privateuse1-bench

Conversation

@markc-614

Copy link
Copy Markdown

Generalize device handling so third-party accelerators registered via the privateuse1 mechanism can run the benchmark, instead of hardcoding CUDA

  • Detect and append the registered privateuse1 backend to SUPPORT_DEVICE_LIST
  • Replace torch.cuda.synchronize() with backend-agnostic torch.get_device_module(device).synchronize() in timing/memory paths
  • Add register_deterministic_backend() and thread device through save/load_deterministic_dict() to apply backend-specific determinism flags
  • Gate gpu_peak_mem on max_memory_allocated availability instead of device == "cuda"
  • Generalize OOM detection from torch.cuda.OutOfMemoryError to torch.OutOfMemoryError
  • Use get_device_module for empty_cache / amp / device-name resolution

  Generalize device handling so third-party accelerators registered via the
  privateuse1 mechanism can run the benchmark, instead of hardcoding CUDA

  - Detect and append the registered privateuse1 backend to SUPPORT_DEVICE_LIST
  - Replace torch.cuda.synchronize() with backend-agnostic
    torch.get_device_module(device).synchronize() in timing/memory paths
  - Add register_deterministic_backend() and thread `device` through
    save/load_deterministic_dict() to apply backend-specific determinism flags
  - Gate gpu_peak_mem on max_memory_allocated availability instead of device == "cuda"
  - Generalize OOM detection from torch.cuda.OutOfMemoryError to torch.OutOfMemoryError
  - Use get_device_module for empty_cache / amp / device-name resolution
@meta-cla

meta-cla Bot commented Sep 20, 2026

Copy link
Copy Markdown

Hi @markc-614!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla

meta-cla Bot commented Sep 20, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the cla signed label Sep 20, 2026
@markc-614

Copy link
Copy Markdown
Author

@xuzhao9 @benjaminglass1 @retonym Could you please review this PR when you get a chance? Thanks!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant