Skip to content

Add toggle for wavefront size to cross compilation options - #5065

Merged
causten merged 7 commits into
developfrom
bdevorem/wavefront_size_cross_compilation
Jul 16, 2026
Merged

Add toggle for wavefront size to cross compilation options#5065
causten merged 7 commits into
developfrom
bdevorem/wavefront_size_cross_compilation

Conversation

@bdevorem

@bdevorem bdevorem commented Jul 14, 2026

Copy link
Copy Markdown
Member

Motivation

For cross compiling, we want to be able to toggle the wavefront size for architectures instead of just letting the decision be made strictly on whether or not the arch is gfx11 or gfx12.

Technical Details

This PR adds wavefront size as a toggle, which can be directly set via JSON object with the driver --gpu-arch-params option, or directly with a CLI flag --gpu-wavefront-size, or the various language APIs:

  1. --gpu-arch-params JSON (primary, matches other toggles)
migraphx-driver compile model.onnx --gpu-arch gfx1200 \
  --gpu-arch-params "{wavefront_size:64, num_cu:60}"
  1. Dedicated CLI flag
migraphx-driver compile model.onnx --gpu-arch gfx1200 --gpu-wavefront-size 64

Same as --gpu-num-cus style. --gpu-arch-params overrides this if both are set (same precedence pattern as the other params).

  1. C++ target API
auto t = migraphx::make_target("gpu", migraphx::value{
    {"gpu_arch", "gfx1200"},
    {"gpu_wavefront_size", 64},
});
p.compile(t);
  1. C API
