Skip to content

Code comments update #4032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 29, 2025
Merged

Code comments update #4032

merged 2 commits into from
May 29, 2025

Conversation

CharlieL7
Copy link
Collaborator

Adds and edits code comments for clarity. I've been relearning how these functions work and noted having some explanatory comments would help. Please review for accuracy.

@CharlieL7 CharlieL7 self-assigned this May 27, 2025
@CharlieL7 CharlieL7 requested a review from causten as a code owner May 27, 2025 19:08
@CharlieL7 CharlieL7 added documentation simple small or simple changes skip bot checks Skips the Performance and Accuracy CI tests labels May 27, 2025
@CharlieL7 CharlieL7 changed the title Comments from prototyping Code comments update May 27, 2025
Copy link
Contributor

@lakhinderwalia lakhinderwalia left a comment

Choose a reason for hiding this comment

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

Thanks.

Copy link

codecov bot commented May 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4032      +/-   ##
===========================================
- Coverage    92.11%   92.03%   -0.08%     
===========================================
  Files          530      530              
  Lines        24472    24493      +21     
===========================================
  Hits         22541    22541              
- Misses        1931     1952      +21     
Files with missing lines Coverage Δ
src/include/migraphx/matcher.hpp 94.25% <ø> (ø)
src/include/migraphx/module.hpp 100.00% <ø> (ø)
src/include/migraphx/op/layout.hpp 90.00% <ø> (ø)
src/include/migraphx/shape.hpp 93.02% <ø> (ø)
src/module.cpp 86.68% <ø> (ø)

... and 2 files with indirect coverage changes

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

@migraphx-bot
Copy link
Collaborator

Test Batch Rate new
fce56b
Rate old
05bf15
Diff Compare
torchvision-resnet50 64 3,258.64 3,257.26 0.04%
torchvision-resnet50_fp16 64 6,915.67 6,911.36 0.06%
torchvision-densenet121 32 2,452.43 2,450.74 0.07%
torchvision-densenet121_fp16 32 4,205.00 4,205.47 -0.01%
torchvision-inceptionv3 32 1,628.34 1,628.71 -0.02%
torchvision-inceptionv3_fp16 32 2,719.28 2,724.75 -0.20%
cadene-inceptionv4 16 760.38 760.36 0.00%
cadene-resnext64x4 16 815.06 815.27 -0.03%
slim-mobilenet 64 7,477.42 7,478.40 -0.01%
slim-nasnetalarge 64 209.77 209.72 0.02%
slim-resnet50v2 64 3,348.16 3,346.20 0.06%
bert-mrpc-onnx 8 1,150.36 1,150.57 -0.02%
bert-mrpc-tf 1 460.72 460.43 0.06%
pytorch-examples-wlang-gru 1 342.51 333.24 2.78%
pytorch-examples-wlang-lstm 1 477.83 471.70 1.30%
torchvision-resnet50_1 1 786.68 798.42 -1.47%
cadene-dpn92_1 1 421.71 413.68 1.94%
cadene-resnext101_1 1 394.10 393.90 0.05%
onnx-taau-downsample 1 395.22 396.27 -0.26%
dlrm-criteoterabyte 1 32.35 32.34 0.03%
dlrm-criteoterabyte_fp16 1 51.37 51.41 -0.08%
agentmodel 1 10,310.39 10,451.11 -1.35%
unet_fp16 2 59.63 59.51 0.20%
resnet50v1_fp16 1 1,027.83 1,037.24 -0.91%
resnet50v1_int8 1 1,068.96 1,057.15 1.12%
bert_base_cased_fp16 64 1,175.79 1,175.90 -0.01%
bert_large_uncased_fp16 32 358.10 358.18 -0.02%
bert_large_fp16 1 199.99 200.60 -0.30%
distilgpt2_fp16 16 2,242.19 2,240.05 0.10%
yolov5s 1 539.14 536.12 0.56%
tinyllama 1 43.99 43.85 0.30%
vicuna-fastchat 1 45.18 45.11 0.15%
whisper-tiny-encoder 1 419.43 419.52 -0.02%
whisper-tiny-decoder 1 411.37 412.06 -0.17%
llama2_7b 1 19.10 19.13 -0.16%
qwen1.5-7b 1 23.54 23.54 0.01%
phi3-3.8b 1 26.62 26.63 -0.02%
mask-rcnn 1 12.84 12.80 0.28%
llama3-8b 1 21.78 21.77 0.03%
whisper-large-encoder 1 10.22 10.22 -0.02%
whisper-large-decoder 1 99.61 100.87 -1.25%
mistral-7b 1 23.77 23.76 0.05%
FLUX.1-schnell 1 765.73 765.45 0.04%
nan nan nan nan nan%

