Skip to content

[Issue]: gpu::convolution: Shapes are not packed with correct layout #4012

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

Open
HeeebsInc opened this issue May 16, 2025 · 1 comment
Open

Comments

@HeeebsInc
Copy link

HeeebsInc commented May 16, 2025

Problem Description

I am running on a 7600 XT with ROCM 6.3.4.

I am running a computer vision model like YOLOv8 (not exactly like YOLOv8, but similar structure with convs / skips), and continue facing this ussue with the migraphx backend in torch compile and the python bindings for migraphx.

Whats weird is that im able to use the same model inside migraphx to quantize fp16 or use native fp32, so something is related between torch.compile(backend = 'migraphx') and int8 quantization

Ive attempted everything from forcing contiguity throughout my model, to overriding methods that may be caught within the trace, but im still facing it. What brought me to create the issue is that the exact same thing happens with migraphx int8 quantize

RuntimeError: /long_pathname_so_that_rpms_can_package_the_debug_info/src/AMDMIGraphX/src/include/migraphx/check_shapes.hpp:296: packed_layouts: gpu::convolution: Shapes are not packed with correct layout

Errors

model = mgx.parse_onnx(onnx_model)
param_name = model.get_parameter_names()[0]
shape = mgx.shape(type='float_type', lens=[1, 3, 1088, 1920])  # no strides → packed

calibration_data = []
for _ in range(2):
    input_np = np.random.rand(1, 3, 1088, 1920).astype(np.float32)
    input_np = np.ascontiguousarray(input_np)
    shape = mgx.shape(type='float_type', lens=[1, 3, 1088, 1920], strides=[6266880, 2088960, 1920, 1])
    arg = mgx.argument_from_pointer(shape, input_np.ctypes.data)
    calibration_data.append({param_name: arg})
mgx.quantize_int8(model, mgx.get_target('gpu'), calibration=calibration_data)
print('Attempting calibration..')
model.compile(mgx.get_target('gpu'), exhaustive_tune = True, offload_copy = False)

#AND 

model = torch.compile(model, backend = 'migraphx')

Does not Error

model = mgx.parse_onnx(onnx_model)
mgx.quantize_fp16(model, mgx.get_target('gpu'))
model.compile(mgx.get_target('gpu'), exhaustive_tune = True, offload_copy = False)

Any support on this would be greatly appreciated. Im new to the AMD ecosystem, and so far pretty impressed with the performance ive had.. trying to take it further

Operating System

Ubuntu 22.04

CPU

Ryzen 9 3900X + RX 7600 XT

GPU

AMD Radeon RX 7600

Other

7600 XT

ROCm Version

ROCm 6.0.0

Steps to Reproduce

No response

(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support

ROCk module version 6.10.5 is loaded

HSA System Attributes

Runtime Version: 1.14
Runtime Ext Version: 1.6
System Timestamp Freq.: 1000.000000MHz
Sig. Max Wait Duration: 18446744073709551615 (0xFFFFFFFFFFFFFFFF) (timestamp count)
Machine Model: LARGE
System Endianness: LITTLE
Mwaitx: DISABLED
DMAbuf Support: YES

==========
HSA Agents


Agent 1


Name: AMD Ryzen 9 3900X 12-Core Processor
Uuid: CPU-XX
Marketing Name: AMD Ryzen 9 3900X 12-Core Processor
Vendor Name: CPU
Feature: None specified
Profile: FULL_PROFILE
Float Round Mode: NEAR
Max Queue Number: 0(0x0)
Queue Min Size: 0(0x0)
Queue Max Size: 0(0x0)
Queue Type: MULTI
Node: 0
Device Type: CPU
Cache Info:
L1: 32768(0x8000) KB
Chip ID: 0(0x0)
ASIC Revision: 0(0x0)
Cacheline Size: 64(0x40)
Max Clock Freq. (MHz): 3800
BDFID: 0
Internal Node ID: 0
Compute Unit: 24
SIMDs per CU: 0
Shader Engines: 0
Shader Arrs. per Eng.: 0
WatchPts on Addr. Ranges:1
Memory Properties:
Features: None
Pool Info:
Pool 1
Segment: GLOBAL; FLAGS: FINE GRAINED
Size: 65739836(0x3eb1c3c) KB
Allocatable: TRUE
Alloc Granule: 4KB
Alloc Recommended Granule:4KB
Alloc Alignment: 4KB
Accessible by all: TRUE
Pool 2
Segment: GLOBAL; FLAGS: EXTENDED FINE GRAINED
Size: 65739836(0x3eb1c3c) KB
Allocatable: TRUE
Alloc Granule: 4KB
Alloc Recommended Granule:4KB
Alloc Alignment: 4KB
Accessible by all: TRUE
Pool 3
Segment: GLOBAL; FLAGS: KERNARG, FINE GRAINED
Size: 65739836(0x3eb1c3c) KB
Allocatable: TRUE
Alloc Granule: 4KB
Alloc Recommended Granule:4KB
Alloc Alignment: 4KB
Accessible by all: TRUE
Pool 4
Segment: GLOBAL; FLAGS: COARSE GRAINED
Size: 65739836(0x3eb1c3c) KB
Allocatable: TRUE
Alloc Granule: 4KB
Alloc Recommended Granule:4KB
Alloc Alignment: 4KB
Accessible by all: TRUE
ISA Info:


Agent 2


Name: gfx1102
Uuid: GPU-XX
Marketing Name: AMD Radeon™ RX 7600 XT
Vendor Name: AMD
Feature: KERNEL_DISPATCH
Profile: BASE_PROFILE
Float Round Mode: NEAR
Max Queue Number: 128(0x80)
Queue Min Size: 64(0x40)
Queue Max Size: 131072(0x20000)
Queue Type: MULTI
Node: 1
Device Type: GPU
Cache Info:
L1: 32(0x20) KB
L2: 2048(0x800) KB
Chip ID: 29824(0x7480)
ASIC Revision: 0(0x0)
Cacheline Size: 64(0x40)
Max Clock Freq. (MHz): 2470
BDFID: 2816
Internal Node ID: 1
Compute Unit: 32
SIMDs per CU: 2
Shader Engines: 2
Shader Arrs. per Eng.: 2
WatchPts on Addr. Ranges:4
Coherent Host Access: FALSE
Memory Properties:
Features: KERNEL_DISPATCH
Fast F16 Operation: TRUE
Wavefront Size: 32(0x20)
Workgroup Max Size: 1024(0x400)
Workgroup Max Size per Dimension:
x 1024(0x400)
y 1024(0x400)
z 1024(0x400)
Max Waves Per CU: 32(0x20)
Max Work-item Per CU: 1024(0x400)
Grid Max Size: 4294967295(0xffffffff)
Grid Max Size per Dimension:
x 4294967295(0xffffffff)
y 4294967295(0xffffffff)
z 4294967295(0xffffffff)
Max fbarriers/Workgrp: 32
Packet Processor uCode:: 412
SDMA engine uCode:: 21
IOMMU Support:: None
Pool Info:
Pool 1
Segment: GLOBAL; FLAGS: COARSE GRAINED
Size: 16760832(0xffc000) KB
Allocatable: TRUE
Alloc Granule: 4KB
Alloc Recommended Granule:2048KB
Alloc Alignment: 4KB
Accessible by all: FALSE
Pool 2
Segment: GLOBAL; FLAGS: EXTENDED FINE GRAINED
Size: 16760832(0xffc000) KB
Allocatable: TRUE
Alloc Granule: 4KB
Alloc Recommended Granule:2048KB
Alloc Alignment: 4KB
Accessible by all: FALSE
Pool 3
Segment: GROUP
Size: 64(0x40) KB
Allocatable: FALSE
Alloc Granule: 0KB
Alloc Recommended Granule:0KB
Alloc Alignment: 0KB
Accessible by all: FALSE
ISA Info:
ISA 1
Name: amdgcn-amd-amdhsa--gfx1102
Machine Models: HSA_MACHINE_MODEL_LARGE
Profiles: HSA_PROFILE_BASE
Default Rounding Mode: NEAR
Default Rounding Mode: NEAR
Fast f16: TRUE
Workgroup Max Size: 1024(0x400)
Workgroup Max Size per Dimension:
x 1024(0x400)
y 1024(0x400)
z 1024(0x400)
Grid Max Size: 4294967295(0xffffffff)
Grid Max Size per Dimension:
x 4294967295(0xffffffff)
y 4294967295(0xffffffff)
z 4294967295(0xffffffff)
FBarrier Max Size: 32
*** Done ***

Additional Information

os.environ['MIGRAPHX_DISABLE_MLIR'] = '1'
os.environ['MIOPEN_FIND_ENFORCE'] = '3'
os.environ['MIGRAPHX_ENABLE_CK'] = '1'
os.environ['MIGRAPHX_TUNE_CK'] = '1'
os.environ['AMD_LOG_LEVEL'] = '2'

@HeeebsInc
Copy link
Author

i tried upgrading to rocm 6.4 and i still face the issue

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

No branches or pull requests

1 participant