Skip to content

Reject invalid pointwise modules - #5144

Open
justinrosner wants to merge 2 commits into
developfrom
justinr-add-pointwise-error
Open

Reject invalid pointwise modules#5144
justinrosner wants to merge 2 commits into
developfrom
justinr-add-pointwise-error

Conversation

@justinrosner

Copy link
Copy Markdown
Contributor

Motivation

Some rocMLIR tuning configurations require splitting fused convolution/GEMM and pointwise modules. The resulting pointwise partition may contain unsupported shape operations, causing compilation failures.

Technical Details

  • Validate split pointwise modules before aliasing operations are removed.
  • Allow pointwise operations, literals, parameters, and returns.
  • Report the first unsupported instruction in the error.

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.

@justinrosner
justinrosner requested a review from pfultz2 August 17, 2026 20:10
@justinrosner
justinrosner requested a review from a team as a code owner August 17, 2026 20:10
Copilot AI lite review requested due to automatic review settings August 17, 2026 20:10
@justinrosner
justinrosner requested a review from causten as a code owner August 17, 2026 20:10

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 adds an explicit validation step for rocMLIR-generated split pointwise modules on the GPU path, rejecting modules that contain unsupported non-pointwise (notably shape/aliasing) instructions and surfacing a clear error that points at the first offending instruction.

Changes:

  • Introduces migraphx::gpu::validate_pointwise_module(const module&) to detect non-pointwise instructions (other than literals/params/returns) and throw with an actionable error message.
  • Hooks validation into the MLIR pointwise compilation flow before aliasing shape ops are removed, so invalid split modules fail early with a clear diagnostic.
  • Adds GPU tests that verify acceptance of pointwise + literal/param/return modules and rejection of representative shape operations.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
test/gpu/mlir_pointwise.cpp Adds GPU-side unit tests covering valid pointwise modules and rejection of shape ops.
src/targets/gpu/jit/mlir.cpp Implements validate_pointwise_module and calls it prior to pointwise module creation/alias cleanup.
src/targets/gpu/include/migraphx/gpu/mlir.hpp Exposes validate_pointwise_module as a GPU public API declaration.
CHANGELOG.md Documents the improved validation/error reporting for invalid split pointwise modules.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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

Copy link
Copy Markdown
Test Batch New Rate (858b0b) Old Rate (3a503c)* Diff Status
torchvision-resnet50 64 3,317.27 3,264.92 1.60%
torchvision-resnet50_fp16 64 7,871.85 7,548.67 4.28%
torchvision-densenet121 32 2,488.05 2,483.99 0.16%
torchvision-densenet121_fp16 32 5,022.11 5,004.24 0.36%
torchvision-inceptionv3 32 2,068.55 2,058.51 0.49%
torchvision-inceptionv3_fp16 32 4,455.34 4,416.99 0.87%
cadene-inceptionv4 16 816.96 820.61 -0.44%
cadene-resnext64x4 16 781.80 782.78 -0.12%
slim-mobilenet 64 8,375.14 8,386.36 -0.13%
slim-nasnetalarge 64 228.22 228.86 -0.28%
slim-resnet50v2 64 3,237.49 3,180.91 1.78%
bert-mrpc-onnx 8 1,169.58 1,168.84 0.06%
bert-mrpc-tf 1 499.12 498.63 0.10%
pytorch-examples-wlang-gru 1 484.01 473.35 2.25%
pytorch-examples-wlang-lstm 1 404.25 384.83 5.05% 🔆
torchvision-resnet50_1 1 1,052.60 1,046.63 0.57%
cadene-dpn92_1 1 453.21 437.32 3.63%
cadene-resnext101_1 1 365.85 365.89 -0.01%
onnx-taau-downsample 1 844.19 844.09 0.01%
dlrm-criteoterabyte 1 32.26 32.42 -0.48%
dlrm-criteoterabyte_fp16 1 51.63 51.80 -0.33%
agentmodel 1 14,485.43 9,209.12 57.29% 🔆
unet_fp16 2 58.29 58.80 -0.87%
resnet50v1_fp16 1 1,440.92 1,366.11 5.48% 🔆
resnet50v1_int8 1 1,794.24 1,883.96 -4.76%
bert_base_cased_fp16 64 1,097.35 1,098.16 -0.07%
bert_large_uncased_fp16 32 345.65 345.59 0.02%
bert_large_fp16 1 206.75 206.59 0.08%
distilgpt2_fp16 16 2,092.85 2,092.89 -0.00%
yolov5s 1 566.25 558.33 1.42%
tinyllama 1 45.78 45.83 -0.12%
vicuna-fastchat 1 44.24 44.20 0.10%
whisper-tiny-encoder 1 412.21 411.87 0.08%
whisper-tiny-decoder 1 410.04 408.48 0.38%
llama2_7b 1 20.85 20.84 0.08%
qwen1.5-7b 1 23.66 23.58 0.32%
phi3-3.8b 1 26.67 26.72 -0.16%
llama3-8b 1 21.75 21.80 -0.23%
whisper-large-encoder 1 10.16 10.18 -0.13%
whisper-large-decoder 1 106.07 105.30 0.73%
mistral-7b 1 23.78 23.78 0.03%
FLUX.1-schnell 1 774.14 755.22 2.51%

Check flagged results 🔆

* No develop baseline was found for this PR's branch point; compared against the latest available develop run instead.

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

Copy link
Copy Markdown
Test Status Result
bert-mrpc-onnx PASSED: MIGraphX meets tolerance
bert-mrpc-tf ERROR - check error output
traceback
Traceback (most recent call last):
File "/src/AMDMIGraphX/tools/accuracy/accuracy_checker.py", line 377, in
main()
File "/src/AMDMIGraphX/tools/accuracy/accuracy_checker.py", line 313, in main
import tensorflow as tf
File "/usr/local/lib/python3.12/dist-packages/tensorflow/init.py", line 40, in
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow # pylint: disable=unused-import
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 37, in
self_check.preload_check()
File "/usr/local/lib/python3.12/dist-packages/tensorflow/python/platform/self_check.py", line 63, in preload_check
from tensorflow.python.platform import _pywrap_cpu_feature_guard
ImportError: libnuma.so.1: cannot open shared object file: No such file or directory
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 🔴 FAILED: MIGraphX is not within tolerance - check verbose output
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

@justinrosner

Copy link
Copy Markdown
Contributor Author

@pfultz2 are you able to merge this into develop when all the CI checks finish? It looks like I don't have write access to MIGraphX.

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