migraphx::target t("gpu", "{gpu_arch: gfx1200, gpu_wavefront_size: 64
  1. Python API
t = migraphx.get_target("gpu", gpu_arch="gfx1200", gpu_wavefront_size=64)
p.compile(t)

Works automatically via reflect() on gpu::target

List was generated by cursor.

Changelog Category

Add a CHANGELOG.md entry for any option other than Not Applicable

    • Added: New functionality.
    • Changed: Changes to existing functionality.
    • Removed: Functionality or support that has been removed. (Compared to a previous release)
    • Optimized: Component performance that has been optimized or improved.
    • Resolved Issues: Known issues from a previous version that have been resolved.
    • Not Applicable: This PR is not to be included in the changelog.

Follow the LLVM AI Tool Use Policy for contributions using AI.

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

Adds an explicit wavefront-size override to MIGraphX GPU cross-compilation configuration, enabling users to force wave32/wave64 behavior during cross-compilation rather than relying only on architecture-based inference.

Changes:

  • Plumbed a new gpu_wavefront_size target option through GPU cross-compile context creation and synthetic hipDeviceProp_t generation.
  • Added --gpu-wavefront-size and wavefront_size support in --gpu-arch-params for migraphx-driver.
  • Updated tests, developer documentation, and changelog to cover the new option.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/targets/gpu/include/migraphx/gpu/target.hpp Adds gpu_wavefront_size to the GPU target’s reflected/serialized options.
src/targets/gpu/target.cpp Passes gpu_wavefront_size into cross-compile context creation.
src/targets/gpu/include/migraphx/gpu/context.hpp Extends cross-compile hip_device/context constructors to accept a wavefront-size override.
src/targets/gpu/include/migraphx/gpu/cross_compile_device.hpp Extends the cross-compile device-props API with a wavefront_size parameter.
src/targets/gpu/cross_compile_device.cpp Validates and applies the wavefront-size override when populating synthetic HIP device properties.
src/driver/main.cpp Adds --gpu-wavefront-size and JSON key mapping to pass wavefront size into GPU cross-compilation options.
test/gpu/jit.cpp Adds coverage for default vs overridden wavefront size in cross-compile device props.
test/gpu/target_serialize.cpp Adds serialization round-trip coverage for gpu_wavefront_size.
docs/dev/cross_compilation.rst Documents wavefront-size inference and explicit override mechanisms for cross-compilation.
CHANGELOG.md Adds an entry describing the new cross-compile wavefront size configuration.

Comment thread src/targets/gpu/cross_compile_device.cpp
Comment thread CHANGELOG.md Outdated
@gh-app-migraphx-bot-pr-write

gh-app-migraphx-bot-pr-write Bot commented Jul 15, 2026

Copy link
Copy Markdown
Test Batch New Rate (d85196) Old Rate (55ca93) Diff Status
torchvision-resnet50 64 3,153.69 3,169.20 -0.49%
torchvision-resnet50_fp16 64 6,662.68 6,721.88 -0.88%
torchvision-densenet121 32 2,695.78 2,712.99 -0.63%
torchvision-densenet121_fp16 32 4,552.33 4,578.90 -0.58%
torchvision-inceptionv3 32 1,798.05 1,805.02 -0.39%
torchvision-inceptionv3_fp16 32 2,844.22 2,855.31 -0.39%
cadene-inceptionv4 16 821.14 824.13 -0.36%
cadene-resnext64x4 16 783.01 785.46 -0.31%
slim-mobilenet 64 8,367.70 8,444.46 -0.91%
slim-nasnetalarge 64 229.27 229.50 -0.10%
slim-resnet50v2 64 3,167.58 3,185.35 -0.56%
bert-mrpc-onnx 8 1,171.17 1,173.56 -0.20%
bert-mrpc-tf 1 480.61 484.20 -0.74%
pytorch-examples-wlang-gru 1 475.17 472.27 0.61%
pytorch-examples-wlang-lstm 1 386.47 386.76 -0.07%
torchvision-resnet50_1 1 748.11 754.58 -0.86%
cadene-dpn92_1 1 440.34 444.58 -0.95%
cadene-resnext101_1 1 365.69 366.32 -0.17%
onnx-taau-downsample 1 401.22 402.99 -0.44%
dlrm-criteoterabyte 1 32.54 32.58 -0.12%
dlrm-criteoterabyte_fp16 1 52.06 52.65 -1.12%
agentmodel 1 8,733.40 7,784.58 12.19% 🔆
unet_fp16 2 57.08 57.48 -0.70%
resnet50v1_fp16 1 955.02 932.89 2.37%
resnet50v1_int8 1 939.03 934.74 0.46%
bert_base_cased_fp16 64 1,098.61 1,105.09 -0.59%
bert_large_uncased_fp16 32 345.48 347.51 -0.58%
bert_large_fp16 1 205.36 205.61 -0.12%
distilgpt2_fp16 16 2,087.51 2,104.89 -0.83%
yolov5s 1 560.66 559.63 0.18%
tinyllama 1 45.81 46.13 -0.70%
vicuna-fastchat 1 44.07 44.16 -0.20%
whisper-tiny-encoder 1 411.84 415.45 -0.87%
whisper-tiny-decoder 1 408.80 412.20 -0.83%
llama2_7b 1 20.85 21.00 -0.73%
qwen1.5-7b 1 14.95 23.73 -37.00% 🔴
phi3-3.8b 1 26.67 26.83 -0.60%
llama3-8b 1 14.04 21.87 -35.83% 🔴
whisper-large-encoder 1 10.16 10.23 -0.72%
whisper-large-decoder 1 104.97 104.89 0.08%
mistral-7b 1 6.73 23.89 -71.83% 🔴
FLUX.1-schnell 1 146.71 760.54 -80.71% 🔴

Regressions detected 🔴

@gh-app-migraphx-bot-pr-write

gh-app-migraphx-bot-pr-write Bot commented Jul 15, 2026

Copy link
Copy Markdown
Test Status Result
bert-mrpc-onnx PASSED: MIGraphX meets tolerance
bert-mrpc-tf PASSED: MIGraphX meets tolerance
pytorch-examples-wlang-gru PASSED: MIGraphX meets tolerance
pytorch-examples-wlang-lstm PASSED: MIGraphX meets tolerance
dlrm-criteoterabyte PASSED: MIGraphX meets tolerance
agentmodel PASSED: MIGraphX meets tolerance
unet PASSED: MIGraphX meets tolerance
resnet50v1 PASSED: MIGraphX meets tolerance
bert_base_cased_fp16 PASSED: MIGraphX meets tolerance
bert_large_uncased_fp16 🔴 FAILED: MIGraphX is not within tolerance - check verbose output
bert_large PASSED: MIGraphX meets tolerance
yolov5s PASSED: MIGraphX meets tolerance
tinyllama PASSED: MIGraphX meets tolerance
vicuna-fastchat PASSED: MIGraphX meets tolerance
whisper-tiny-encoder PASSED: MIGraphX meets tolerance
whisper-tiny-decoder PASSED: MIGraphX meets tolerance
distilgpt2_fp16 PASSED: MIGraphX meets tolerance
llama2_7b PASSED: MIGraphX meets tolerance
qwen1.5-7b PASSED: MIGraphX meets tolerance
phi3-3.8b PASSED: MIGraphX meets tolerance
llama3-8b PASSED: MIGraphX meets tolerance
whisper-large-encoder PASSED: MIGraphX meets tolerance
whisper-large-decoder PASSED: MIGraphX meets tolerance
mistral-7b PASSED: MIGraphX meets tolerance
FLUX.1-schnell PASSED: MIGraphX meets tolerance

@bdevorem
bdevorem marked this pull request as ready for review July 15, 2026 15:18
@bdevorem
bdevorem requested review from a team and causten as code owners July 15, 2026 15:18
@bdevorem
bdevorem force-pushed the bdevorem/wavefront_size_cross_compilation branch from 4d62f6f to 31a4cde Compare July 15, 2026 21:32
@bdevorem
bdevorem force-pushed the bdevorem/wavefront_size_cross_compilation branch from 31a4cde to d85196b Compare July 16, 2026 16:10
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5065      +/-   ##
===========================================
+ Coverage    92.89%   92.90%   +0.01%     
===========================================
  Files          603      603              
  Lines        32448    32526      +78     
===========================================
+ Hits         30140    30217      +77     
- Misses        2308     2309       +1     

see 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@causten
causten merged commit 1a5bb64 into develop Jul 16, 2026
39 checks passed
@causten
causten deleted the bdevorem/wavefront_size_cross_compilation branch July 16, 2026 21:06
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.

6 participants