This build is not recommended to merge 🔴

@migraphx-bot
Copy link
Collaborator


     ✅ bert-mrpc-onnx: PASSED: MIGraphX meets tolerance

❌bert-mrpc-tf: ERROR - check error output2025-05-28 19:17:14.620003: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: SSE3 SSE4.1 SSE4.2 AVX AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1748477840.097645 182739 gpu_device.cc:2022] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 62973 MB memory: -> device: 0, name: AMD Instinct MI250X/MI250, pci bus id: 0000:b3:00.0
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1748477840.935187 182739 mlir_graph_optimization_pass.cc:401] MLIR V1 optimization pass is not enabled
2025-05-28 19:17:30.236208: E external/local_xla/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:250] bitcode module is required by this HLO module but was not found at ./opencl.bc
2025-05-28 19:17:30.236261: E external/local_xla/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:250] bitcode module is required by this HLO module but was not found at ./opencl.bc
2025-05-28 19:17:30.236307: E external/local_xla/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:250] bitcode module is required by this HLO module but was not found at ./opencl.bc
2025-05-28 19:17:30.236557: E external/local_xla/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:250] bitcode module is required by this HLO module but was not found at ./opencl.bc
2025-05-28 19:17:30.236606: E external/local_xla/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:250] bitcode module is required by this HLO module but was not found at ./opencl.bc
2025-05-28 19:17:30.236658: E external/local_xla/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:250] bitcode module is required by this HLO module but was not found at ./opencl.bc
2025-05-28 19:17:30.236712: E external/local_xla/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:250] bitcode module is required by this HLO module but was not found at ./opencl.bc
2025-05-28 19:17:30.236762: E external/local_xla/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc:250] bitcode module is required by this HLO module but was not found at ./opencl.bc
error: Failure when generating HSACO
error: Failure when generating HSACO
error: Failure when generating HSACO
error: Failure when generating HSACO
error: Failure when generating HSACO
error: Failure when generating HSACO
error: Failure when generating HSACO
error: Failure when generating HSACO
2025-05-28 19:17:30.237684: E tensorflow/compiler/mlir/tools/kernel_gen/tf_framework_c_interface.cc:228] INTERNAL: Generating device code failed.
2025-05-28 19:17:30.238791: W tensorflow/core/framework/op_kernel.cc:1829] UNKNOWN: JIT compilation failed.
2025-05-28 19:17:30.238811: I tensorflow/core/framework/local_rendezvous.cc:405] Local rendezvous is aborting with status: UNKNOWN: JIT compilation failed.
[[{{node import/bert/embeddings/LayerNorm/moments/SquaredDifference}}]]
2025-05-28 19:17:30.238823: I tensorflow/core/framework/local_rendezvous.cc:405] Local rendezvous is aborting with status: UNKNOWN: JIT compilation failed.
[[{{node import/bert/embeddings/LayerNorm/moments/SquaredDifference}}]]
[[import/loss/output/_21]]
2025-05-28 19:17:30.238847: I tensorflow/core/framework/local_rendezvous.cc:424] Local rendezvous recv item cancelled. Key hash: 11217777527359497193
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/tensorflow/python/client/session.py", line 1407, in _do_call
return fn(*args)
File "/usr/local/lib/python3.10/dist-packages/tensorflow/python/client/session.py", line 1390, in _run_fn
return self._call_tf_sessionrun(options, feed_dict, fetch_list,
File "/usr/local/lib/python3.10/dist-packages/tensorflow/python/client/session.py", line 1483, in _call_tf_sessionrun
return tf_session.TF_SessionRun_wrapper(self._session, options, feed_dict,
tensorflow.python.framework.errors_impl.UnknownError: 2 root error(s) found.
(0) UNKNOWN: JIT compilation failed.
[[{{node import/bert/embeddings/LayerNorm/moments/SquaredDifference}}]]
[[import/loss/output/_21]]
(1) UNKNOWN: JIT compilation failed.
[[{{node import/bert/embeddings/LayerNorm/moments/SquaredDifference}}]]
0 successful operations.
0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/src/AMDMIGraphX/tools/accuracy/accuracy_checker.py", line 340, in
main()
File "/src/AMDMIGraphX/tools/accuracy/accuracy_checker.py", line 324, in main
y_out = sess.run(y, feed_dict=tf_dict)
File "/usr/local/lib/python3.10/dist-packages/tensorflow/python/client/session.py", line 977, in run
result = self._run(None, fetches, feed_dict, options_ptr,
File "/usr/local/lib/python3.10/dist-packages/tensorflow/python/client/session.py", line 1220, in _run
results = self._do_run(handle, final_targets, final_fetches,
File "/usr/local/lib/python3.10/dist-packages/tensorflow/python/client/session.py", line 1400, in _do_run
return self._do_call(_run_fn, feeds, fetches, targets, options,
File "/usr/local/lib/python3.10/dist-packages/tensorflow/python/client/session.py", line 1426, in _do_call
raise type(e)(node_def, op, message) # pylint: disable=no-value-for-parameter
tensorflow.python.framework.errors_impl.UnknownError: Graph execution error:

Detected at node 'import/bert/embeddings/LayerNorm/moments/SquaredDifference' defined at (most recent call last):
Node: 'import/bert/embeddings/LayerNorm/moments/SquaredDifference'
Detected at node 'import/bert/embeddings/LayerNorm/moments/SquaredDifference' defined at (most recent call last):
Node: 'import/bert/embeddings/LayerNorm/moments/SquaredDifference'
2 root error(s) found.
(0) UNKNOWN: JIT compilation failed.
[[{{node import/bert/embeddings/LayerNorm/moments/SquaredDifference}}]]
[[import/loss/output/_21]]
(1) UNKNOWN: JIT compilation failed.
[[{{node import/bert/embeddings/LayerNorm/moments/SquaredDifference}}]]
0 successful operations.
0 derived errors ignored.

Original stack trace for 'import/bert/embeddings/LayerNorm/moments/SquaredDifference':


     ✅ 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: FAILED: MIGraphX is not within tolerance - check verbose output


     ✅ 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

🔴mask-rcnn: FAILED: MIGraphX is not within tolerance - check verbose output


     ✅ llama3-8b: PASSED: MIGraphX meets tolerance

     ✅ whisper-large-decoder: PASSED: MIGraphX meets tolerance

     ✅ mistral-7b: PASSED: MIGraphX meets tolerance

     ✅ FLUX.1-schnell: PASSED: MIGraphX meets tolerance

@causten causten merged commit fc6c0b2 into develop May 29, 2025
41 of 43 checks passed
@causten causten deleted the comments_update_matcher_mlir branch May 29, 2025 03:20
/**
* Rearrange the data layout of the input instruction based on the permutation attribute.
* permutation: List with how to rearrange data buffer of input instruction from order of slowest
* dimension to fastest dimension. Integers refer to input axes.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I dont think saying "order of slowest dimension to fastest dimension" is helpful here, as the is the order for all tensors. The permutation is the order of elements in memory not the order in the tensor. Its the transpose from the order of elements in the tensor to the order of elements in memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation simple small or simple changes skip bot checks Skips the Performance and Accuracy CI tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants